fixes
This commit is contained in:
		
							
								
								
									
										19
									
								
								bibVPN.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										19
									
								
								bibVPN.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@@ -59,7 +59,7 @@ IP=$(ifconfig | egrep -A1 "$NET_FILTER" |cut -d' ' -f2)
 | 
			
		||||
###################
 | 
			
		||||
function askFor(){
 | 
			
		||||
    osascript="$1 buttons {\"Cancel\",\"OK\"} default button {\"OK\"} cancel button \"Cancel\" with title \"Neuen User für das VPN anlegen\" with icon caution"
 | 
			
		||||
    echo $osascript
 | 
			
		||||
    #echo $osascript
 | 
			
		||||
    results=$( /usr/bin/osascript -e "$osascript")
 | 
			
		||||
    if [[ $? != 0 ]]; then
 | 
			
		||||
            clmsg='display notification "" with title "OpenFortiVPN" subtitle "Beende mich" sound name "Submarine"'
 | 
			
		||||
@@ -90,7 +90,7 @@ function showSettings()
 | 
			
		||||
        echo "---"
 | 
			
		||||
        echo "-- --- INFOS ---"
 | 
			
		||||
        echo "--Logfile: $logfile | shell='$0' param1=openlog terminal=false refresh=true tooltip='Das Logfile öffnen'"
 | 
			
		||||
        echo "--__${SETTINGSFILE}__ | md=true"
 | 
			
		||||
        echo "--${SETTINGSFILE} | shell='$0' param1=openDIR terminal=false refresh=true tooltip='Ordner öffnen'"
 | 
			
		||||
        echo "--Script: $(basename -- "$0") Version: **v$VERSION** | href="https://git.bib.de/itssct/OpenFortiVPN_macOS" terminal=false refresh=true tooltip='Die Projektwebsite im Browser öffnen' md=true"
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
@@ -140,8 +140,8 @@ case "$1" in
 | 
			
		||||
        osascript -e 'display notification "VPN Tunnel erfolgreich geschlossen" with title "OpenFortiVPN" 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 folgenden Dinge ein."'
 | 
			
		||||
        #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"')
 | 
			
		||||
@@ -150,19 +150,24 @@ case "$1" in
 | 
			
		||||
        if [[ -z $NEW_VPN_USERNAME ]] ; then echo -n "Wie lautet die E-Mail des Benutzers? " ; read NEW_VPN_USERNAME ; fi
 | 
			
		||||
 | 
			
		||||
        NEW_VPN_PUBKEY=$(gnutls-cli --print-cert $NEW_VPN_HOST |grep -e 'pin-.*:'|awk '{$1=$1;print}')
 | 
			
		||||
        NEW_VPN_PASSWORD=$(security find-generic-password -g -a $NEW_VPN_USERNAME 2>&1 >>$logfile) #>/dev/null)
 | 
			
		||||
        NEW_VPN_PASSWORD=$(security find-generic-password -g -a $NEW_VPN_USERNAME 2>&1 ) # >>$logfile) #>/dev/null)
 | 
			
		||||
        if [[ $NEW_VPN_PASSWORD =~ password ]] ; then
 | 
			
		||||
            echo "Es ist bereits ein Passwort im Schlüsselbund für $NEW_VPN_USERNAME hinterlegt."
 | 
			
		||||
        else
 | 
			
		||||
            echo -n "Es ist noch kein Passwort im Schlüsselbund hinterlegt. Bitte einmal das Passwort angeben : " ;
 | 
			
		||||
            NEW_VPN_PASSWORD=$(askFor 'display dialog "Es ist kein Passwort im Schlüsselbund vorhanden. Wie lautet das Passwort? " default answer "Mein Passwort..."')
 | 
			
		||||
            NEW_VPN_PASSWORD=$(askFor 'display dialog "Es ist kein Passwort im Schlüsselbund vorhanden. Wie lautet das Passwort? " default answer "Mein Passwort..." with hidden answer')
 | 
			
		||||
            security add-generic-password -a $NEW_VPN_USERNAME -s openconnect -w $NEW_VPN_PASSWORD
 | 
			
		||||
        fi
 | 
			
		||||
        echo "$NEW_VPN_NAME,$NEW_VPN_USERNAME,$NEW_VPN_HOST,$NEW_VPN_PUBKEY" >> $logfile # $ACCOUNTFILE
 | 
			
		||||
        echo "$NEW_VPN_NAME,$NEW_VPN_USERNAME,$NEW_VPN_HOST,$NEW_VPN_PUBKEY" >> $logfile >> $ACCOUNTFILE
 | 
			
		||||
        # Refreshen, damit das Profil direkt angezeigt wird.
 | 
			
		||||
        swiftbar://refreshallplugins
 | 
			
		||||
        ;;
 | 
			
		||||
    openlog)
 | 
			
		||||
        open -a console $logfile
 | 
			
		||||
        ;;
 | 
			
		||||
    openDIR)
 | 
			
		||||
        open ${WORKDIR}
 | 
			
		||||
        ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
if [ -f $OC_PIDFILE ]; then
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user