From c62c2a7b586744b822afadd0a447af27442d50a0 Mon Sep 17 00:00:00 2001 From: Thomas Schmauder Date: Mon, 13 Feb 2023 12:07:30 +0100 Subject: [PATCH] Fix syntaxErr; add function to save a Pwd in KeyCh --- bibVPN.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) mode change 100644 => 100755 bibVPN.sh diff --git a/bibVPN.sh b/bibVPN.sh old mode 100644 new mode 100755 index e3ff830..3d7216e --- a/bibVPN.sh +++ b/bibVPN.sh @@ -30,6 +30,12 @@ ICON_disconnected="iVBORw0KGgoAAAANSUhEUgAAABgAAAAWCAYAAAGtemweAAAACXBIWXMAAAsSA # "security find-generic-password -g -a foo" where foo is an account # in your OSX Keychain, to avoid passwords stored in plain text GET_VPN_PASSWORD="security find-generic-password -g -a $VPN_USERNAME 2>&1 >/dev/null | cut -d'\"' -f2" +if [ -z $GET_VPN_PASSWORD ] ; then + if $(read "Es wurde kein Passwort im Schlüsselbund gefunden. Soll dort eins hinterlegt werden? (ja/nein)") == '[Jj][aA]' ; then + local $keychainPW = $(read "Wie lautet das Password für den Benutzer $VPN_USERNAME ?") + security add-generic-password -a $VPN_USERNAME -s openconnect -w $keychainPW + fi +fi # Command to determine if VPN is connected or disconnected VPN_CONNECTED="ifconfig | egrep -A1 'inet 172.[123][0-9]' |cut -d' ' -f2" @@ -87,7 +93,7 @@ else echo "| templateImage=$ICON_disconnected" #echo "VPN ❌ | color=Crimson" echo '---' - for config in (cat $ACCOUNTFILE) ; do + for config in $(cat $ACCOUNTFILE) ; do cfgName=$config cfgMail= cfgHost=