fixes, no passwort breach in Log
This commit is contained in:
parent
c4339873f5
commit
4dfd9e8ccf
29
bibVPN.sh
29
bibVPN.sh
@ -23,7 +23,7 @@
|
||||
###################
|
||||
#### Variables ####
|
||||
###################
|
||||
VERSION='1.4.5'
|
||||
VERSION='1.4.6'
|
||||
WORKDIR="/Users/$USER/.openconnect"
|
||||
mkdir -p $WORKDIR
|
||||
logfile="$WORKDIR/bibVPN.log"
|
||||
@ -87,11 +87,11 @@ function askFor(){
|
||||
#üecho $osascript >> $logfile
|
||||
results=$( /usr/bin/osascript -e "$osascript")
|
||||
if [[ $? != 0 ]]; then
|
||||
clmsg='display notification "" with title "OpenFortiVPN" subtitle "Beende mich" sound name "Submarine"'
|
||||
clmsg='display notification "" with title "OpenConnectVPN" subtitle "Beende mich" sound name "Submarine"'
|
||||
osascript -e "$clmsg"
|
||||
exit 2
|
||||
else
|
||||
echo $results >> $logfile
|
||||
#echo $results >> $logfile
|
||||
theButton=$( echo "$results" | /usr/bin/awk -F "button returned:|," '{print $2}' )
|
||||
theText=$( echo "$results" | /usr/bin/awk -F "text returned:" '{print $2}' )
|
||||
|
||||
@ -102,8 +102,9 @@ function askFor(){
|
||||
echo $theText
|
||||
fi
|
||||
elif [[ $theButton == "Cancel" ]] ; then
|
||||
clmsg='display notification "" with title "OpenFortiVPN" subtitle "Beende mich" sound name "Submarine"'
|
||||
clmsg='display notification "" with title "OpenConnectVPN" subtitle "Beende mich" sound name "Submarine"'
|
||||
osascript -e "$clmsg"
|
||||
break
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
@ -140,17 +141,13 @@ case "$1" in
|
||||
echo "$GET_VPN_PASSWORD" >> $logfile
|
||||
VPN_PASSWORD=$(eval "$GET_VPN_PASSWORD")
|
||||
# Passwort checken
|
||||
if [[ $VPN_PASSWORD =~ 'item could not be found in the keychain.' ]] ; then
|
||||
|
||||
if [[ $VPN_PASSWORD =~ 'item could not be found in the keychain.' ]] ; then
|
||||
echo "Es konnte kein Passwort für $VPN_USERNAME gefunden werden" >> $logfile
|
||||
#errmsg_noPass='display notification "Es konnte kein Passwort für '$VPN_USERNAME' gefunden werden" with title "OpenFortiVPN" subtitle "Verbindungsversuch nicht erfolgreich" sound name "Brise"'
|
||||
#osascript -e "$errmsg_noPass"
|
||||
NEW_VPN_PASSWORD=$(askFor 'display dialog "Es ist kein Passwort im Schlüsselbund vorhanden. Wie lautet das Passwort für '$VPN_USERNAME'? " default answer "Mein Passwort..." with hidden answer')
|
||||
|
||||
if [[ $? != 0 ]]; then exit 2 ; fi # Beim Abbruch der Maske, gesamte Script beenden.
|
||||
echo $VPN_PASSWORD
|
||||
VPN_PASSWORD=$NEW_VPN_PASSWORD
|
||||
echo "security add-generic-password -a $VPN_USERNAME -s openconnect -w '$VPN_PASSWORD'" >> $logfile
|
||||
#echo "security add-generic-password -a $VPN_USERNAME -s openconnect -w '$VPN_PASSWORD'" >> $logfile
|
||||
SAVE_PASSWORD=$(askFor 'display dialog "Soll das Passwort, dauerhaft im Schlüsselbund gespeichert werden? "')
|
||||
if [[ $SAVE_PASSWORD == "OK" ]]; then
|
||||
security add-generic-password -a $VPN_USERNAME -s openconnect -T /usr/bin/security -w "$NEW_VPN_PASSWORD"
|
||||
@ -169,8 +166,8 @@ case "$1" in
|
||||
IP=$(ifconfig | egrep -A1 "$NET_FILTER" |cut -d' ' -f2)
|
||||
ii=0
|
||||
while [ -z $IP ] && [[ $ii != 20 ]]; do echo "noch keine IP" ; sleep 0.5 ; IP=$(ifconfig | egrep -A1 "$NET_FILTER"|cut -d' ' -f2) ; ((ii++)) ; done
|
||||
msg='display notification "Erfolgreich verbunden \nConnected User: '$VPN_USERNAME'" with title "OpenFortiVPN" subtitle "Deine IP lautet: '$IP'" sound name "Brise"'
|
||||
errmsg='display notification "Verbindungsversuch nicht erfolgreich. Vermutlich ist das Passwort falsch." with title "OpenFortiVPN" subtitle "Schade" sound name "Brise"'
|
||||
msg='display notification "Erfolgreich verbunden \nConnected User: '$VPN_USERNAME'" with title "OpenConnectVPN" subtitle "Deine IP lautet: '$IP'" sound name "Brise"'
|
||||
errmsg='display notification "Verbindungsversuch nicht erfolgreich. Vermutlich ist das Passwort falsch." with title "OpenConnectVPN" subtitle "Schade" sound name "Brise"'
|
||||
if [[ $IP =~ 172 ]] ; then
|
||||
osascript -e "$msg" ;
|
||||
else
|
||||
@ -185,14 +182,14 @@ case "$1" in
|
||||
eval "$VPN_DISCONNECT_CMD"
|
||||
# Wait for disconnection so menu item refreshes instantly
|
||||
until [ -z "$(eval "$VPN_CONNECTED")" ]; do sleep 1; eval "$VPN_CONNECTED" ;done
|
||||
osascript -e 'display notification "VPN Tunnel erfolgreich geschlossen" with title "OpenFortiVPN" subtitle "Mach Feierabend" sound name "Submarine"'
|
||||
osascript -e 'display notification "VPN Tunnel erfolgreich geschlossen" with title "OpenConnectVPN" subtitle "Mach Feierabend" sound name "Submarine"'
|
||||
;;
|
||||
newuser)
|
||||
#echo "Sie wollen einen weiteren Benutzer für das VPN anlegen. Geben Sie dazu die folgenden Dinge ein."
|
||||
askFor 'display dialog "Sie wollen einen weiteren Benutzer für das VPN anlegen. Geben Sie dazu die benötigten Daten an."'
|
||||
NEW_VPN_NAME=$(askFor 'display dialog "Wie soll die neue Verbindung heißen?" default answer "bib | eduUP | FHDW"' )
|
||||
NEW_VPN_USERNAME=$(askFor 'display dialog "Wie lautet die E-Mail des Benutzers, der zum Verbinden verwendet werden soll?" default answer "vorname.nachname@bib.de"' )
|
||||
NEW_VPN_HOST=$(askFor 'display dialog "Wie lautet der Servername?" default answer "vpn.bib.de"')
|
||||
NEW_VPN_NAME=$(askFor 'display dialog "Wie soll die neue Verbindung heißen?" default answer "bib | eduUP | FHDW"' ); if [[ $? != 0 ]]; then exit 2 ; fi # Beim Abbruch der Maske, gesamte Script beenden.
|
||||
NEW_VPN_USERNAME=$(askFor 'display dialog "Wie lautet die E-Mail des Benutzers, der zum Verbinden verwendet werden soll?" default answer "vorname.nachname@bib.de"' ); if [[ $? != 0 ]]; then exit 2 ; fi
|
||||
NEW_VPN_HOST=$(askFor 'display dialog "Wie lautet der Servername?" default answer "vpn.bib.de"'); if [[ $? != 0 ]]; then exit 2 ; fi
|
||||
if [[ -z $NEW_VPN_NAME ]] ; then echo -n "Wie lautet der Name der neuen Verbindung? " ; read NEW_VPN_NAME ; fi
|
||||
if [[ -z $NEW_VPN_HOST ]] ; then echo -n "Wie lautet der VPN-Server? "; read NEW_VPN_HOST ; fi
|
||||
if [[ -z $NEW_VPN_USERNAME ]] ; then echo -n "Wie lautet die E-Mail des Benutzers? " ; read NEW_VPN_USERNAME ; fi
|
||||
|
Loading…
Reference in New Issue
Block a user