From 460f31f3074dd42373488f47186769aa1a666417 Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Wed, 3 Jan 2024 21:23:20 -0500 Subject: [PATCH] handle no vpn --- scripts/guru-vpn | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/guru-vpn b/scripts/guru-vpn index fa5c189..9cffc38 100755 --- a/scripts/guru-vpn +++ b/scripts/guru-vpn @@ -61,7 +61,7 @@ def handle_connect(args: argparse.Namespace) -> int: return 1 # If we are connected to AS54041, we need to briefly kill the connection - if is_interface_up("vpn"): + if args.wireguard_support and is_interface_up("vpn"): print("Bringing down AS54041 VPN") subprocess.run(["sudo", "wg-quick", "down", "vpn"], check=True) @@ -95,7 +95,8 @@ def handle_connect(args: argparse.Namespace) -> int: # Bring AS54041 back up print("Bringing up AS54041 VPN") - subprocess.run(["sudo", "wg-quick", "up", "vpn"], check=True) + if args.wireguard_support: + subprocess.run(["sudo", "wg-quick", "up", "vpn"], check=True) def handle_disconnect(args: argparse.Namespace) -> int: @@ -115,6 +116,12 @@ def main() -> int: choices=["connect", "disconnect", "reconnect"], help="Operation to perform", ) + ap.add_argument( + "-w", + "--wireguard-support", + help="Handles wireguard interfaces", + action="store_true", + ) args = ap.parse_args() # Ensure we can actually get credentials from the Yubikey