Simple Cisco AnyConnect VPN CLI tool.
Step one: Get the VPN bash script from the github repo (curl command below)
curl -o ./vpn https://raw.githubusercontent.com/amoskyler/anyconnect-vpn-helper/master/bin/vpn && chmod 700 ./vpn && mv ./vpn /usr/local/bin
This will do three things:
- Download the vpn CLI script from the github repository and store it in a file at your current directory named
vpn
- Give the vpn script read, write, and execute permissions for only the current user
- and move the file
vpn
to the pathusr/local/bin
Step two: Substitute in your own VPN credentials
subl /usr/local/bin/vpn
- Now modify the following values to your VPN credentials
-
__VPN_ADDRESS
// URL to vpn -__CLIENT
// path to the Cisco AnyConnect vpn binary -__GROUP
// VPN group (0 for two factor) -__USERNAME
-__PASSWORD
-__SECOND_PASSWORD
// DUO method (e.g. PUSH)
Step three: If you're using bash change the first line to read #!/bin/bash (or to whatever shell you're using)
- Type
vpn connect
to start the connection process...Complete the process by completing the two factor step
- Type
vpn disconnect
to disconnect from the vpn - This is sometimes necessary if the VPN has disconnected automatically
- Type
vpn status
to check if the vpn is currently connected
- type
-v
as the second command argument to enable verbose output (e.g.vpn connect -v
) - notice: This will output your vpn authentication information.
- Disconnects unexpectedly due to 'inactivity'
- The VPN will not connect (but will also not throw an obvious error due to output suppression) if another vpn client is open
- Verbose flag only support
-v
but not alternate forms (i.e.--verbose
,-verbose
)