Metadata-Version: 2.4
Name: openconnect-lite
Version: 0.8.7
Summary: OpenConnect supporting Two-factor authentication (2FA) to Cisco SSL-VPNs
Project-URL: Homepage, https://github.com/kowyo/openconnect-lite
Project-URL: Documentation, https://github.com/kowyo/openconnect-lite#readme
Project-URL: Repository, https://github.com/kowyo/openconnect-lite.git
Author-email: Kowyo <kowyo@outlook.com>, László Vaskó <laszlo.vasko@outlook.com>
Maintainer-email: Kowyo <kowyo@outlook.com>
License-Expression: GPL-3.0-only
License-File: LICENSE
Requires-Python: >=3.14
Requires-Dist: attrs>=25.3.0
Requires-Dist: colorama>=0.4.6
Requires-Dist: keyring>=25.6.0
Requires-Dist: lxml>=6.0.2
Requires-Dist: prompt-toolkit>=3.0.52
Requires-Dist: pyotp>=2.9.0
Requires-Dist: pyqt6-webengine>=6.9.0
Requires-Dist: pyqt6>=6.9.1
Requires-Dist: pysocks>=1.7.1
Requires-Dist: pyxdg>=0.28
Requires-Dist: requests>=2.32.5
Requires-Dist: setuptools>=80.9.0
Requires-Dist: structlog>=25.4.0
Requires-Dist: toml>=0.10.2
Description-Content-Type: text/markdown

# openconnect-lite

> [!NOTE]
> This project is a fork of [vlaci/openconnect-sso](https://github.com/vlaci/openconnect-sso) and is under development. Please report issues or start discussions in [kowyo/openconnect-lite](https://github.com/kowyo/openconnect-lite). Contributions are welcome.

Wrapper script for OpenConnect supporting Azure AD (SAMLv2) authentication
to Cisco SSL-VPNs

## Supported Platforms

- [x] Linux
- [x] macOS
- [x] Windows

## Installation

1. Install `openconnect` on your system

```shell
sudo apt install openconnect # Debian
brew install openconnect # macOS
scoop install main/openconnect # Windows
# For other platforms, see https://www.infradead.org/openconnect/download.html
```

2. Install `openconnect-lite`

We use [uv](https://docs.astral.sh/uv/) to install this project. If you don't have `uv` installed, you can install it by running:

```shell
curl -LsSf https://astral.sh/uv/install.sh | sh
```

Then, we can run following command to install `openconnect-lite`

```shell
uv tool install openconnect-lite
```

## Usage

```shell
openconnect-lite --server <vpn_server_addr> --user <your_username>
```

## Configuration

You can customize the behavior of `openconnect-lite` by creating a configuration file at `$HOME/.config/openconnect-lite/config.toml` on Unix 
and `%LOCALAPPDATA%\.config\openconnect-lite\config.toml` on Windows

```yaml
on_disconnect = ""

[default_profile]
server = "<VPN_SERVER_ADDRESS>"
user_group = ""
name = ""

[credentials]
username = "<YOUR_USERNAME>"

[auto_fill_rules]
[[auto_fill_rules."https://*"]]
selector = "div[id=passwordError]"
action = "stop"

[[auto_fill_rules."https://*"]]
selector = "input[type=email]"
fill = "username"

[[auto_fill_rules."https://*"]]
selector = "input[name=Password]"
fill = "password"

[[auto_fill_rules."https://*"]]
selector = "input[data-report-event=Signin_Submit]"
action = "click"

[[auto_fill_rules."https://*"]]
selector = "#submitButton"
action = "click"

[[auto_fill_rules."https://*"]]
selector = "div[data-value=PhoneAppOTP]"
action = "click"

[[auto_fill_rules."https://*"]]
selector = "a[id=signInAnotherWay]"
action = "click"

[[auto_fill_rules."https://*"]]
selector = "input[name=otc]"
fill = "totp"
```

### Adding custom `openconnect` arguments

Sometimes you need to add custom `openconnect` arguments. One situation can be if you get similar error messages:

```shell
Failed to read from SSL socket: The transmitted packet is too large (EMSGSIZE).
Failed to recv DPD request (-5)
```

or:

```shell
Detected MTU of 1370 bytes (was 1406)
```

Generally, you can add `openconnect` arguments after the `--` separator. This is called _"positional arguments"_. The
solution of the previous errors is setting `--base-mtu` e.g.:

```shell
openconnect-lite --server vpn.server.com/group --user user@domain.com -- --base-mtu=1370
```

## Development

This project uses [uv](https://docs.astral.sh/uv/) for dependency management. To set up the development environment:

```shell
# Clone and set up the project
git clone https://github.com/kowyo/openconnect-lite
cd openconnect-lite

# Create the virtual environment and install all dependency groups
make dev
uv run openconnect-lite --help
```
