summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces_openvpn.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-07-22 19:24:13 +0100
committerGitHub <noreply@github.com>2024-07-22 19:24:13 +0100
commit91a18df734f8fc6fa2350af44273bdf91909743b (patch)
tree4866efea2d95c5b477b14f7b79a82c16bde3337d /src/conf_mode/interfaces_openvpn.py
parent163fdc33c2212d46309e442d299a894af279111d (diff)
parent334c96afdb906ee08eee66d072c57fcaeb198b02 (diff)
downloadvyos-1x-91a18df734f8fc6fa2350af44273bdf91909743b.tar.gz
vyos-1x-91a18df734f8fc6fa2350af44273bdf91909743b.zip
Merge pull request #3852 from vyos/mergify/bp/circinus/pr-3850
openvpn: T3834: verify() is not allowed to change anything on the system (backport #3850)
Diffstat (limited to 'src/conf_mode/interfaces_openvpn.py')
-rwxr-xr-xsrc/conf_mode/interfaces_openvpn.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/conf_mode/interfaces_openvpn.py b/src/conf_mode/interfaces_openvpn.py
index 0dc76b39a..320ab7b7b 100755
--- a/src/conf_mode/interfaces_openvpn.py
+++ b/src/conf_mode/interfaces_openvpn.py
@@ -235,10 +235,6 @@ def verify_pki(openvpn):
def verify(openvpn):
if 'deleted' in openvpn:
- # remove totp secrets file if totp is not configured
- if os.path.isfile(otp_file.format(**openvpn)):
- os.remove(otp_file.format(**openvpn))
-
verify_bridge_delete(openvpn)
return None
@@ -635,9 +631,19 @@ def generate_pki_files(openvpn):
def generate(openvpn):
+ if 'deleted' in openvpn:
+ # remove totp secrets file if totp is not configured
+ if os.path.isfile(otp_file.format(**openvpn)):
+ os.remove(otp_file.format(**openvpn))
+ return None
+
+ if 'disable' in openvpn:
+ return None
+
interface = openvpn['ifname']
directory = os.path.dirname(cfg_file.format(**openvpn))
openvpn['plugin_dir'] = '/usr/lib/openvpn'
+
# create base config directory on demand
makedir(directory, user, group)
# enforce proper permissions on /run/openvpn
@@ -654,9 +660,6 @@ def generate(openvpn):
if os.path.isdir(service_dir):
rmtree(service_dir, ignore_errors=True)
- if 'deleted' in openvpn or 'disable' in openvpn:
- return None
-
# create client config directory on demand
makedir(ccd_dir, user, group)