Repository navigation
v0.1.8
WireGuard tunnels can now run on the kernel backend instead of in-process crypto,
socket-to-socket relays are zero-copy, blocking outranks routing, and the Linux
artifact dropped from 171 MB to 20 MB.
Upgrading — one action needed for kernel-mode tunnels
Nothing breaks if you skip this: WireGuard egresses fall back to the userspace backend
(boringtun, exactly as before). The startup log always states which backend was picked
and why — journalctl -u ferrite | grep -i wireguard, or the Logs page in the panel.
systemd / OpenRC (installer): re-run install.sh. It is idempotent and rewrites the
service unit with AmbientCapabilities=CAP_NET_ADMIN, plus loads the wireguard module
and persists it via /etc/modules-load.d.
An in-app update (
POST /api/update/serveror the Updates page) replaces only the
binary — the service unit is left untouched, so tunnels stay on userspace until the
installer is re-run.
Docker: add --cap-add=NET_ADMIN and recreate the container. Capabilities are
fixed when a container is created, so docker pull and docker restart can never add
them:
docker rm -f ferrite
docker run -d --name ferrite --cap-add=NET_ADMIN --cap-add=NET_BIND_SERVICE \
-p 53:53/tcp -p 53:53/udp -p 80:80/tcp \
-v ferrite-data:/var/lib/ferrite \
ghcr.io/syntlyx/ferrite-server:latestCompose: add cap_add: [NET_ADMIN], then docker compose up -d (recreates).
- The
wireguardmodule must be present on the host kernel — a container cannot
modprobe. /dev/net/tunis not needed: this is a netlink-managed netdev, not a TUN device.- With
--network hostthe wg netdev and its fwmark rules are created in the host
network namespace; in bridge mode they stay inside the container's own namespace. The
main routing table is never touched either way.
Breaking changes
Blocking now outranks routing. Previously a routed domain was never blocked. The
block check now runs before the intercept, and the listener re-checks the peeked
SNI/Host, so a blocklisted domain stays blocked even when a routing rule covers it —
routing a service through a tunnel no longer unblocks its tracker subdomains. To
deliberately reach a blocklisted domain, whitelist it; it then routes as usual.
debug_logging defaults to off. A log record per query and per connection was real
CPU that nobody read. Re-enable it in Settings or config.toml; an explicit RUST_LOG
still overrides the setting.
WireGuard: kernel backend (Linux)
A real wireguard netdev managed over netlink, with fwmark policy routing — the main
routing table is never modified. The kernel does the crypto (multicore, GSO/GRO) and
autotunes TCP windows, so tunnel throughput scales with the hardware instead of being
capped by single-core userspace crypto and a static per-connection window.
- Requires Linux,
CAP_NET_ADMIN, and thewireguardmodule. Probed once at startup. - Per-egress
backend = "auto" | "kernel" | "userspace", defaultauto(kernel when
available, else userspace). A pinned"kernel"fails loudly instead of silently
degrading — if you asked for line-rate, you should know when you're not getting it. - The API reports the backend actually carrying each egress.
buffer_kb/tx_buffer_kbapply to the userspace backend only; the kernel autotunes.
The egress was split into a backend façade with a shared DNS resolver, so both backends
answer in-tunnel DNS identically.
Zero-copy relay (Linux)
Proxied bytes used to be copied twice (kernel → userspace buffer → kernel) with two
syscalls per chunk. With kernel-mode crypto that copying became the dominant per-byte
cost of a tunneled transfer. Connections where both ends are real sockets — kernel-WG,
direct, evasion — now relay through splice(2), passing page references instead of
payload. No privileges required.
The userspace WireGuard backend hands out an in-memory stream rather than a socket, so it
(and every non-Linux build) keeps the generic relay. Behaviour is unchanged either way:
one-way EOF half-closes that direction, connections idle in both directions are reaped,
and per-egress counters update live.
DNS
New [dns] client_ttl (default 60s) — a ceiling on the TTL handed to client devices.
ferrite is the cache; devices are meant to be thin. A device that cached an answer for an
hour kept using it after a blocklist, whitelist, routing-rule or per-device-profile
change — live here, invisible there. The cap bounds that lag, and matches the routing
rules' own synthetic TTL, so the whole product makes one promise: a change takes effect
within a minute.
- It only ever lowers a TTL. An upstream answer that says 5 seconds passes through
unchanged — raising it would break short-TTL failover the origin asked for. - Blocked answers now carry an SOA with this TTL, so negative caching is bounded too.
0tells devices not to cache at all: maximum immediacy, at a larger query log.
TTL bounds can now be 0. min_ttl = 0 honours the origin's lifetime instead of
extending it, and max_ttl = 0 means no ceiling of ferrite's own (the hard 3600s maximum
still applies). Previously {0, 0} made every cache entry expire immediately on insert.
Fixes
- fwmark policy routing: two WireGuard egresses from the same provider often carry
identical tunnel addresses, which collapsed them into a single routing table — every
routed connection left through one tunnel regardless of the rule that matched. Each
egress now gets its ownSO_MARKand table, keyed by mark rather than source address.
Build
- New
distprofile (symbol stripping + thin LTO) and a single crypto stack in the
binary instead of two: the Linux release artifact went from 171 MB to 20 MB. - Minimum toolchain is now Rust 1.97.
See docs/DEPLOYMENT.md for the capability and backend details, and the throughput notes
for what to expect on a low-power box.
Full Changelog: v0.1.7...v0.1.8