apt over the Nym mixnet: Debian and Ubuntu package downloads where the mirror sees a Nym exit, not you.
By apeir (https://apeir.dk/online/).
aptmix is an apt transport method, like apt-transport-tor but for Nym. Write a source as
nym+https://deb.debian.org/debian (or nym+http://) and apt fetches everything for it, the Release files,
the package lists and the .deb files, through the Nym mixnet:
apt-get ─ stdin/stdout ─> /usr/lib/apt/methods/nym+https (aptmix)
│ several mixnet tunnels at once, each a fresh ephemeral Nym client
▼
Sphinx packets ─> entry gateway ─> 3 mix layers ─> exit gateway (IP Packet Router)
│ TCP, TLS end to end
▼
deb.debian.org
- The mirror sees requests from Nym exit gateways, never your IP.
- The local network sees Sphinx packets to a Nym entry gateway, not that you run apt or which mirror you use.
- DNS for the mirror is resolved through the mixnet (DNS-over-HTTPS through the tunnel); your resolver never
sees
deb.debian.org. - No clearnet fallback, ever. If no mixnet path works, the download fails and apt says so.
One binary (Rust), MIT. The mixnet part is nymdial (in-process
TCP/TLS through Nym IP Packet Router exits, with exit failover and DNS over the mixnet), which sits on Nym's own
nym-sdk and nym-smolmix. There is no nym-socks5-client to run and no local proxy port.
Status, 2026-11-08: works end to end with apt on Debian 13 against deb.debian.org. 5 of 5 live runs of
apt-get updateplus a 54 MB download (a 51 MiB package and four small ones) succeeded; see "Speed". Speed depends on the mixnet's loss at the time: 40-90 KiB/s in a quiet hour, and in a lossy hour about 1 KiB/s on the stock nym-sdk 1.21.6, whose IP Packet Router tunnels stop receiving for good after one lost reply frame (upstream bug; cause and fix measured in nymdial's README). Thepatches/build-gapfix.shbuild carries that one-function fix (a 40-line patch to one file of nym-sdk) and kept going at about 8x the stock rate in the same lossy hour. See "Speed".
On a Debian or Ubuntu machine, as a normal user. aptmix user-setup makes a private apt tree (lists, cache,
methods, sources) in a directory you choose, with your system's sources rewritten to nym+http(s)://. Nothing
outside that directory changes, and nothing is installed:
git clone https://github.com/apeirs/aptmix && cd aptmix
cargo build --release # or: sh patches/build-gapfix.sh (nym-sdk + the gap-skip fix, see "Speed")
./target/release/aptmix user-setup ~/aptmix-try
APT_CONFIG=~/aptmix-try/apt.conf apt-get update
cd /tmp && APT_CONFIG=~/aptmix-try/apt.conf apt-get download helloRust 1.85+; the first build compiles nym-sdk (a few minutes). patches/build-gapfix.sh copies nym-sdk 1.21.6
from cargo's registry, applies patches/nym-sdk-1.21.6-gap-skip.diff and builds against it through cargo's
[patch] table on the command line; Cargo.toml and Cargo.lock are left as they are.
apt-get download checks the .deb against the hash in the signed package list, as always. To see what happens
on the way, add -o Acquire::nym::Log=/tmp/aptmix.jsonl (one JSON line per file: exits, timings, resumes) or run
with APTMIX_LOG=aptmix=info,nymdial=info.
To fetch a single file the same way without apt: aptmix get https://deb.debian.org/debian/dists/trixie/Release.
sudo install -m 755 target/release/aptmix /usr/lib/apt/methods/nym+https
sudo ln -sf nym+https /usr/lib/apt/methods/nym+httpThen put nym+ in front of the URIs you want to go through the mixnet. deb822 (/etc/apt/sources.list.d/debian.sources):
Types: deb
URIs: nym+https://deb.debian.org/debian
Suites: trixie trixie-updates
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
One-line format: deb nym+https://deb.debian.org/debian trixie main.
Or leave the sources alone and route every http:// and https:// source through aptmix:
// /etc/apt/apt.conf.d/50aptmix
Dir::Bin::Methods::http "/usr/lib/apt/methods/nym+http";
Dir::Bin::Methods::https "/usr/lib/apt/methods/nym+https";
apt starts methods as root; aptmix drops to apt's sandbox user (_apt, or APT::Sandbox::User) before it
touches the network, as apt's own methods do.
To undo: remove the nym+ prefixes (or the apt.conf.d file) and the two files in /usr/lib/apt/methods.
All optional, in apt.conf or as -o on the command line:
| Option | Default | |
|---|---|---|
Acquire::nym::Tunnels |
3 | mixnet tunnels per apt method process (apt runs one per host), each a separate Nym client and exit |
Acquire::nym::Streams |
4 | TCP connections per tunnel for the chunks of big files |
Acquire::nym::Chunk-KiB |
1024 | big files are fetched as ranged chunks of this size, spread over all streams; 0 = one stream per file |
Acquire::nym::Parallel |
= Tunnels | files in flight at once |
Acquire::nym::Idle-Timeout |
20 | seconds without a byte before a transfer counts as stalled |
Acquire::nym::Header-Timeout |
60 | seconds to wait for response headers |
Acquire::nym::Retries |
8 | failed attempts in a row without any progress before a file fails (plus one per extra tunnel) |
Acquire::nym::Countries |
any | only exits in these countries, e.g. "DE,NL,CH" |
Acquire::nym::Exits / Pinned-Only |
try these exit node ids first / only | |
Acquire::nym::Min-Performance |
0 | skip exits below this nym-api performance score |
Acquire::nym::Log |
off | append one JSON line per file to this path |
Acquire::nym::Debug |
false | log the mixnet path (exits, failovers) on stderr |
- apt's method protocol. apt starts
nym+httpsand talks to it over stdin/stdout (600 URI Acquire,201 URI Done, …). aptmix answers with the size,Last-Modifiedand all four hashes apt may check (MD5, SHA-1, SHA-256, SHA-512), honoursIf-Modified-Since(an unchanged list costs one small request),Maximum-Size, and resumes apt's partial downloads (Range+If-Range). Requests are pipelined; replies may complete in any order. - Tunnels. Each method process keeps
Tunnelsnymdial dialers, each an ephemeral Nym client with its own exit, all started at once on the first request. nymdial picks exits from the nym-api (performance-weighted random order), checks each new tunnel with a real DNS lookup through it, and moves to the next exit if one doesn't answer. - DNS through the mixnet. The mirror's name goes to nymdial unresolved; nymdial resolves it with DNS-over-HTTPS through the tunnel (Quad9, Mullvad, Cloudflare at pinned IPs). aptmix has no other resolver.
- TLS end to end for
nym+https://: rustls with the Mozilla roots, checked against the mirror's name. The exit relays ciphertext. - Chunks over tunnels. The first request for a file asks for its first 128 KiB, which tells aptmix the size.
A file bigger than that is then fetched as 1 MiB
Rangerequests over all streams of all tunnels at once (3 x 4 = 12 by default), written in place and hashed when complete. Over the mixnet one TCP connection gets only a few KiB/s (a 2-3 s round trip and frequent loss), so parallel connections are what make a big file possible at all. Every later request carriesIf-Rangewith the first answer's ETag, so a mirror that updates the file mid-download makes aptmix start over instead of mixing two versions. - Stalls. A tunnel that stops delivering gives no error, so every read has an idle timeout (20 s). When a
range stalls, its tunnel gets a health check (a DNS lookup through it) and is replaced by one on a new exit if
it fails; the rest of the range is fetched from where it stopped, on whichever connection is free first. A
file fails only after
Retriesattempts in a row brought no new byte. - Endgame. When every range has been handed out but connections are idle, the range in flight with the most bytes still to come is cut in two and an idle connection takes the second half (as BitTorrent clients do at the end of a download). Without it, the last chunks of a file sat on slow streams for minutes.
- No fallback. aptmix's downloader can only get connections from the tunnels; there is no code path to a
direct socket. If no tunnel can be built (nym-api unreachable, no exit works), the file fails at once with a
transient error and apt reports it.
Acquire::http::Proxyand friends are ignored.
What each party can see when you apt-get update && apt-get install foo through aptmix:
| Who | Sees | Doesn't see |
|---|---|---|
| The mirror (and its CDN) | a Nym exit gateway's IP; the files fetched, in 1 MiB ranges; the User-Agent Debian APT-HTTP/1.3; that requests come from the Nym network |
your IP |
| The exit gateway | the mirror's IP and port. With nym+https: the server name (SNI) and the size and timing of the encrypted transfer. With nym+http: the paths, so the package names |
your IP, your mixnet address (replies go through SURBs) |
| Your local network / ISP | Sphinx packets to Nym entry gateways; the nym-api directory fetch (a lookup of validator.nymtech.net and HTTPS to it); nym-sdk's own DNS-over-HTTPS/TLS lookups of gateway hostnames at Cloudflare and Quad9. All of it says "this machine uses Nym", nothing more |
that you run apt, which mirror, which packages |
| The entry gateway | your IP, how much you send and receive | where the packets go |
| The mix nodes | one hop each | sender and destination together |
What apt's signatures protect, on either scheme: apt checks the Release file's OpenPGP signature against the
keyring, every list against the hash in the Release file, and every .deb against the hash in the list. A
malicious exit or mirror can't change what you install. It can withhold files (the download fails) or serve an
old signed Release until its Valid-Until passes (Debian's Release files carry one; security suites expire in
days). So nym+http:// is safe for integrity (the live runs below used nym+https://); but use nym+https://
when you don't want the exit to see package names. Even with https, file sizes are visible to the exit and
packages can often be identified from them; a mixnet hides who you are, not what a single tunnel carries.
Linkability: one apt-get run uses a few tunnels, each with one exit for as long as it works. The mirror can
link the requests that came through one exit to each other (they are one apt run), not to you. Each new run, and
each failover, uses fresh Nym identities.
Not covered: apt-get itself, dpkg and maintainer scripts that fetch things over the network on install
(some do, e.g. firmware or font downloaders), apt-listchanges, unattended-upgrades with other methods, and
any https:// source you didn't prefix (unless you use the Dir::Bin::Methods override above).
Over the mixnet, one TCP connection through an IP Packet Router tunnel moves a few KiB/s: round trips are 2-3 s
and reply frames get lost or arrive seconds late. aptmix gets its speed from many connections at once (3 tunnels x
4 streams by default), resumes, and the endgame split. How far that goes depends on the mixnet's loss at the
time, and on the SDK. Two side-by-side measurements, the same file fetched by both builds at the same time
(aptmix get of trixie's main/binary-amd64/Packages.xz, 9.68 MB, 3 tunnels x 4 streams, 2026-11-08):
| When (UTC) | stock nym-sdk 1.21.6 | gap-skip build |
|---|---|---|
| 16:11-16:27, a lossy period (the gap-skip build skipped 448 lost reply frames) | 1.16 MB in 15 min (1.3 KiB/s, stopped by the timeout); 38 of 65 new tunnels passed the IPR handshake and then failed the health check | 9.56 MB in 14.7 min (about 11 KiB/s; before the endgame split existed, the last 120 kB hung in the tail); 2 of 15 new tunnels failed the check |
| 16:30-16:34, a quiet period (12 lost frames skipped) | 9.68 MB in 116 s (82 KiB/s), 34 requests, 2 resumes, 5 exits; no failed health checks | 9.68 MB in 221 s (43 KiB/s), 33 requests, 4 resumes, 7 exits; no failed health checks |
So: when the mixnet is quiet, the stock build is fine and the difference between the two is which exits you
drew. When it loses frames, every tunnel on the stock SDK dies at its first lost reply frame (and most new tunnels
die during their health check), and the gap-skip build is what keeps apt moving. Build with
patches/build-gapfix.sh if downloads crawl.
Five runs started 90 s apart on 2026-11-08 (16:27-16:34 UTC, so they overlapped), each in a fresh unprivileged
apt tree made by aptmix user-setup in a Debian 13 userland, gap-skip build, default settings (3 tunnels x 4
streams). Sources: nym+https://deb.debian.org/debian trixie main and nym+https://security.debian.org/debian-security trixie-security main, so apt ran two method processes at once. Each run: apt-get update --error-on=any
(InRelease x2, the 9.68 MB main Packages.xz, the 300 kB security list), then apt-get download hello jq libjq1 libonig5 openjdk-25-jre-headless (54.1 MB, openjdk is 53.6 MB = 51.1 MiB). apt checked every hash.
| run | update | download (54.1 MB) | openjdk 53.6 MB | requests | resumes | exits used |
|---|---|---|---|---|---|---|
| 1 | ok, 121 s | ok, 402 s | 131 KiB/s | 138 | 17 | 16 |
| 2 | ok, 101 s | ok, 910 s | 58 KiB/s | 193 | 75 | 28 |
| 3 | ok, 132 s | ok, 1501 s | 35 KiB/s | 224 | 107 | 26 |
| 4 | ok, 105 s | ok, 1953 s | 27 KiB/s | 287 | 159 | 32 |
| 5 | ok, 241 s | ok, 2148 s | 24 KiB/s | 292 | 161 | 31 |
5 of 5 runs succeeded, every .deb identical across runs (openjdk sha256 39e85474…094783d). Exits came from
10 to 18 countries per run (AU, AT, CA, CH, DE, FI, FR, IT, JP, NL, RO, SE, SG, US, …). Runs 2-5 slowed down as
the mixnet got lossier after 16:35 (500-600 lost reply frames skipped per run) and as five runs shared the time
window. The Packages.xz inside the updates came in at 87-113 KiB/s. Per-file logs: examples/runs/.
Also live: the root install path (as fake root in a user namespace), with a deb822 nym+https source
(apt-get update and apt-get install --download-only --reinstall libssl3t64, 2.46 MB in 53 s) and with plain
https:// sources routed through aptmix by Dir::Bin::Methods::https (examples/rootpath/).
There is no code path to a direct connection: the downloader gets every connection from a nymdial tunnel, and
tests/transport.rs checks that an unreachable mixnet fails a file at once, transiently, without a single
request reaching the server. Live, in a Debian 13 userland where deb.debian.org is reachable directly
(examples/failclosed/), three ways of breaking the mixnet path, each under strace (every connect() and DNS
packet of apt and its methods):
| Broken how | apt says | Time | Where anything went |
|---|---|---|---|
nym-api unreachable (Acquire::nym::Api pointed at a closed port) |
Err:1 nym+https://deb.debian.org/debian trixie InRelease no path through the Nym mixnet: nym-api directory: … error sending request |
7.1 s | only the closed local port |
| no network at all (empty network namespace) | the same, for the real nym-api | 7.1 s | only DNS attempts for validator.nymtech.net |
the mixnet works but no allowed exit exists (Exits "1"; Pinned-Only "true") |
no path through the Nym mixnet: no exit gateway matches: 1 is not an active IPR exit in the directory |
7.5 s | the nym-api (6 connects) and DNS for validator.nymtech.net; nothing else |
apt-get update exits 0 in all three cases, as it always does when index files fail (W: Some index files failed to download); use apt-get update --error-on=any in scripts. apt-get install and apt-get download fail.
And with a working mixnet: a full apt-get update (trixie-security over nym+https, 343 kB in 34 s) under
strace, every connect() classified by examples/netcheck.py against the nym-api's node list
(examples/strace-update.txt):
destination connects what
<nym-api>:443 10 nym-api (validator.nymtech.net)
<system resolver>:53 6 the system's DNS resolver (all 12 questions: validator.nymtech.net)
149.112.112.112:443 6 nym-sdk's own resolver (DoH/DoT, gateway hostnames)
1.1.1.1:853 4 nym-sdk's own resolver
1.0.0.1:853 / 9.9.9.9:443 2+2 nym-sdk's own resolver
3 Nym nodes:9000 2+2+2 the entry gateways of the three tunnels (nodes 3282, 3240, 534)
PASS: nothing reached the mirror outside the mixnet
No connection to deb.debian.org's addresses and no DNS question for it: its name was resolved and its TCP connections made inside the tunnels, which strace can't see because they are not sockets of this machine.
cargo test: 37 tests (15 unit, 22 end to end), all offline, no network. The end-to-end tests run the method
against an in-memory HTTP server behind a mock connector that can stall a transfer mid-body, cut a connection,
refuse to connect, return 403/503, redirect, send slowly, or change the file mid-download. They cover hashes and
sizes as apt checks them, apt's Last-Modified/mtime convention, IMS hits, resuming apt's partial file with
If-Range, a partial file that no longer matches, a complete partial file (416), 404 as final, an unreachable
mixnet failing at once without retries, the retry budget, server errors moving to another exit, redirects (and
refusing https to http), Maximum-Size, a 9 MiB file over three tunnels with stalls, several streams per tunnel,
the endgame split of a slow range, keep-alive and Connection: close servers, and malformed requests. Unit tests
cover the protocol parser, URL handling, the sources rewriter and user-setup.
- Slow compared to the clearnet, and unpredictably so. See "Speed": tens of KiB/s on a good hour, much less on a lossy one (use the gap-skip build). A full dist-upgrade through the mixnet takes a long time.
- The gap-skip build carries a patch to nym-sdk (
patches/), until Nym fixes the in-order reply buffer upstream. It only changes whenMixnetStreamgives up waiting for a missing frame. - IPv4 only (the tunnel is IPv4). deb.debian.org and the big mirrors have IPv4.
- Mirrors must allow ranges for chunking (all Debian and Ubuntu mirrors do); without, aptmix falls back to one stream per file, which a stall restarts from zero.
- The drop to
_aptis untested as real root. It follows apt's own methods (setgroups,setgid,setuid, then a check that root can't be regained), and the root install path was tested as fake root in a user namespace, where apt needsAPT::Sandbox::User "root"for its own methods too. - Per method process, not per machine. apt runs one method process per mirror host, each with its own tunnels.
- An upstream busy loop. When an IPR stream closes under a tunnel (seen in two of the five runs, after a
failover), nym-smolmix 1.21.6's bridge loop (
src/bridge.rs) getsstream closedback at once fromhandle_incoming()and loops on it, logging a warning each time: one CPU core and 8-9 GB of logs in about five minutes in those runs, which had nym-sdk warnings switched on. With aptmix's default log filter nothing is printed, but the loop still spins until the method process exits (apt starts a new one per run). The fix belongs in nym-smolmix (break out of the loop on a closed stream). - Built on nym-sdk 1.21.6 through nymdial; the nym crate family is pinned (see nymdial's README).
- Not audited.
MIT