Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openvpn: T3834: verify() is not allowed to change anything on the system #3850

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/conf_mode/interfaces_openvpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down
Loading