diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-12-17 11:12:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-17 11:12:41 +0100 |
commit | 588aa7398ab4ebe0162c5fcef94bf4b90c2cee0b (patch) | |
tree | a1cd46a73a05b40918105cf5ac0858065cd23069 | |
parent | b56917451dbb57a148bf5b997fb507632c6829fd (diff) | |
parent | 31775f71a5141a9714efb19fe101c71eb17a96ba (diff) | |
download | vyos-1x-588aa7398ab4ebe0162c5fcef94bf4b90c2cee0b.tar.gz vyos-1x-588aa7398ab4ebe0162c5fcef94bf4b90c2cee0b.zip |
Merge pull request #1715 from c-po/current
op-mode: T707: remove dedicated calls to sudo in vpn_ipsec
-rwxr-xr-x | src/op_mode/vpn_ipsec.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/op_mode/vpn_ipsec.py b/src/op_mode/vpn_ipsec.py index 68dc5bc45..2392cfe92 100755 --- a/src/op_mode/vpn_ipsec.py +++ b/src/op_mode/vpn_ipsec.py @@ -48,8 +48,8 @@ def reset_peer(peer, tunnel): result = True for conn in conns: try: - call(f'sudo /usr/sbin/ipsec down {conn}{{*}}', timeout = 10) - call(f'sudo /usr/sbin/ipsec up {conn}', timeout = 10) + call(f'/usr/sbin/ipsec down {conn}{{*}}', timeout = 10) + call(f'/usr/sbin/ipsec up {conn}', timeout = 10) except TimeoutExpired as e: print(f'Timed out while resetting {conn}') result = False @@ -81,8 +81,8 @@ def reset_profile(profile, tunnel): print('Profile not found, aborting') return - call(f'sudo /usr/sbin/ipsec down {conn}') - result = call(f'sudo /usr/sbin/ipsec up {conn}') + call(f'/usr/sbin/ipsec down {conn}') + result = call(f'/usr/sbin/ipsec up {conn}') print('Profile reset result: ' + ('success' if result == 0 else 'failed')) @@ -90,17 +90,17 @@ def debug_peer(peer, tunnel): peer = peer.replace(':', '-') if not peer or peer == "all": debug_commands = [ - "sudo ipsec statusall", - "sudo swanctl -L", - "sudo swanctl -l", - "sudo swanctl -P", - "sudo ip x sa show", - "sudo ip x policy show", - "sudo ip tunnel show", - "sudo ip address", - "sudo ip rule show", - "sudo ip route | head -100", - "sudo ip route show table 220" + "ipsec statusall", + "swanctl -L", + "swanctl -l", + "swanctl -P", + "ip x sa show", + "ip x policy show", + "ip tunnel show", + "ip address", + "ip rule show", + "ip route | head -100", + "ip route show table 220" ] for debug_cmd in debug_commands: print(f'\n### {debug_cmd} ###') @@ -117,7 +117,7 @@ def debug_peer(peer, tunnel): return for conn in conns: - call(f'sudo /usr/sbin/ipsec statusall | grep {conn}') + call(f'/usr/sbin/ipsec statusall | grep {conn}') if __name__ == '__main__': parser = argparse.ArgumentParser() |