Created
October 24, 2024 19:05
-
-
Save lordjabez/02d5a1cc2ea3fc0cadea4016a36d4f2f to your computer and use it in GitHub Desktop.
Use openconnect to log into a Cisco-compatible VPN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# Prerequisites: | |
# brew install openconnect xmlstarlet | |
# pip install keyring | |
# curl https://raw.githubusercontent.com/sailfishos-mirror/openconnect/refs/heads/master/trojans/csd-post.sh | |
# keyring set HOSTNAME USERNAME | |
# Usage: | |
# connect-to-vpn HOSTNAME USERGROUP USERNAME | |
vpn_hostname="$1" | |
vpn_usergroup="$2" | |
vpn_username="$3" | |
vpn_password="$(keyring get $vpn_hostname $vpn_username)" | |
echo "$vpn_password" | \ | |
sudo openconnect --verbose --protocol="anyconnect" \ | |
--csd-wrapper="csd-post.sh" \ | |
--server="$vpn_hostname" \ | |
--authgroup="$vpn_usergroup" \ | |
--user="$vpn_username" \ | |
--passwd-on-stdin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment