diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-12 11:42:00 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-12 12:04:47 +0200 |
commit | 895ef8729493a566631128908c4cfe848a781a0d (patch) | |
tree | 649267882aa8c08bd9bac555c918906b8bfe208a | |
parent | e10893227a0acb239daaf0e8a7af3a4e650370ae (diff) | |
download | vyos-1x-895ef8729493a566631128908c4cfe848a781a0d.tar.gz vyos-1x-895ef8729493a566631128908c4cfe848a781a0d.zip |
openvpn: T2273: cleanup config dir generation
-rwxr-xr-x | src/conf_mode/interfaces-openvpn.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index 2e8dc0855..d7ac6017b 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -97,14 +97,6 @@ def get_config_name(intf): cfg_file = f'/run/openvpn/{intf}.conf' return cfg_file -def openvpn_mkdir(directory): - # create directory on demand - if not os.path.exists(directory): - os.mkdir(directory) - - # fix permissions - corresponds to mode 755 - chmod_755(directory) - chown(directory, user, group) def checkCertHeader(header, filename): """ @@ -674,13 +666,13 @@ def generate(openvpn): rmtree(os.path.join(directory, 'ccd', interface), ignore_errors=True) # create config directory on demand - openvpn_mkdir(directory) - # create status directory on demand - openvpn_mkdir(directory + '/status') - # create client config dir on demand - openvpn_mkdir(directory + '/ccd') - # crete client config dir per interface on demand - openvpn_mkdir(directory + '/ccd/' + interface) + directories = [] + directories.append(f'{directory}/status') + directories.append(f'{directory}/ccd/{interface}') + for directory in directories: + if not os.path.exists(directory): + os.makedirs(directory, 0o755) + chown(directory, user, group) # Fix file permissons for keys fix_permissions = [] |