[Scripts] Improve VPN script

This commit is contained in:
2025-10-16 10:44:27 +02:00
parent 30488edaed
commit a9c73ba9d9

View File

@@ -1,7 +1,8 @@
#!/usr/bin/env bash
connect() {
read -sp $'Please enter your Encryption Password:\n' encpass
read -sp $'Please enter your Encryption Password: ' encpass
echo " ==> Connecting"
TOKEN=$(cat ~/.local/share/ethz-vpn-connect/ethzvpntoken.secret | openssl enc -aes-256-cbc -pbkdf2 -d -a -k $encpass)
PASSWORD=$(cat ~/.local/share/ethz-vpn-connect/ethzvpnpass.secret | openssl enc -aes-256-cbc -pbkdf2 -d -a -k $encpass)
USERNAME=$(cat ~/.local/share/ethz-vpn-connect/ethzvpnusername.txt)
@@ -12,17 +13,15 @@ connect() {
}
disconnect() {
sudo killall -v -SIGINT openconnect #add -i option to ask for confirmation, usefull if running multible openconnect.
sudo killall -v -SIGINT openconnect
echo " ==> Disconnected"
}
setup() {
echo 'You are about to overwrite your secrets. Press ctrl + C to cancel.'
read -p $'Please enter your ETHZ-Username: ' USERNAME
echo 'Ok!'
read -sp $'Please choose and enter your Encryption Password (will be required when launching): ' encpass
echo 'Ok!'
read -sp $'Please enter your ETHZ WLAN (= Radius) Password: ' PASSWORD
echo 'Ok!'
read -sp $'Please enter your ETHZ OTP Secret: ' TOKEN
mkdir ~/.local/share/ethz-vpn-connect
echo $PASSWORD | openssl enc -aes-256-cbc -pbkdf2 -a -k $encpass >~/.local/share/ethz-vpn-connect/ethzvpnpass.secret
@@ -31,7 +30,7 @@ setup() {
encpass=""
PASSWORD=""
TOKEN=""
echo $'Secrets set\n'
echo $' ==> Secrets set <==\n'
}
case "$1" in