summaryrefslogtreecommitdiff
path: root/sh/vpn
diff options
context:
space:
mode:
authorXiao Pan <gky44px1999@gmail.com>2024-06-27 17:03:59 -0700
committerXiao Pan <gky44px1999@gmail.com>2024-06-27 17:03:59 -0700
commit9022f8610434dbc2d279e93b673f0b045f4bd1cc (patch)
tree3dc833866ff37ac596a14240da63aa70ee0cffaf /sh/vpn
parent415a169d17d251add2fdb81d0141b891b2893c8a (diff)
new aa vpn default wg to ca, so need to disable that and enable aa vpn server listen to insp wg directly
Diffstat (limited to 'sh/vpn')
-rwxr-xr-xsh/vpn8
1 files changed, 8 insertions, 0 deletions
diff --git a/sh/vpn b/sh/vpn
index 497b20d..9811453 100755
--- a/sh/vpn
+++ b/sh/vpn
@@ -16,10 +16,18 @@ if ! [ "$1" ] || [ "$1" = mydefault ]; then
fi
if nmcli -t --fields device,state device | grep -q "^wg_$1:connected$"; then
+ if [ "$1" = aa ]; then
+ # stop aa wireguard+swgp server that listen from insp wiregurad+swgp client, start aa wg+swgp connect to ca
+ # use /usr/bin/alacritty instead of /home/xyz/.local/bin/alacritty so script can wait until alacritty exit to run other codes following
+ /usr/bin/alacritty -T aa --hold -e ssh -t aa.flylightning.xyz 'sudo systemctl stop wg-quick@wg0 && sudo systemctl start wg-quick@wg_ca'
+ fi
down_not_mydefault
nmcli connection up wg_mydefault
notify-send -u critical "$1 VPN disabled"
else
+ if [ "$1" = aa ]; then
+ /usr/bin/alacritty -T aa --hold -e ssh -t aa.flylightning.xyz 'sudo systemctl stop wg-quick@wg_ca && sudo systemctl start wg-quick@wg0'
+ fi
down_not_mydefault
nmcli connection down wg_mydefault
nmcli connection up "wg_$1"