No description
  • Rust 96.4%
  • Dockerfile 3.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-04 00:02:49 +05:30
.github chore: Add ARM build 2026-10-04 00:02:49 +05:30
src feat: DNS-over-TLS 2026-10-03 23:44:33 +05:30
.dockerignore chore: basic setup 2026-10-03 23:43:51 +05:30
.gitignore chore: basic setup 2026-10-03 23:43:51 +05:30
Cargo.lock feat: dns scaffold 2026-10-03 23:44:12 +05:30
Cargo.toml feat: dns scaffold 2026-10-03 23:44:12 +05:30
Dockerfile chore: basic setup 2026-10-03 23:43:51 +05:30
README.md chore: README 2026-10-03 23:44:43 +05:30

dnsshield

A small encrypted DNS forwarding server. It speaks DNS-over-TLS (DoT) and DNS-over-QUIC (DoQ) on port 853 and forwards queries to a plain-DNS resolver like 1.1.1.1. Anything the upstream can't answer gets a SERVFAIL instead of a timeout.

Building

Needs Rust, cmake, and a C compiler (the QUIC and TLS libraries build C code).

cargo build --release

Running

./target/release/dnsshield \
    --cert fullchain.pem \
    --key privkey.pem \
    --upstream 9.9.9.9:53 \
    --listen 0.0.0.0:853 --listen '[::]:853'

Options:

  • --listen ADDR — addresses to bind, repeatable. Defaults to 0.0.0.0:853 and [::]:853. TCP is DoT, UDP is DoQ.
  • --upstream IP:PORT — plain-DNS resolver to forward to. Default 1.1.1.1:53, must be an IP literal.
  • --cert FILE / --key FILE — TLS certificate and key in PEM format, required.
  • --idle-timeout-secs N — QUIC idle timeout for DoQ, default 30.

Docker

docker build -t dnsshield .

docker run -d --name dnsshield \
    -p 853:853/tcp -p 853:853/udp \
    -v /etc/letsencrypt/live/dns.example.com:/certs:ro \
    dnsshield \
    --cert /certs/fullchain.pem --key /certs/privkey.pem

The container runs as an unprivileged user with just cap_net_bind_service added so it can bind 853. Make sure the cert files it mounts are readable by that user. On rootless Docker the capability gets dropped, so listen on a high port instead: -p 853:8853/tcp -p 853:8853/udp plus --listen 0.0.0.0:8853.