always-on-openconnect-vpn/README.md

34 lines
1.1 KiB
Markdown
Raw Normal View History

2020-12-17 18:22:15 +00:00
# Always on Openconnect VPN
This script uses Openconnect to automatically connect to Cisco Anyconnect VPN server.
Server address, username, password and 2fa seed is stored in macOS keychain. Feel free to remove them and ask for user input instead.
2020-12-17 23:05:16 +00:00
Additionaly routing for only specific subnets can be added in `routes.txt`
2020-12-17 18:22:15 +00:00
## Setup
```
git clone this repo
brew install openconnect
2020-12-17 23:05:16 +00:00
brew install vpn-slice
brew install oath-toolkit
2020-12-17 18:22:15 +00:00
```
Add server address, username, password and 2fa seed in keychain with these names:
* `Openconnect VPN Server`
* `Openconnect Username`
* `Openconnect Account Password`
* `Openconnect TOTP Seed`
_For ease of use you can allow automatic keychain access to some of the attributs, but_ **do not allow automatic access to password and especially the 2fa seed**. _It will keep it in memory as long as the script is running._
2020-12-17 23:05:16 +00:00
Rename routes.txt.sample to routes.txt or create an empty routes.txt and add subnets to be routed through VPN there.
2020-12-17 18:22:15 +00:00
## Usage
```
sudo -E ./run-vpn.sh
2020-12-17 18:22:15 +00:00
```
In case of disconnect, it will try reconnecting after 3 seconds. You can stop it by pressing `CTRL+C` or killing the script.