Skip to main content

vpnx

Status
CI checks CI
Latest version PyPI
Release date Release date
Python Python
License License
Open issues Open issues

A terminal UI for managing OpenVPN connections with 2FA support.

README

Features

  • Interactive setup wizard for configuring multiple VPNs
  • Full-screen TUI with real-time connection status and bandwidth monitoring
  • Secure credential storage using GPG encryption
  • Support for up scripts (DNS/routing configuration)
  • XDG Base Directory compliant configuration

Requirements

  • Python 3.8+
  • openvpn
  • gpg (for encrypted password storage)
# macOS
brew install openvpn gnupg

# Debian/Ubuntu
sudo apt install openvpn gnupg

# Fedora
sudo dnf install openvpn gnupg2

# Arch
sudo pacman -S openvpn gnupg

Installation

Using pipx (recommended):

pipx install vpnx

Or with pip:

pip install vpnx

Setup

vpnx setup

The setup wizard will guide you through:

  1. Adding VPN configurations (name, path to .ovpn file, up/down scripts)
  2. Setting your username (optional - will prompt at connection if not set)
  3. Configuring the password store (GPG key for secure credential storage)

Usage

# Connect to all configured VPNs
vpnx all

# Connect to a specific VPN
vpnx connect <vpn-name>

# List configured VPNs
vpnx list

# Manually run a VPN's configured down script (e.g. to reset DNS / routes
# left behind by a stale tunnel). Does not stop OpenVPN.
vpnx down <vpn-name>
vpnx down <vpn-name> --dev utun3   # override the tunnel interface (default: utun0)

Configuration

Configuration is stored in XDG-compliant directories:

~/.config/vpnx/
├── config.yaml        # Main configuration
└── up.sh              # Optional default up script

~/.local/share/vpnx/
├── credentials.gpg    # GPG-encrypted password
└── credentials.gpg-id # GPG key ID

~/.cache/vpnx/
└── logs/              # Connection logs

config.yaml format

username: your-username                            # optional, will prompt if not set
credentials_path: ~/.local/share/vpnx/credentials  # path to GPG-encrypted password
up_script: /path/to/up.sh                          # optional, global up script
down_script: /path/to/down.sh                      # optional, global down script

vpns:
  - name: PROD
    display: Production VPN
    config_path: /path/to/prod.ovpn
    needs_up_script: true
    up_script: /path/to/prod-up.sh      # optional, per-VPN override
    needs_down_script: true
    down_script: /path/to/prod-down.sh  # optional, per-VPN override
    needs_2fa: true                     # default: true
  - name: DEV
    display: Development VPN
    config_path: /path/to/dev.ovpn
    needs_up_script: false
    needs_down_script: false
    needs_2fa: false

Build from source

git clone https://github.com/pirhoo/vpnx.git
cd vpnx
pip install -e ".[dev]"

Then use make targets to run the project and development tasks:

make setup          # Configure VPN client
make all            # Connect to all configured VPNs
make connect VPN=x  # Connect to a specific VPN
make list           # List configured VPNs

make test           # Run tests
make lint           # Check code style
make format         # Auto-format code
make clean          # Remove cache files
make build          # Build sdist and wheel into dist/

Project Structure

├── vpnx/
│   ├── domain/          # Business logic (entities, services)
│   ├── application/     # Use cases (commands, handlers)
│   ├── infrastructure/  # External integrations (OpenVPN, GPG)
│   └── presentation/    # UI components (TUI, CLI)
└── tests/               # Unit tests

Release files for vpnx 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vpnx 0.5.1
File Size Uploaded
vpnx-0.5.1.tar.gz 49.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vpnx 0.5.1
File Interpreter ABI Platform
vpnx-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 92.0 kB

Release files / vpnx-0.5.1.tar.gz

Download URL vpnx-0.5.1.tar.gz
Size 49.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5b482841d374790f777b0a776140c508606d1e67cfd34758e7d19ae479a531b3
BLAKE2b-256 checksum
How to use checksums
e5117a98063722a71f6ef0fe26dab552a0afb4d610afaa2e48eb7bb4bffa7cf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / vpnx-0.5.1-py3-none-any.whl

Download URL vpnx-0.5.1-py3-none-any.whl
Size 42.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
931ec2d87caa638dd2f49ec056b2f37d53e516604d2699bde5a139e160300b21
BLAKE2b-256 checksum
How to use checksums
7b2dc2f99e3545d8c6f317c889e1a151ddd962fb4a97db6bc8b7b06a883c0e13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page