By using AnyConnect CLI, it is easy to connect VPN. This tool need to use AnyConnect provided by cisco.
brew is a easy way to install AnyConnect CLI.
brew tap TomoyukiSugiyama/homebrew-tap
brew install tomoyukisugiyama/tap/any-connect
https://github.com/TomoyukiSugiyama/any-connect/releases
$ git clone git@github.com:TomoyukiSugiyama/any-connect.git
$ cd any-connect
$ go build
$ sudo ln -fs /path-your-current-dir/.cisco_vpn/any-connect /usr/local/bin/any-connect
Note Please install AnyConnect.
For general use, the any-connect config
command is the fastest way to set up your AnyConnect cli.
Configuration file is stored in ~/.cisco_vpn/credentials
.
$ any-connect connect
✔ YOUR_VPN_HOST
Group: YOUR_VPN_GROUP
User: USER_NAME
Password: **********
After configuration, you can use any-connect connect / disconnect
command.
# connect vpn
# after execute connect commnad, 2FA is required
$ any-connect connect
# disconnect vpm
$ any-connect disconnect
# check state
$ any-connect state
Note If you want to use other command, please see help.
# ~/.zshrc
source <(any-connect completion zsh)
compdef _any-connect any-connect