netproxy
A local proxy server library in pure Python where rules decide, per
destination, whether to connect with a client certificate and which one.
Client certificates can live in the Windows certificate store, on a smart card
or in an HSM (via sslcontext), so
tools that cannot do mutual TLS reach mTLS-only services through it.
Documentation: https://jose-pr.github.io/netproxy/.
Features
- Rule routing — glob and regex host rules, ports, networks and paths pick a route per connection: tunnel directly, originate TLS with a credential, chain through an upstream proxy, or reject.
- mTLS from any keystore — a route's credential is an
ssl.SSLContextyou build, or a keystore query resolved bysslcontext. - Three ways in — an HTTP proxy (CONNECT and plain HTTP, upgraded to HTTPS when a rule says so), local tunnel ports, and optional TLS interception with a name-constrained local CA.
- Recording — every session as a capture Wireshark follows (plaintext
for the TLS the proxy owns), a TLS key log, or your own
Recorder. - Upstream proxies — chain through a corporate proxy chosen by
proxylib(PAC, environment, system settings).
Installation
pip install netproxy
| Extra | Adds | Needed for |
|---|---|---|
cli |
duho |
the netproxy command |
yaml |
anycfg[yaml] (PyYAML) |
configuration files written in YAML (#!yaml, .yaml) |
capture |
pktcap |
PcapRecorder: sessions written as a pcap/pcapng capture |
Quick start
A configuration file routes *.corp.example through a client certificate
from the Windows store; everything else goes direct:
[server]
listen = "127.0.0.1:3128"
[credentials.work]
backend = "cng"
query = { subject = "alice" }
[[rules]]
match = "*.corp.example"
action = "tls"
credential = "work"
netproxy run -c netproxy.cfg
curl -x http://127.0.0.1:3128 http://api.corp.example/ # sent as HTTPS with alice's certificate
The same from Python:
import asyncio
from netproxy import AsyncProxyServer, Credential, Route, Router
work = Credential(backend="cng", query={"subject": "alice"})
router = Router([("*.corp.example", Route.with_tls(work))])
async def main():
async with AsyncProxyServer(router, listen="127.0.0.1:3128") as server:
await server.serve_forever()
asyncio.run(main())
Command line
netproxy run -c netproxy.cfg # serve
netproxy check -c netproxy.cfg https://api.corp.example/ # which rule and route, no connection
netproxy pac -c netproxy.cfg # PAC script for browsers
netproxy ca init -c netproxy.cfg # local CA for intercepting https:// clients
API overview
| Module | Purpose |
|---|---|
netproxy |
the server, routes, rules and credentials |
netproxy.rules |
matchers: host globs, regex, ports, networks, paths |
netproxy.upstream |
reaching destinations directly or through upstream proxies |
netproxy.intercept |
TLS interception with a name-constrained local CA |
netproxy.recording |
recorders: a hook per session, a log, pcap files |
netproxy.pac |
PAC scripts generated from the rules |
netproxy.config |
configuration files (netproxy.cfg: TOML, or the format a #! first line names) |
netproxy.exceptions |
the package's errors |
Development
dotagents pyvenv && dotagents pyvenv 3.9
.pyvenv/<tag>/Scripts/python -m pip install -e ../sslcontext -e ".[dev]"
.pyvenv/<tag>/Scripts/python -m pytest -q -rs
Releasing
This project follows Semantic Versioning and keeps a
CHANGELOG.md.
Pushing a tag matching v* triggers the release workflow: test gate → build
(checking the tag names the version built) → a strict docs build as a gate →
GitHub release → publish. The release workflow never deploys the docs site
itself: for a final release its last job dispatches the docs workflow at the
tag, which owns every Pages deploy.
License
MIT — see LICENSE.
Metadata
Release files for netproxy 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| netproxy-0.3.0.tar.gz | 69.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| netproxy-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 126.4 kB
Release files / netproxy-0.3.0.tar.gz
| Download URL | netproxy-0.3.0.tar.gz |
|---|---|
| Size | 69.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88648d20d06b04860f6784c57d7b6cdd10eb8f25d3f57e0503aeaf562808eabe
|
|
BLAKE2b-256 checksum How to use checksums |
d0fc7bea7c08623a34a93849bb40e07ecea7bb75885963e6be7d3ea14d329938
|
| 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 Oct 19, 2026.
Transparency logRelease files / netproxy-0.3.0-py3-none-any.whl
| Download URL | netproxy-0.3.0-py3-none-any.whl |
|---|---|
| Size | 56.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12bc1608e3178e3a8c594eccdfda6a52a41ad36f245b5cc1abc50903173ebdbc
|
|
BLAKE2b-256 checksum How to use checksums |
b2f4069296605daf0a07756696488abf55496138e6498144950048d7db2bac96
|
| 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 Oct 19, 2026.
Transparency logSecurity for netproxy 0.3.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for netproxy-0.3.0.tar.gz
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 Oct 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.