Skip to main content

OpenConnect wrapper with Azure AD (SAML) SSO support for Cisco SSL-VPNs

Project description

openconnect-saml

OpenConnect wrapper supporting Azure AD / SAML authentication for Cisco AnyConnect SSL-VPNs.

Modernized fork based on vlaci/openconnect-sso with improvements from kowyo/openconnect-lite.

Features

  • SAML / Azure AD authentication via embedded Qt WebEngine browser
  • Automatic form-filling for username, password, and TOTP
  • Password stored in system keyring (with in-memory fallback)
  • TOTP secret configurable directly in config file
  • Profile auto-detection from AnyConnect XML profiles
  • Proxy support (SOCKS/HTTP)
  • Client certificate handling (auto-fallback on cert-request)
  • --no-sudo mode for use with --script-tun
  • --csd-wrapper passthrough for CSD/hostscan support
  • --reset-credentials to clear saved keyring entries
  • Microsoft Authenticator number matching support
  • Office365 "Stay signed in?" auto-dismiss
  • Robust XML parsing (recovers from malformed responses)

Requirements

  • Python ≥ 3.10
  • OpenConnect installed and in PATH
  • Qt6 WebEngine (provided by PyQt6)

Installation

# Recommended: install as isolated tool
uv tool install openconnect-saml

# Or via pip
pip install openconnect-saml

Usage

# Connect to a VPN server
openconnect-saml --server vpn.example.com

# With a specific user group
openconnect-saml --server vpn.example.com/usergroup

# Use AnyConnect profile
openconnect-saml --profile /opt/cisco/anyconnect/profile

# Authentication only (output cookie)
openconnect-saml --server vpn.example.com --authenticate

# Without sudo (for --script-tun)
openconnect-saml --server vpn.example.com --no-sudo -- --script-tun

# With CSD hostscan wrapper
openconnect-saml --server vpn.example.com --csd-wrapper /path/to/csd-wrapper.sh

# Reset saved credentials
openconnect-saml --user user@example.com --reset-credentials

Configuration

Config file: $HOME/.config/openconnect-saml/config.toml

[default_profile]
address = "vpn.example.com"
user_group = ""
name = "My VPN"

[credentials]
username = "user@example.com"

# Optional: run a command on disconnect
on_disconnect = ""

Auto-fill rules

Custom auto-fill rules can be defined per URL pattern:

[auto_fill_rules]
"https://*" = [
    { selector = "input[type=email]", fill = "username" },
    { selector = "input[name=passwd]", fill = "password" },
    { selector = "input[id=idTxtBx_SAOTCC_OTC]", fill = "totp" },
]

Office365 "Stay signed in?" page

The default rules now auto-dismiss the "Stay signed in?" prompt. If you use custom auto_fill_rules, add these entries:

[[auto_fill_rules."https://*"]]
selector = "input[id=KmsiCheckboxField]"
action = "click"

[[auto_fill_rules."https://*"]]
selector = "input[id=idSIButton9]"
action = "click"

TOTP / Password

Credentials are stored in the system keyring. On first use, you'll be prompted for your password and optional TOTP secret.

If keyring is unavailable (e.g., headless server), passwords are kept in memory for the session.

To clear stored credentials:

openconnect-saml --user user@example.com --reset-credentials

Credits

Based on vlaci/openconnect-sso by László Vaskó, with improvements from kowyo/openconnect-lite.

License

GPL-3.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openconnect_saml-0.1.0.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openconnect_saml-0.1.0-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file openconnect_saml-0.1.0.tar.gz.

File metadata

  • Download URL: openconnect_saml-0.1.0.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openconnect_saml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2b415191d9f585f31f857deaec0d77d150aeb19a879ad55eee4ac22aa5000b59
MD5 10c165cabda23d037870ac0b41517f91
BLAKE2b-256 51280665ef8a39ba3c6be38be5c9b0cc73ceee1d34f59b0625018f91da1bd5d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for openconnect_saml-0.1.0.tar.gz:

Publisher: publish.yml on mschabhuettl/openconnect-saml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openconnect_saml-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openconnect_saml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4368fc09db81d6bd2a7893d90dcd2d30ce6ae4d1b116e70a201c01f58fcf717
MD5 d2f9edb578edb855218d0a8a27194c43
BLAKE2b-256 c197454074f492272a024da42b1cfbb54404484f2335361bfde7a6641aa7cfbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for openconnect_saml-0.1.0-py3-none-any.whl:

Publisher: publish.yml on mschabhuettl/openconnect-saml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page