nsbin/vpn.sh

51 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/sh
# 2022-02-10, 10:25, Nico Schottelius
set -e
case "$1" in
lf)
2022-09-14 17:43:59 +00:00
# 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
2023-06-08 11:01:06 +00:00
pass lionfish/nschottelius1 | sudo openconnect --protocol=gp portal.techcorpapps.com --allow-insecure-crypto --user nschottelius1 --passwd-on-stdin --authgroup=Spain || sudo openconnect --protocol=gp portal.techcorpapps.com --allow-insecure-crypto --user nschottelius1 --passwd-on-stdin --authgroup=Spain
;;
lx)
cd ~/Nextcloud/luxembourg/nico/
sudo openvpn --config nico.ovpn
;;
2022-12-13 13:59:22 +00:00
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
;;
2023-01-05 12:42:32 +00:00
mirror2)
sudo wg-quick up rmr2n2
sudo wg-quick up rmr4n2
sudo wg-quick up rmr6n2
;;
2022-12-13 13:59:22 +00:00
*)
echo "Host does not have VPN assigned" >&2
exit 1
;;
esac
;;
*)
2022-12-13 14:03:56 +00:00
echo "$0 lf lx rm"
;;
esac