sane-scripts: better vpn factoring
This commit is contained in:
parent
005a79e680
commit
07e6ec2533
|
@ -24,6 +24,7 @@ resholve.mkDerivation {
|
||||||
file
|
file
|
||||||
findutils
|
findutils
|
||||||
gnugrep
|
gnugrep
|
||||||
|
gnused
|
||||||
gocryptfs
|
gocryptfs
|
||||||
ifuse
|
ifuse
|
||||||
inetutils
|
inetutils
|
||||||
|
@ -36,6 +37,7 @@ resholve.mkDerivation {
|
||||||
ssh-to-age
|
ssh-to-age
|
||||||
sops
|
sops
|
||||||
sudo
|
sudo
|
||||||
|
systemd
|
||||||
util-linux
|
util-linux
|
||||||
which
|
which
|
||||||
];
|
];
|
||||||
|
@ -69,6 +71,7 @@ resholve.mkDerivation {
|
||||||
"cannot:${rsync}/bin/rsync"
|
"cannot:${rsync}/bin/rsync"
|
||||||
"cannot:${sops}/bin/sops"
|
"cannot:${sops}/bin/sops"
|
||||||
"cannot:${ssh-to-age}/bin/ssh-to-age"
|
"cannot:${ssh-to-age}/bin/ssh-to-age"
|
||||||
|
"cannot:${systemd}/bin/systemctl"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
|
|
||||||
# first arg should be the region, e.g. `us` or `ukr`
|
# first arg should be the region, e.g. `us` or `ukr`
|
||||||
|
|
||||||
case $1 in
|
vpns=$(systemctl list-unit-files | grep wg-quick-ovpnd- | cut -f 1 -d ' ' | sed s'/^wg-quick-ovpnd-\([a-zA-Z-]*\)\.service$/\1/g')
|
||||||
ukr)
|
|
||||||
iface=wg-quick-ovpnd-ukr;;
|
if ! [ $(echo "$vpns" | grep "^$1$") ]
|
||||||
us)
|
then
|
||||||
iface=wg-quick-ovpnd-us;;
|
echo "invalid vpn name '$1'"
|
||||||
us-atlanta)
|
echo "choices:"
|
||||||
iface=wg-quick-ovpnd-us-atlanta;;
|
echo "$vpns"
|
||||||
*)
|
exit 1
|
||||||
echo "invalid vpn name '$1'"; exit 1;;
|
fi
|
||||||
esac
|
|
||||||
|
iface=wg-quick-ovpnd-$1.service
|
||||||
|
|
||||||
echo vpn: $(curl https://ipinfo.io/ip)
|
echo vpn: $(curl https://ipinfo.io/ip)
|
||||||
sudo systemctl stop $iface
|
sudo systemctl stop $iface
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
|
|
||||||
# first arg should be the region, e.g. `us` or `ukr`
|
# first arg should be the region, e.g. `us` or `ukr`
|
||||||
|
|
||||||
case $1 in
|
vpns=$(systemctl list-unit-files | grep wg-quick-ovpnd- | cut -f 1 -d ' ' | sed s'/^wg-quick-ovpnd-\([a-zA-Z-]*\)\.service$/\1/g')
|
||||||
ukr)
|
|
||||||
iface=wg-quick-ovpnd-ukr;;
|
if ! [ $(echo "$vpns" | grep "^$1$") ]
|
||||||
us)
|
then
|
||||||
iface=wg-quick-ovpnd-us;;
|
echo "invalid vpn name '$1'"
|
||||||
us-atlanta)
|
echo "choices:"
|
||||||
iface=wg-quick-ovpnd-us-atlanta;;
|
echo "$vpns"
|
||||||
*)
|
exit 1
|
||||||
echo "invalid vpn name '$1'"; exit 1;;
|
fi
|
||||||
esac
|
|
||||||
|
iface=wg-quick-ovpnd-$1.service
|
||||||
|
|
||||||
echo plain: $(curl https://ipinfo.io/ip)
|
echo plain: $(curl https://ipinfo.io/ip)
|
||||||
sudo systemctl start $iface
|
sudo systemctl start $iface
|
||||||
|
|
Loading…
Reference in New Issue
Block a user