proc-trace-dns
Three ways to get a binary — pick the one that fits your setup.
No local Go install required. Produces static binaries for amd64 and arm64 in one command via build.sh.
One line with a local Go install. Output is dynamically linked — fine for dev use on the same machine.
Fully static, no libc dependency. Copy the binary to any Linux system of the same architecture and it just works.
proc-trace-dns intercepts DNS at the system level. eBPF mode requires kernel 4.4+ with BPF support; raw socket mode works on any kernel 2.6+.
| Requirement | Details | Status |
|---|---|---|
| Linux kernel 4.4+ | Required for eBPF mode (CONFIG_BPF=y, default on Ubuntu 16.04+, Fedora 23+, RHEL 8+). Raw socket fallback works on older kernels. |
✓ universal |
| CAP_NET_RAW | Required to observe DNS packets. Run as root or grant capability to the binary with setcap. |
✓ root / setcap |
| Go 1.22+ | Only needed for from-source build methods. The Docker build uses golang:1.22-alpine internally. |
✓ optional |
| Docker | Only needed for the build.sh Docker method. Any recent Docker Engine with buildx support works. |
✓ optional |
build.sh
Clones the repo, runs the build inside a golang:1.22-alpine container, and drops two static binaries
into ./dist/ — no local Go toolchain needed.
build.sh executable and run it./dist//usr/local/bin/.# Clone ❯ git clone https://github.com/binRick/proc-trace-dns.git ❯ cd proc-trace-dns # Build ❯ chmod +x build.sh ❯ ./build.sh Building proc-trace-dns v0.1.0 ... → linux/amd64 → linux/arm64 Done. Binaries in ./dist/: proc-trace-dns-linux-amd64 (5.1 MB) proc-trace-dns-linux-arm64 (4.8 MB) # Install ❯ sudo cp dist/proc-trace-dns-linux-amd64 /usr/local/bin/proc-trace-dns ❯ proc-trace-dns --version proc-trace-dns v0.1.0
If you already have Go installed, this is the fastest path. The resulting binary is dynamically linked but works fine for development and local use.
❯ git clone https://github.com/binRick/proc-trace-dns.git ❯ cd proc-trace-dns ❯ go build -o proc-trace-dns . ❯ sudo ./proc-trace-dns (watching all DNS queries system-wide...)
Disabling CGO and stripping debug symbols produces a self-contained binary you can copy anywhere: another machine, a container, a server with no Go install.
❯ CGO_ENABLED=0 go build -ldflags="-s -w" -o proc-trace-dns . # Confirm: no dynamic libraries ❯ file proc-trace-dns proc-trace-dns: ELF 64-bit LSB executable, x86-64, statically linked, stripped # Copy to any amd64 Linux box ❯ scp proc-trace-dns user@server:/usr/local/bin/
CAP_NET_RAW with setcapInstead of running as root every time, you can grant only the capability the tool actually needs.
# Grant the capability (one-time, as root) ❯ sudo setcap cap_net_raw+eip /usr/local/bin/proc-trace-dns # Verify ❯ getcap /usr/local/bin/proc-trace-dns /usr/local/bin/proc-trace-dns cap_net_raw=eip # Now run as a normal user ❯ proc-trace-dns -n curl
A quick sanity-check before deploying.
# Print version ❯ proc-trace-dns --version proc-trace-dns v0.1.0 # Print help ❯ proc-trace-dns -h # Trace one curl call end-to-end ❯ sudo proc-trace-dns -n curl -- curl -s https://example.com > /dev/null 12345 curl A example.com → 93.184.216.34 1.2ms