Wrapper script for OpenConnect supporting Azure AD (SAMLv2) authentication to Cisco SSL-VPNs
Project description
openconnect-sso-mtls
A wrapper for OpenConnect that handles SAMLv2/SSO authentication to Cisco SSL-VPNs. Automates the browser-based login flow and passes the resulting session token to openconnect. Includes automatic client certificate (mTLS) selection from the system keystore.
Fork of vlaci/openconnect-sso.
Requirements
- Linux or macOS
openconnectinstalled and on$PATH- Python 3.12+
Installation
pipx install git+https://github.com/jmesterh/openconnect-sso-mtls
Usage
If Cisco AnyConnect or Secure Client is installed, existing VPN profiles are detected automatically. In most cases, just run:
openconnect-sso
The server address and credentials are saved between sessions, so subsequent runs require no arguments.
To connect to a specific server for the first time:
openconnect-sso --server vpn.server.com/group --user user@domain.com
Passing arguments to openconnect
Additional openconnect arguments can be appended after --:
openconnect-sso -- --base-mtu=1370
Client certificates (mTLS)
When the VPN server requests a client certificate during the SSO flow, the tool selects the first matching certificate from the system keystore automatically. No configuration is required.
Authentication groups
Use --list-authgroups to discover what groups your VPN server exposes:
$ openconnect-sso --list-authgroups
CardinalKey
CardinalKey-Full
Then connect directly to a group:
openconnect-sso --authgroup "CardinalKey-Full"
Authenticate only (no tunnel)
Output session credentials without starting the tunnel — useful for scripting:
openconnect-sso --authenticate shell
openconnect-sso --authenticate json
Configuration
Configuration is stored at $XDG_CONFIG_HOME/openconnect-sso/config.toml (typically ~/.config/openconnect-sso/config.toml).
TOTP / push-based MFA
For environments where the SSO page requires a TOTP code, adjust config.toml to fill and submit it:
[[auto_fill_rules."https://*"]]
selector = "input[data-report-event=Signin_Submit]"
action = "click"
[[auto_fill_rules."https://*"]]
selector = "input[type=tel]"
fill = "totp"
CLI reference
openconnect-sso [OPTIONS] [-- OPENCONNECT_ARGS]
Server connection:
-s, --server SERVER VPN server address (host, host/group, or full URL)
-p, --profile PROFILE_PATH Load profiles from file or directory
-P, --profile-selector Always display profile selector
--proxy PROXY Use a proxy server
Authentication:
--authgroup AUTHGROUP Set authentication group, skipping the interactive selector
--list-authgroups Query available authentication groups and exit
-g, --usergroup USERGROUP Override usergroup from --server
--authenticate [FORMAT] Authenticate only; output credentials as shell or json
Credentials:
-u, --user USER Authenticate as the given user
Options:
--browser-display-mode shown (default) or hidden
--full-tunnel Strip split-tunnel routes, force full tunnel
--on-disconnect CMD Command to run on disconnect
--ac-version VERSION AnyConnect version string (default: 4.7.00136)
-l, --log-level LEVEL ERROR, WARNING, INFO, or DEBUG
-V, --version Print version and exit
Development
uv run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openconnect_sso_mtls-1.0.0.tar.gz.
File metadata
- Download URL: openconnect_sso_mtls-1.0.0.tar.gz
- Upload date:
- Size: 101.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92a7c01f15ba572674c7dcb2410190af40f71571f300dedaf30ebd0b71e20b88
|
|
| MD5 |
febf2146d5c430c1a951da8f45ae6b58
|
|
| BLAKE2b-256 |
edbab4de12849a18377f197e396e75104dfe6a04ef032278cf415204864ae584
|
Provenance
The following attestation bundles were made for openconnect_sso_mtls-1.0.0.tar.gz:
Publisher:
release.yml on jmesterh/openconnect-sso-mtls
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openconnect_sso_mtls-1.0.0.tar.gz -
Subject digest:
92a7c01f15ba572674c7dcb2410190af40f71571f300dedaf30ebd0b71e20b88 - Sigstore transparency entry: 1059470535
- Sigstore integration time:
-
Permalink:
jmesterh/openconnect-sso-mtls@852e9280af22fbb16ee186174dc91b041ab88029 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jmesterh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@852e9280af22fbb16ee186174dc91b041ab88029 -
Trigger Event:
push
-
Statement type:
File details
Details for the file openconnect_sso_mtls-1.0.0-py3-none-any.whl.
File metadata
- Download URL: openconnect_sso_mtls-1.0.0-py3-none-any.whl
- Upload date:
- Size: 38.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16b28be3c515befd3af2f62bba54a301beee9a9d1dd8d1b44570446a40869190
|
|
| MD5 |
865d0483366aececb3f22ca19e8f2f19
|
|
| BLAKE2b-256 |
ccc5a9f387e296e4e46a1693ed992ddf2f9eca0922553458884391933b4515ef
|
Provenance
The following attestation bundles were made for openconnect_sso_mtls-1.0.0-py3-none-any.whl:
Publisher:
release.yml on jmesterh/openconnect-sso-mtls
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openconnect_sso_mtls-1.0.0-py3-none-any.whl -
Subject digest:
16b28be3c515befd3af2f62bba54a301beee9a9d1dd8d1b44570446a40869190 - Sigstore transparency entry: 1059470536
- Sigstore integration time:
-
Permalink:
jmesterh/openconnect-sso-mtls@852e9280af22fbb16ee186174dc91b041ab88029 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jmesterh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@852e9280af22fbb16ee186174dc91b041ab88029 -
Trigger Event:
push
-
Statement type: