VPN Up - Shell Script for OpenConnect for Mac OS | Command-Line Client for Cisco AnyConnect
A shell script for OpenConnect which allows:
- to define multiple VPN connections, using different protocols
- to run openconnect without entering the username and password
- to run in the background / quietly
- to authenticate with a certificate
- to authenticate using Two-Factor Authentication (2FA) from Duo
- to check the status of the vpn connection
- 🆒 added support for Two-Factor Authentication (2FA) from Duo
- added support for using different protocols
- added options (start, stop, status, restart, status)
- can check status of the vpn connection
set options in file ~/.vpn/.env
VPN_NAME="VPN connection name"
VPN_HOST="vpn_server"
VPN_GROUP="vpn_group"
VPN_USER="vpn_login"
VPN_PASSWD=vpn_password
VPN_DUO2FAMETHOD=push #two factor method
SERVER_CERTIFICATE=""
PROTOCOL="anyconnect"
# anyconnect Compatible with Cisco AnyConnect SSL VPN, as well as ocserv (default)
# nc Compatible with Juniper Network Connect
# gp Compatible with Palo Alto Networks (PAN) GlobalProtect SSL VPN
# pulse Compatible with Pulse Connect Secure SSL VPN
BACKGROUND=TRUE
# TRUE Runs in background after startup
# FALSE Runs in foreground after startup
QUIET=TRUE
# TRUE Less output
# FALSE Detailed output
SUDO=FALSE
# TRUE
# FALSE
SUDO_PASSWORD=""
- Please make sure you have
openconnect
installed before moving on. Follow the instructions here. - Copy the
vpn-up.command
file to thebin
folder. - Create .env file in ~/.vpn
- Make an alias
alias vpn-up='~/bin/vpn-up.command start'
inbash
orzsh
shell. Follow the instructions here. - Run
vpn-up
to start and voilà.