From 59aa9c3f2e22bf3c38dcb4f2c61ca38e50385691 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Mon, 25 Apr 2022 13:21:06 +0000 Subject: op-mode: T4236: Split to new lines openvpn client certs The command "generate openvpn client-config" generates client.ovpn file and CA and client certificate are displayed in one line To fix it Add 'fill' that set new line after every x characters --- src/op_mode/generate_ovpn_client_file.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/op_mode/generate_ovpn_client_file.py') diff --git a/src/op_mode/generate_ovpn_client_file.py b/src/op_mode/generate_ovpn_client_file.py index 29db41e37..0628e6135 100755 --- a/src/op_mode/generate_ovpn_client_file.py +++ b/src/op_mode/generate_ovpn_client_file.py @@ -18,6 +18,7 @@ import argparse import os from jinja2 import Template +from textwrap import fill from vyos.configquery import ConfigTreeQuery from vyos.ifconfig import Section @@ -117,8 +118,11 @@ if __name__ == '__main__': exit(f'OpenVPN certificate key "{key}" does not exist!') ca = config.value(['pki', 'ca', ca, 'certificate']) + ca = fill(ca, width=64) cert = config.value(['pki', 'certificate', cert, 'certificate']) + cert = fill(cert, width=64) key = config.value(['pki', 'certificate', key, 'private', 'key']) + key = fill(key, width=64) remote_host = config.value(base + [interface, 'local-host']) ovpn_conf = config.get_config_dict(base + [interface], key_mangling=('-', '_'), get_first_key=True) -- cgit v1.2.3