Allow manual pass/token input

This commit is contained in:
Jānis Jansons
2021-02-25 13:36:44 +02:00
parent bfa2b5edbe
commit 7a66600eee
+13 -1
View File
@@ -46,20 +46,32 @@ while true; do
# If yubikey is not used, use the TOTP seed
if [[ -z "$OC_YUBIKEY" ]]; then
if [[ -z "$SEED" ]]; then :; else
TOTP=$(oathtool --totp=sha1 -b "$SEED")
PASSWORD="$PASSWORD\n$TOTP"
fi
else
YUBIKEY_TOTP="--token-mode=yubioath --token-secret=$OC_YUBIKEY"
fi
if [ -z "$SEED" ] && [ -z "$OC_YUBIKEY" ]; then
sudo openconnect \
--csd-wrapper hostscan-bypass.sh \
--os=mac-intel \
$SCRIPT_INCLUDE \
-u $USERNAME \
$SERVER
else
echo -e "$PASSWORD" | sudo openconnect \
--csd-wrapper hostscan-bypass.sh \
--passwd-on-stdin \
--os=mac-intel \
$YUBIKEY_TOTP \
$SCRIPT_INCLUDE \
-u $USERNAME \
$SERVER
fi
echo "Openconnect closed. Waiting 3 seconds."
sleep 3