Repository navigation
Add minimal DNS proxy with DoT/DoH in- and outbound - #1
Merged
Merged
Conversation
Plain DNS (UDP/TCP), DNS over TLS and DNS over HTTPS (HTTP/1.1 + HTTP/2) inbound; DoT and DoH upstreams outbound with ordered failover. - Mandatory per-listener CIDR allowlist (no open resolver by default) - Upstreams addressed via configured bootstrap IPs only; hostnames are used for SNI/certificate verification, never resolved - rustls (ring), webpki-roots or custom CA file - Small bounds-checked DNS wire parser; responses validated against the query (question + ID), random IDs for DoT, ID 0 for DoH - UDP responses capped at EDNS size (max 1232), TC fallback - Connection, in-flight, handshake, idle and body limits - Hardened systemd unit (DynamicUser, CAP_NET_BIND_SERVICE only, LoadCredential for certificates, syscall filter) - Unit tests and end-to-end tests with fake upstreams and a test CA Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hHaUEqQpj7pg7F9XAM8Ce
Clients with dynamic public IPs can now be admitted via `allow_hosts`. Names are resolved in the background through the encrypted upstreams (never via the system resolver, never per packet); the packet path only reads the last known addresses. - A/AAAA lookups with TTL-driven refresh, clamped by [host_acl] - Rejected clients trigger an early, rate-limited refresh - Fail closed until the first lookup; NXDOMAIN/NODATA clears at once; on lookup failures the last addresses stay valid for max_stale - IPv4 matches /32, IPv6 /64 by default (per-host v4_prefix/v6_prefix, bounded to avoid accidental wide ranges) - Startup warning for allow_hosts on plain udp/tcp listeners - Minimal A/AAAA answer parsing in dns.rs, bounds-checked and fuzzed - Constant-time DoH path comparison so the path can carry a secret - README: threat model for DynDNS admission and the secret-path option Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hHaUEqQpj7pg7F9XAM8Ce
Release (on tags vX.Y.Z): - Static musl binaries for x86_64 and aarch64 via cargo-zigbuild - Refuses to run when the tag and Cargo.toml version disagree - SHA256SUMS and GitHub build provenance attestations - Pre-release for tags with a suffix; actions pinned to commit SHAs Pages: - Single-page documentation in docs/, deployed from main via GitHub Actions (requires Pages source "GitHub Actions") - Styled with the Nullthrone design system: tokens vendored unchanged from Claude Design, components recreated in plain CSS, no JavaScript, light and dark via the OS preference README: install from releases with verification, release process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hHaUEqQpj7pg7F9XAM8Ce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A small DNS forwarder in Rust, with no extra features.
Security design
allowCIDR list and/orallow_hosts. An empty config is an error, so the proxy never becomes an open resolver by accident.addrs. Their hostnames are only used for SNI and certificate checks.webpki-rootsor a configuredca_file.allow_hosts.DynamicUser; its only capability isCAP_NET_BIND_SERVICE;LoadCredential;ProtectSystem=strictand a syscall filter.Dynamic client IPs
allow_hosts:max_stale).allow_hostsis used on plain udp/tcp listeners.Release and docs
.github/workflows/release.yml, runs when a tagvX.Y.Zis pushed):x86_64andaarch64withcargo-zigbuild;Cargo.tomlversion disagree;SHA256SUMSand GitHub build provenance (gh attestation verify);docs/,.github/workflows/pages.yml): a one-page documentation site in the Nullthrone design system.Structure
Test plan
cargo fmt --check,cargo clippy --all-targets -- -D warningscargo test: 24 unit tests and 18 end-to-end tests, repeated runs without failuresdns-proxy --checkpasses onconfig.example.tomlactionlintfinds no issues in all workflowscargo-zigbuild(x86_64 and aarch64 ELF, statically linked). Ran the packaging andsha256sum -csteps locally.gh releasesteps only run there.main.SystemCallFilter=~@resourcesfirst.🤖 Generated with Claude Code
https://claude.ai/code/session_011hHaUEqQpj7pg7F9XAM8Ce