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.1.tar.gz (40.4 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.1-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openconnect_saml-0.1.1.tar.gz
  • Upload date:
  • Size: 40.4 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.1.tar.gz
Algorithm Hash digest
SHA256 ec0cf9d3cba3b73274f837cc52f1a2cb7a7d18f9155189d66a74ccabe651f3ca
MD5 071cbcadc72ebc3b6183c2079e3d17ef
BLAKE2b-256 3aa64a2d63e234c8a0a6228b6d077034714b87be5da3f10115ae3272556ccdc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for openconnect_saml-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for openconnect_saml-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d69b9e1f8331df05da8f67eb7a8167a9d122c19aea4f115abfbbf94f8aa6db04
MD5 1a0cee14d28b048391bbab5b4520f567
BLAKE2b-256 d7c6408845002bd6a92712f1a54d5f7417716948cc1f8fb01d1719c8bed38bb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for openconnect_saml-0.1.1-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