Commit fa57720
committed
feat: transparent DNS interception via in-namespace server
This PR implements transparent DNS interception in Linux strong jails by
running a dedicated DNS server inside the network namespace. This prevents
DNS exfiltration and provides comprehensive DNS query control.
Key Features:
- ForkedDnsProcess manages a child process running DummyDnsServer
- All DNS queries (UDP port 53) redirected via nftables DNAT
- Returns fixed dummy response (6.6.6.6) for all A record queries
- Privilege dropping after binding to port 53 (nobody:nogroup)
- PR_SET_PDEATHSIG ensures DNS server terminates with parent
- Fork safety: closes all inherited file descriptors to avoid tokio issues
- IPv6 support: DNS DNAT to ::1, blocks other IPv6 egress
Breaking Changes:
- Bumped version to 0.5.0 (removed max_tx_bytes feature)
- Removed benches and related dev-deps (criterion/pprof)
Security Improvements:
- Prevents DNS exfiltration via subdomain encoding
- Blocks all external DNS servers (1.1.1.1, 8.8.8.8, etc.)
- Prevents DNS-over-HTTPS/TLS attempts at network level
Technical Details:
- Uses simple-dns crate for DNS packet handling
- Portable close_range syscall fallback for multi-arch support
- Command execution with proper timeout handling
- Updated nftables rules for DNS and IPv6 traffic
Documentation:
- Comprehensive README updates with architecture diagrams
- Detailed DNS exfiltration protection section
- Platform support matrix
- Technical implementation details1 parent 574ca02 commit fa57720
19 files changed
Lines changed: 1629 additions & 1411 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
135 | 180 | | |
136 | 181 | | |
137 | 182 | | |
| |||
0 commit comments