summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--op-mode-definitions/reset-vpn.xml4
-rwxr-xr-xsrc/op_mode/reset_vpn.py23
2 files changed, 13 insertions, 14 deletions
diff --git a/op-mode-definitions/reset-vpn.xml b/op-mode-definitions/reset-vpn.xml
index c0b0ddeb1..a081ea488 100644
--- a/op-mode-definitions/reset-vpn.xml
+++ b/op-mode-definitions/reset-vpn.xml
@@ -62,13 +62,13 @@
<properties>
<help>Terminate all user's current remote access VPN session(s) with L2TP protocol</help>
</properties>
- <command>sudo ${vyos_op_scripts_dir}/reset_vpn.py --username="all_users" --protocol="l2tp"</command>
+ <command>sudo ${vyos_op_scripts_dir}/reset_vpn.py --username="$5" --protocol="l2tp"</command>
</leafNode>
<leafNode name="pptp">
<properties>
<help>Terminate all user's current remote access VPN session(s) with PPTP protocol</help>
</properties>
- <command>sudo ${vyos_op_scripts_dir}/reset_vpn.py --username="all_users" --protocol="pptp"</command>
+ <command>sudo ${vyos_op_scripts_dir}/reset_vpn.py --username="$5" --protocol="pptp"</command>
</leafNode>
</children>
</node>
diff --git a/src/op_mode/reset_vpn.py b/src/op_mode/reset_vpn.py
index 8962df212..15908ee77 100755
--- a/src/op_mode/reset_vpn.py
+++ b/src/op_mode/reset_vpn.py
@@ -30,41 +30,40 @@ def terminate_sessions(username='', interface='', protocol=''):
if username == "all_users":
if protocol == "pptp":
pptp_cmd = pptp_base.format('all','')
- run(pptp_cmd, stdout=DEVNULL, stderr=DEVNULL)
+ run(pptp_cmd)
return
elif protocol == "l2tp":
l2tp_cmd = l2tp_base.format('all', '')
- run(l2tp_cmd, stdout=DEVNULL, stderr=DEVNULL)
+ run(l2tp_cmd)
return
else:
pptp_cmd = pptp_base.format('all', '')
- run(pptp_cmd, stdout=DEVNULL, stderr=DEVNULL)
+ run(pptp_cmd)
l2tp_cmd = l2tp_base.format('all', '')
- run(l2tp_cmd, stdout=DEVNULL, stderr=DEVNULL)
+ run(l2tp_cmd)
return
if protocol == "pptp":
pptp_cmd = pptp_base.format('username', username)
- run(pptp_cmd, stdout=DEVNULL, stderr=DEVNULL)
+ run(pptp_cmd)
return
elif protocol == "l2tp":
l2tp_cmd = l2tp_base.format('username', username)
- run(l2tp_cmd, stdout=DEVNULL, stderr=DEVNULL)
+ run(l2tp_cmd)
return
else:
pptp_cmd = pptp_base.format('username', username)
- run(pptp_cmd, stdout=DEVNULL, stderr=DEVNULL)
- l2tp_cmd.append("terminate username {0}".format(username))
- run(l2tp_cmd, stdout=DEVNULL, stderr=DEVNULL)
+ run(pptp_cmd)
+ l2tp_cmd = l2tp_base.format('username', username)
+ run(l2tp_cmd)
return
# rewrite `terminate by interface` if pptp will have pptp%d interface naming
if interface:
pptp_cmd = pptp_base.format('if', interface)
- run(pptp_cmd, stdout=DEVNULL, stderr=DEVNULL)
+ run(pptp_cmd)
l2tp_cmd = l2tp_base.format('if', interface)
- run(l2tp_cmd, stdout=DEVNULL, stderr=DEVNULL)
-
+ run(l2tp_cmd)
def main():
#parese args