nsbin/vpn.sh
2023-05-08 09:00:05 +02:00

50 lines
1.6 KiB
Bash
Executable file

#!/bin/sh
# 2022-02-10, 10:25, Nico Schottelius
set -e
case "$1" in
lf)
# Ensure we are on the right branch and pass has been unlocked
pass git checkout nico-privat
pass lionfish/nschottelius1 > /dev/null
# Try to input the password directly, revert to non input if it fails
pass lionfish/nschottelius1 | sudo openconnect --protocol=gp portal.techcorpapps.com --allow-insecure-crypto --user nschottelius1 --passwd-on-stdin --authgroup=Europe || sudo openconnect --protocol=gp portal.techcorpapps.com --allow-insecure-crypto --user nschottelius1 --passwd-on-stdin --authgroup=Europe
;;
lx)
cd ~/Nextcloud/luxembourg/nico/
sudo openvpn --config nico.ovpn
;;
rm)
case $(hostname) in
bridge)
sudo wg-quick up rmr1n2
sudo wg-quick up rmr3n2
sudo wg-quick up rmr5n2
;;
nb3)
sudo wg-quick up rmr1n1
sudo wg-quick up rmr3n1
sudo wg-quick up rmr5n1
;;
blind)
sudo wg-quick up rmr2n1
sudo wg-quick up rmr4n1
sudo wg-quick up rmr6n1
;;
mirror2)
sudo wg-quick up rmr2n2
sudo wg-quick up rmr4n2
sudo wg-quick up rmr6n2
;;
*)
echo "Host does not have VPN assigned" >&2
exit 1
;;
esac
;;
*)
echo "$0 lf lx rm"
;;
esac