summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-04-25 13:21:06 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-04-26 09:41:26 +0000
commit59aa9c3f2e22bf3c38dcb4f2c61ca38e50385691 (patch)
tree18459b6e0d72da283cef31f298c4eef2b32436e2 /src/op_mode
parentfd9f82f96041b137885c99c526ac6efe2c4abc57 (diff)
downloadvyos-1x-59aa9c3f2e22bf3c38dcb4f2c61ca38e50385691.tar.gz
vyos-1x-59aa9c3f2e22bf3c38dcb4f2c61ca38e50385691.zip
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
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/generate_ovpn_client_file.py4
1 files changed, 4 insertions, 0 deletions
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)