Skip to main content

FoxyVPN

A standalone Python client and local SOCKS5 proxy for the Mozilla VPN / Firefox VPN proxy service, distributed as a standard PyPI package.

This is an independent Python rewrite of firefox-vpn-client (originally written in Go). It reimplements the same Firefox Accounts authentication, Mozilla VPN "Guardian" control plane, Fastly anti-bot challenge solver, and local SOCKS5-over-HTTP/2 proxy, packaged as an installable pip package with a console entry point and an automated release workflow.

Disclaimer: This is an unofficial, community client. It is not affiliated with or endorsed by Mozilla. Use it only with an account and subscription you are authorized to use, and in accordance with Mozilla VPN's terms of service.

Features

  • Firefox Accounts login (email + password, with email 2FA code verification, falling back to a confirmation-link prompt if FxA requires it) or reuse of pre-provisioned session tokens, with automatic rotation across a pool of tokens.
  • Cached OAuth tokens (~/.foxyvpn-tokens.json, written with 0600 permissions) with automatic refresh.
  • Automatic solving of Fastly's client-side anti-bot "Client Challenge" (proof-of-work, Private Access Token probing, and client-metrics beacons), including on Hawk-signed FxA requests, where the request signature is rebuilt fresh on every retry.
  • Mozilla VPN "Guardian" proxy-pass issuance, renewal, quota monitoring, and account entitlement lookups, including clock-skew-tolerant JWT expiry parsing.
  • VPN server list discovery via Firefox Remote Settings, with country/city selection (defaulting to Firefox's own recommended "REC" server when no country is given) and a persisted proxy-state file across restarts.
  • A local SOCKS5 (RFC 1928, CONNECT-only) proxy that tunnels traffic to the upstream Mozilla VPN proxy node over HTTP/2, with connection pooling, client-IP affinity across multiple upstream connections, idle timeouts, and a maximum-connections limit.
  • Non-fatal exit-IP/country verification after connecting.
  • Optional JSON status file describing the current proxy-pass health, for supervisord/systemd-style monitoring.
  • Structured logging (text or JSON) to stderr.

Installation

pip install foxyvpn

Or, from a source checkout:

pip install .

HTTP/3 (QUIC) upstream support is optional:

pip install "foxyvpn[http3]"

Usage

# First run: interactive Firefox Accounts login, auto-selects a proxy server.
foxyvpn --country us

# Force a fresh login instead of reusing cached tokens.
foxyvpn --login --country us

# Use a specific upstream proxy instead of country-based selection.
foxyvpn --proxy us1.example.com:443

# Authenticate with a pre-provisioned session token (or a file with one
# token per line for automatic rotation on quota exhaustion).
foxyvpn --session-token /path/to/tokens.txt --country de

# Print account entitlement info and exit.
foxyvpn --print-info

# Print the available server list and exit.
foxyvpn --list-servers

Once running, point any SOCKS5-aware client at the local listener (default 127.0.0.1:1080):

curl --socks5-hostname 127.0.0.1:1080 https://example.com

CLI flags

Flag Default Description
--api-proxy (none) Proxy URL used only for FxA/Guardian/Remote-Settings control-plane calls.
--guardian https://vpn.mozilla.org Guardian (Mozilla VPN control plane) endpoint.
--listen 127.0.0.1:1080 Local SOCKS5 listen address (host:port, or [ipv6]:port).
--login off Force a fresh interactive login, ignoring cached tokens.
--email (prompted) Firefox Accounts email.
--session-token (none) Session token or path to a token-pool file.
--print-info off Print entitlement info and exit.
--list-servers off Print the server list and exit.
--proxy (none) Exact upstream host:port (mutually exclusive with --country).
--country (none) Two-letter country code for proxy selection. Defaults to the recommended REC server (auto-selected by Firefox) when omitted.
--timeout 20 Default request timeout (seconds) for FxA/Guardian/Remote-Settings control-plane calls.
--handshake-timeout 10 Upstream TLS/HTTP2 handshake timeout (seconds).
--idle-timeout 0 (disabled) Idle connection timeout (seconds).
--max-conns 256 Max concurrent SOCKS5 client connections; 0 disables the limit.
--upstream-conns 1 Number of pooled upstream sessions (client-IP affinity when >1).
--status-file (none) Path to a JSON proxy-pass health status file.
--proxy-state-file (none) Path to persist the selected upstream proxy.
--verify-exit / --no-verify-exit on Verify the exit country after connecting.
--exit-check-url https://www.cloudflare.com/cdn-cgi/trace URL used for exit verification.
--exit-check-timeout 10 Timeout for the exit-check request (seconds).
--verbose off Shorthand for --log-level debug.
--log-level info debug, info, warn, or error.
--log-format text text or json.
--version Print version information and exit.

Development

There is no automated test suite: the login, 2FA, quota-exhaustion, and challenge-solving flows all require a real Firefox Account and live Mozilla VPN entitlement, which can't run unattended in CI. Local changes are verified by building and inspecting the package instead:

pip install -e ".[dev]"
python -m build
python -m twine check dist/*

License

MIT

Download files

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

Source Distribution

foxyvpn-1.0.0.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

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

foxyvpn-1.0.0-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file foxyvpn-1.0.0.tar.gz.

File metadata

  • Download URL: foxyvpn-1.0.0.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for foxyvpn-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7dbea5217eb90fe3fd14aec5712bdc7bb7558887668c30aa11e374180851bcaf
MD5 74cecf8dc3f774a940eacfe5c21b0a3a
BLAKE2b-256 184def4735de5566862283d7636f8ac8e59e4a49376987267166d025e98bbdb3

See more details on using hashes here.

File details

Details for the file foxyvpn-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: foxyvpn-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 44.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for foxyvpn-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82a72d04713488697fab1a85a2d5215b628e76bd74e0734690d2cd3093733e45
MD5 cea044cc4b34263451bbb05f5c7c9f93
BLAKE2b-256 1e32964a8422936789b606d0827dacd82f21590991c155e477dabb349314ea9a

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.2

2 files

1.0.1

2 files

This release

1.0.0 This release

2 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