#!/bin/bash # Get current status of a VPN connection with options to connect/disconnect. # Working with OpenConnect, but can work with any executable VPN. Commands # that require admin permissions should be whitelisted with 'visudo', e.g.: # #joesmith ALL=(ALL) NOPASSWD: /usr/local/bin/openconnect #joesmith ALL=(ALL) NOPASSWD: /usr/bin/killall -2 openconnect # VPN Status # v1.1 # Jesse Jarzynka # jessejoe # Displays status of a VPN interface with option to connect/disconnect. # http://i.imgur.com/RkmptwO.png # tunnel icon by Icons8 ################### #### Variables #### ################### WORKDIR="/Users/$USER/.openconnect" mkdir -p $WORKDIR logfile="$WORKDIR/bibVPN.log" echo -e "\nStart: $(date)" >>$logfile echo "Run $0 $@" >> $logfile PATH=$PATH:/usr/local/bin VPN_EXECUTABLE=$(which openconnect) OC_PIDFILE="$WORKDIR/vpn.bib.de.pid" SETTINGSFILE="$WORKDIR/settings.csv" ACCOUNTFILE="$WORKDIR/accounts.csv" VPN_USERNAME="$2" VPN_HOST="$3" # A command that will result in your VPN password. GET_VPN_PASSWORD="security find-generic-password -g -a $VPN_USERNAME 2>&1 >/dev/null | cut -d'\"' -f2" # Command to determine if VPN is connected or disconnected VPN_CONNECTED="ifconfig | egrep -A1 '$NET_FILTER' |cut -d' ' -f2" # Command to run to disconnect VPN VPN_DISCONNECT_CMD="sudo killall -2 openconnect" #### Settings #### SHOW_SETTINGS='OFF' SHOW_ICONS='OFF' NET_FILTER='inet 172.[123][0-9].1[67][80].' FONT=( 'size=14' 'font=UbuntuMono' ) # Get IP of Current VPN Tunnel IP=$(ifconfig | egrep -A1 "$NET_FILTER" |cut -d' ' -f2) #### Icons #### ICON_connected_tnblk="iVBORw0KGgoAAAANSUhEUgAAABgAAAAWCAYAAAGtemweAAAACXBIWXMAAAsSAAALEgHS3X78AAAA+klEQVR4nNRUwQ2DMAzMKy8WYIZOwb8LtUtAJSZp34zBCn3y4Y3cWLEr13KSllKhnnRKcvHZ4AScS6BJbUSMgRCncfJcaBG0KMcvMIj83ircWcUh9VTI46onO1A75sC2FIjpT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yZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJzYXZlZCIKICAgICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmZTI5NGVkYS01OWQ0LTQ2YWQtYjdkYS01M2YyZWY2NTU0ODYiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoTWFjIE9TKSIKICAgICAgc3RFdnQ6d2hlbj0iMjAyMy0wMy0wMVQyMDozNTozNiswMTowMCIvPgogICAgPC9yZGY6U2VxPgogICA8L3htcE1NOkhpc3Rvcnk+CiAgPC9yZGY6RGVzY3JpcHRpb24+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz7u++bOAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5wMBEyMkpEMStgAAAUxJREFUSMfdlFtPg0AQhb8FWiNt06hRE1P1//8wDd5Sr/RCAV8OybqysJg+qJNsJsDOnDPnTAt/PUzAnRSYARNgDFRACbwBHzreiDq+jYAr4BJ41F0DxMpPwAK41t3WiD3vD1V4oGYV8K5JAB402VTN58AKKEImGAHnDvgxsANqnZ3e2URPJWHvBAvgXoxTkcjF8E7SxCIyFtgt8AqcKXsBUjGZA1tgqZxp/GaCwmr0IikvlL9I5QKcSH+jrYnV3Be5WB9ZG9n4BUDiFCSSoPHiOWCNl8pbq85rstGOl3peBQA0d5q6yGVsx1SniZsAgErrOxv6Q9tLJC3j5tZG2dLVPTK11X0DqCz9qwFEvXUuwETHjboHwFf3OzwYy4ON58+y7PIg8mhZWloaETEBHpQ/8WDjYY9lbLAHxR5kL7oAMuvCekDTtdU841/FJ2zEW2dRM89OAAAAAElFTkSuQmCC/WUWWYEkIieVgHlXZQZafC3Z7ph/56OQrVQ1lwAJfhA7QM6H/+jnCDyTKnkJ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3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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MAAAsTAAALEwEAmpwYAAAB0klEQVR4nL2Uv2vVUBTHC/5A0YJ1cNRJkf4DRZe3VEWCeff7DXcrVCi8goh06/T6qkPBycHJf6FKty51a3F8XWxnR3GpIFpyToYrJ01iaPJ4jwoNHAjnfvLhfG9uMjV13lfq3L2UfJYlyeOUvH8mSfD+ggIvhHynwL6SIS9gX4D3CrwKvd6lSWU3Bdg1gQBfMiAqhXZvvXyN3AvArXGyy0puVROdPPhcgO9C/hByqb6m5Mfg/dWRQgX6Fid1jiZQ8lvqXDfE8XTw/noKxEp+tTVjFFhWctA+3eLiFSF/Fnv1SYDXIYpmGtzCwjUh3xhTJPhlzzaEGfnEhEIeCfBbnetUkm73hlWVJEnmhPyTs+RR5tzTZlzypUkzct6mK/vH5B0hd6yOvb9d9gV4a2wGPLIT0SYc1I7H4ciN/rffh7WXM2gAAqzXhAcTCA+qkwCstwEreYSTyBvWC53ORQG2Bfhc1Lb1igE2Sl6BlbbIa+UmKzks+/mRiaKZvOJ4usYPa/zauUReVeBDXuSm9VIyUbJXL+sVE25WPLA6mdC+htNC5zipsH/WyAr0m0CSPBQyK6DqpYwUksPi08vUuQetkP1MBfCp97PjhMbkLHl3HPtf11+hG5+kEXZX9AAAAABJRU5ErkJggg==" ICON_CONNECTED=$ICON_CLR_con ICON_DISCONNECTED=$ICON_CLR_dis ################### #### Functions #### ################### function askFor(){ osascript=$1+' buttons {"Cancel","OK"} default button {"OK"} with title "Neuen User für das VPN anlegen"' results=$( /usr/bin/osascript -e $osascript) theButton=$( echo "$results" | /usr/bin/awk -F "button returned:|," '{print $2}' ) theText=$( echo "$results" | /usr/bin/awk -F "text returned:" '{print $2}' ) if [[ $theButton == "OK" ]] ;then echo $theText; fi } function showSettings() { if [[ $SHOW_SETTINGS == "ON" ]]; then echo "---" echo "Settings" echo "--$SETTINGSFILE" echo "--Farbige Icons aus" echo "--Tunnelblick Icons aus" echo "--Neuen User anlegen| shell='$0' param1=newuser terminal=false refresh=true" fi } ################### ###### MAIN ####### ################### case "$1" in connect) VPN_PASSWORD=$(eval "$GET_VPN_PASSWORD") # Passwort checken #if [[ -z VPN_PASSWORD ]]; then VPN_PASSWORD=$(askFor 'display dialog "Es ist kein Passwort im Schlüsselbund vorhanden. Wie lautet das Passwort? " default answer "vpn.bib.de"'); fi #security add-generic-password -a $VPN_USERNAME -s openconnect -w $keychainPW VPN_EXECUTABLE_PARAMS="--servercert $4 --protocol=fortinet" # Optional # Verbindung aufbauen echo "echo | sudo $VPN_EXECUTABLE $VPN_EXECUTABLE_PARAMS --user $VPN_USERNAME --passwd-on-stdin $VPN_HOST --pid-file=$OC_PIDFILE --background" > $logfile 2>&1 echo "$VPN_PASSWORD" | sudo $VPN_EXECUTABLE $VPN_EXECUTABLE_PARAMS --user $VPN_USERNAME --passwd-on-stdin $VPN_HOST --pid-file=$OC_PIDFILE --background > $logfile 2>&1 IP=$(ifconfig | egrep -A1 "$NET_FILTER" |cut -d' ' -f2) while [ -z $IP ]; do echo "noch keine IP" ; sleep 0.5 ; IP=$(ifconfig | egrep -A1 "$NET_FILTER"|cut -d' ' -f2) ; 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" with title "OpenFortiVPN" subtitle "Schade" sound name "Brise"' if [[ $IP =~ 172 ]] ; then osascript -e "$msg" ; else osascript -e "$errmsg" ; fi # Wait for connection so menu item refreshes instantly until eval "$VPN_CONNECTED"; do sleep 1; done ;; disconnect) eval "$VPN_DISCONNECT_CMD" # Wait for disconnection so menu item refreshes instantly until [ -z "$(eval "$VPN_CONNECTED")" ]; do sleep 1; done 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." #echo -n "Wie lautet der Name der neuen Verbindung? " ; read NEW_VPN_NAME NEW_VPN_NAME=$(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"') echo -n "Wie lautet der VPN-Server? "; read NEW_VPN_HOST echo -n "Wie lautet die E-Mail des Benutzers? " ; read NEW_VPN_USERNAME 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 >/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_PASS = $(read ) security add-generic-password -a $NEW_VPN_USERNAME -s openconnect -w $NEW_VPN_PASS fi echo "$NEW_VPN_NAME,$NEW_VPN_USERNAME,$NEW_VPN_HOST,$NEW_VPN_PUBKEY" #>> $ACCOUNTFILE ;; esac #if [ -n "$(eval "$VPN_CONNECTED")" ]; then if [ -f $OC_PIDFILE ]; then if [ $SHOW_ICONS == 'ON' ]; then echo "| templateImage=$ICON_CONNECTED| color=green" ; else echo "VPN ✔ |$FONT color=green" ; fi echo '---' echo "Disconnect VPN | bash='$0' param1=disconnect terminal=false refresh=true" aUser=$(ps -ef | grep -e '--user\ ' | cut -d' ' -f 32) if [[ $aUser =~ .*@.* ]]; then echo "User: $aUser" ; fi echo "IP: $IP" showSettings exit else if [ $SHOW_ICONS == 'ON' ] ; then echo "| templateImage=$ICON_DISCONNECTED | color=Crimson" ; else echo "VPN ❌ | $FONT color=Crimson" ; fi echo '---' # Alle User aus der accounts.csv auslesen und dann zur Auswahl anbieten. cat "$ACCOUNTFILE" | while IFS= read config; do [[ $config =~ ^#.* ]] && continue cfgName=$(echo $config|cut -d',' -f1) cfgMail=$(echo $config|cut -d',' -f2) cfgHost=$(echo $config|cut -d',' -f3) cfgPubKey=$(echo $config|cut -d',' -f4) echo "Connect $cfgName VPN | shell='$0' param1=connect param2=$cfgMail param3=$cfgHost param4=$cfgPubKey terminal=false refresh=true" done showSettings exit fi