summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-openvpn.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-11-21 12:00:02 +0100
committerChristian Poessinger <christian@poessinger.com>2020-11-21 12:00:02 +0100
commited38b0dfc901ebafd597cc0f09400038f17cf058 (patch)
tree5c5c24ff0aaa0e4822ab953034aa6929bf015e2e /src/conf_mode/interfaces-openvpn.py
parent8783a4b2db12554cca805e70177366e222d1dfd6 (diff)
downloadvyos-1x-ed38b0dfc901ebafd597cc0f09400038f17cf058.tar.gz
vyos-1x-ed38b0dfc901ebafd597cc0f09400038f17cf058.zip
openvpn: T3060: fix client authentication username and password file
Diffstat (limited to 'src/conf_mode/interfaces-openvpn.py')
-rwxr-xr-xsrc/conf_mode/interfaces-openvpn.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py
index c23e79948..a4524a59e 100755
--- a/src/conf_mode/interfaces-openvpn.py
+++ b/src/conf_mode/interfaces-openvpn.py
@@ -464,12 +464,9 @@ def generate(openvpn):
if tmp: fix_permissions.append(tmp)
# Generate User/Password authentication file
- if 'auth' in openvpn:
- with open(openvpn['auth_user_pass_file'], 'w') as f:
- f.write('{}\n{}'.format(openvpn['auth_user'], openvpn['auth_pass']))
- # also change permission on auth file
- fix_permissions.append(openvpn['auth_user_pass_file'])
-
+ if 'authentication' in openvpn:
+ render(openvpn['auth_user_pass_file'], 'openvpn/auth.pw.tmpl', openvpn,
+ trim_blocks=True, user=user, group=group, permission=0o600)
else:
# delete old auth file if present
if os.path.isfile(openvpn['auth_user_pass_file']):
@@ -483,9 +480,6 @@ def generate(openvpn):
# Our client need's to know its subnet mask ...
client_config['server_subnet'] = dict_search('server.subnet', openvpn)
- import pprint
- pprint.pprint(client_config)
-
render(client_file, 'openvpn/client.conf.tmpl', client_config,
trim_blocks=True, user=user, group=group)