Skip to content

DmitriiMukhin/vpn-up-for-openconnect

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 

Repository files navigation

vpn-up-for-openconnect

VPN Up - Shell Script for OpenConnect for Mac OS | Command-Line Client for Cisco AnyConnect

Features

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

What's new

  • 🆒 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

Sample configuration section

BACKGROUND=TRUE
    # TRUE          Runs in background after startup
    # FALSE         Runs in foreground after startup

QUIET=TRUE
    # TRUE          Less output
    # FALSE         Detailed output

# VPN PROFILE 1
export VPN1_NAME="My Company VPN"
export VPN1_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
export VPN1_HOST=vpn.mycompany.com
export VPN1_AUTHGROUP=developers
export VPN1_USER=sorin.ipate
export VPN1_PASSWD="MyPassword"
export VPN1_DUO2FAMETHOD="push"  # Duo 2FA Method
    # passcode         Log in using a passcode, either generated with Duo Mobile, sent via SMS, generated by your hardware token, or provided by an administrator. E.g. to use the passcode “123456," type 123456
    # push             Push a login request to your registered phone (if you have Duo Mobile installed and activated on your iOS, or Windows phone device). Just review the request and select Approve to log in.
    # phone            Authenticate via callback to your registered phone.
    # sms              Sends an SMS message with a new batch of passcodes to your registered device. Your initial login attempt will fail. Login again with one of the new passcodes.
export VPN1_SERVER_CERTIFICATE="SHA1-OtherCharachters"  # SHA1

Run VPN Up

  1. Please make sure you have openconnect installed before moving on. Follow the instructions here.
  2. Download the latest release.
  3. Copy the vpn-up.command file to the bin folder.
  4. Update the vpn-up.command file with the appropiate VPN connection information as shown above.
  5. Make an alias alias vpn-up='~/bin/vpn-up.command' in bash or zsh shell. Follow the instructions here.
  6. Run vpn-up to start and voilà.

About

VPN Up for OpenConnect

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%