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
+22 -10
View File
@@ -46,20 +46,32 @@ while true; do
# If yubikey is not used, use the TOTP seed # If yubikey is not used, use the TOTP seed
if [[ -z "$OC_YUBIKEY" ]]; then if [[ -z "$OC_YUBIKEY" ]]; then
TOTP=$(oathtool --totp=sha1 -b "$SEED")
PASSWORD="$PASSWORD\n$TOTP" if [[ -z "$SEED" ]]; then :; else
TOTP=$(oathtool --totp=sha1 -b "$SEED")
PASSWORD="$PASSWORD\n$TOTP"
fi
else else
YUBIKEY_TOTP="--token-mode=yubioath --token-secret=$OC_YUBIKEY" YUBIKEY_TOTP="--token-mode=yubioath --token-secret=$OC_YUBIKEY"
fi fi
echo -e "$PASSWORD" | sudo openconnect \ if [ -z "$SEED" ] && [ -z "$OC_YUBIKEY" ]; then
--csd-wrapper hostscan-bypass.sh \ sudo openconnect \
--passwd-on-stdin \ --csd-wrapper hostscan-bypass.sh \
--os=mac-intel \ --os=mac-intel \
$YUBIKEY_TOTP \ $SCRIPT_INCLUDE \
$SCRIPT_INCLUDE \ -u $USERNAME \
-u $USERNAME \ $SERVER
$SERVER
else
echo -e "$PASSWORD" | sudo openconnect \
--csd-wrapper hostscan-bypass.sh \
--os=mac-intel \
$YUBIKEY_TOTP \
$SCRIPT_INCLUDE \
-u $USERNAME \
$SERVER
fi
echo "Openconnect closed. Waiting 3 seconds." echo "Openconnect closed. Waiting 3 seconds."
sleep 3 sleep 3