76 Commits
Author SHA1 Message Date
tchivert 827e9fd8b9 update registry
docker / docker (push) Successful in 2m15s
2026-10-24 00:20:08 +02:00
tchivert 42d73bf190 fix: allow to configure both ipv4 and ipv6 for a given host
docker / docker (push) Successful in 2m37s
package / apt (push) Successful in 58s
v1.7
2026-10-19 16:01:01 +02:00
tchivert 2cc8bc6b1b update readme
docker / docker (push) Successful in 2m10s
2026-10-11 22:38:00 +00:00
tchivert 24443e302b fix: set explicit permissions when building deb packages
docker / docker (push) Successful in 2m11s
package / apt (push) Successful in 58s
dpkg-deb rejects a control directory with mode 777, which is what
mkdir -p produces on runners running with umask 000. Normalize the
package tree after copying (directories 0755, files 0644, binary
0755) and build with dpkg-deb --root-owner-group so the archives
record root:root ownership instead of the runner's uid.
v1.6
2026-10-11 22:57:18 +02:00
tchivert cb6403471d fix: docker actions versions
docker / docker (push) Successful in 2m37s
package / apt (push) Failing after 46s
2026-10-11 21:29:01 +02:00
tchivert 6cb247da60 fix: update ci image registry
docker / docker (push) Failing after 51s
2026-10-11 21:23:49 +02:00
marvin 59f7ec83ad Merge pull request 'fix EDNS COOKIE (RFC 7873/9018) handling: terminate cookies at the resolver' (#2) from fix/edns-cookie-handling into main
docker / docker (push) Failing after 1s
2026-10-11 19:20:44 +00:00
tchivert 2a3e20d8d7 close remaining RFC 7873/6891 spec gaps from review
test / test (pull_request) Successful in 10s
Malformed COOKIE options (RFC 7873 section 5.2.2): option lengths other
than 8 and 16-40 are now answered with FORMERR and never get a COOKIE
in the response; getQueryCookie classifies absent/valid/malformed.

Server-cookie learning probes (RFC 7873 section 5.4): question-less
queries carrying a COOKIE option are answered NOERROR with a freshly
minted server cookie, or BADCOOKIE when re-establishing an invalid
server cookie. miekg's ServeMux refuses question-less queries, so the
servers now use handleQuery directly as their handler, and
msgAcceptFunc lets QDCOUNT=0 QUERY requests through.

EDNS/OPT handling (RFC 6891): the upstream OPT record is no longer
cached or forwarded (sections 6.1.1 and 6.2.1) — it is removed before
caching and rebuilt per query. Responses to EDNS queries always carry
an OPT record advertising the responder's payload size and echoing
the query's DO bit (sections 6.1.1 and 6.2.4); responses to non-EDNS
queries never carry one (section 7). applyCookie is now applyEDNS.

Tests: malformed-COOKIE FORMERR for lengths 4/12/41 and normal
answers for 8/16/40, cookie probe (NOERROR/BADCOOKIE) at the handler
level and through a real miekg server over UDP (independent raw-socket
verification included), msgAcceptFunc unit test, OPT-never-cached and
OPT-rebuild assertions, non-EDNS responses carry no OPT.

README documents the new EDNS and COOKIE behaviors.
2026-10-11 19:22:04 +02:00
tchivert 8628de05d0 harden response handling and packaging; make cookies fully RFC 9018-compliant
test / test (pull_request) Successful in 35s
Response handling:
- Clear the DNSSEC AD bit in all responses (RFC 6840 section 5.8): rdns
  forwards but does not validate, so it must not relay the upstream AD bit
- Truncate UDP responses exceeding the client's advertised payload size
  (RFC 6891 section 6.2.5): set TC and let clients retry over TCP; the
  COOKIE option survives truncation. Server UDP buffer raised to 4096
- Decrement TTLs of cached responses by the time spent in the cache
  (positive and negative answers); -t remains the cache lifetime source
  of truth. OPT pseudo-records are left untouched
- Reject upstream responses whose question section does not match the
  query, then try the next nameserver (anti-spoofing)
- Echo the current query's question section on cache hits and forwarded
  responses (0x20 case), and stop mutating the client's message when
  adding EDNS for the upstream exchange
- Advertise 1232 bytes to upstream when the client sends no EDNS, and
  gate DoT connection error logging behind -l

Cookies:
- Make server cookies fully RFC 9018-compliant, pinned against the RFC
  Appendix A test vectors: version 1, second-granularity timestamps,
  little-endian hash sub-field, RFC 1982 serial-number skew checks,
  reserved sub-field hashed as received on validation
- Strip COOKIE options before caching instead of on every cache hit
- Count server cookies presented by clients in the
  rdns_cookie_checks_total metric (valid/invalid/absent), wiring
  validateServerCookie into the serving path
- Response OPT advertises the responder's payload size (RFC 6891)

Packaging and CI:
- package.yml: fix the deb Description/Homepage copy-paste errors,
  install the binary to /usr/local/bin (matching the systemd unit),
  register /etc/rdns conffiles, ship the systemd unit and the
  logrotate/rsyslog configs, add Installed-Size
- New test.yml workflow running go vet and go test -race on pull
  requests; image/release pushes stay tied to main/tags
- Stop tracking the generated conf/blocklist.txt (gitignore it,
  generate with utils/blocklist_update)
- README: fix the project description, document cookie handling, the
  AD-bit and truncation behavior, TTL decrementing, and utils/

Tests:
- Mock-upstream integration tests: end-to-end cookie rewrite and AD
  clearing, question-mismatch rejection, TCP retry on truncation, TC
  truncation per client buffer, TTL decrement on cache serve, question
  case echo, cache entry stored without COOKIE
- Unit tests: all 64 SipHash-2-4 reference vectors, RFC 9018 Appendix A
  cookie vectors, cookie validation metric

Upstream ports are overridable (upstreamDNSPort/upstreamDoTPort) so
tests can point the resolver at a mock nameserver.
2026-10-11 17:51:24 +02:00
tchivert a567a01c9f fix EDNS COOKIE (RFC 7873/9018) handling: terminate cookies at the resolver
Cached responses were served verbatim, replaying the COOKIE option of the
original upstream exchange to clients with a different client cookie, which
made dig report 'Client COOKIE mismatch' on repeat queries. Upstream server
cookies were also relayed downstream.

- Synthesize server cookies ourselves (RFC 9018: SipHash-2-4 over client
  cookie, version, timestamp and client IP, keyed with a rotating server
  secret, 1h rotation with previous-secret retention and timestamp skew
  tolerance)
- Echo the current query's client cookie unchanged in every response
- Strip/rebuild the COOKIE option on cache hits, including negative
  (NXDOMAIN) responses, and never relay the upstream server cookie
- Respond without a COOKIE option when the query has none
- Keep cached entries pristine (store a copy) so per-client rewriting never
  mutates a cached message
- Add unit and integration regression tests
2026-10-11 17:10:00 +02:00
tchivert 9365d08fcf ci: run go vet and tests before builds
docker / docker (push) Successful in 12m7s
package / apt (push) Successful in 1m18s
v1.5
2026-08-21 22:36:49 +02:00
tchivert 0d8ea0927f fix cache races, cross-class cache poisoning, TCP retry on truncation, blocklist_update separators; add singleflight, graceful shutdown, hardening and tests 2026-08-21 22:34:25 +02:00
tchivert 7db7269b88 catthehacker/ubuntu:act-latest moved
docker / docker (push) Successful in 4m30s
package / apt (push) Successful in 1m27s
v1.4
2026-02-11 01:03:34 +01:00
tchivert d244ca5716 update to go1.26
package / apt (push) Successful in 1m28s
docker / docker (push) Failing after 0s
2026-02-11 01:00:21 +01:00
tchivert 43016ab9a6 various performance improvements and bug fixes
docker / docker (push) Successful in 2m49s
2025-11-16 22:35:37 +01:00
tchivert f99f705a56 add logrotate
docker / docker (push) Successful in 5m11s
2025-08-16 02:40:06 +02:00
tchivert 3352dd27a4 reorder files
docker / docker (push) Successful in 4m58s
2025-08-13 23:06:53 +02:00
tchivert ede703728f update systemd service
docker / docker (push) Successful in 4m58s
2025-08-13 23:00:15 +02:00
tchivert af2abfbbb5 add comments in hosts/zones & fix first blocklist entry
docker / docker (push) Successful in 5m8s
package / apt (push) Successful in 2m27s
v1.3
2025-08-13 22:51:40 +02:00
Tom Chivert 4245c4b3cc fix large msg size
docker / docker (push) Successful in 4m59s
package / apt (push) Successful in 2m13s
v1.2
2025-08-06 01:51:55 +02:00
Tom Chivert 70242f3bc5 Add rdns.service
docker / docker (push) Successful in 5m8s
2025-08-05 13:01:16 +02:00
tchivert 3384ce43dc remove release.yml
docker / docker (push) Successful in 4m34s
2025-07-20 11:41:35 +02:00
tchivert bbda1f4a1e fix path
docker / docker (push) Successful in 2m32s
package / apt (push) Successful in 1m16s
v1.1
2025-07-20 11:37:21 +02:00
tchivert c6b0ca5d59 add git release pipeline
package / apt (push) Failing after 7s
docker / docker (push) Successful in 2m32s
2025-07-20 11:34:41 +02:00
tchivert 03ef8c7a72 remove makefile
docker / docker (push) Successful in 2m29s
package / apt (push) Failing after 9s
2025-07-20 11:31:58 +02:00
tchivert 86049b7b33 deb package - first commit
docker / docker (push) Has been cancelled
2025-07-20 11:30:32 +02:00
Tom Chivert eef058127c Update README.md
build / build (push) Successful in 5m59s
2025-07-16 01:16:41 +02:00
tchivert c33fa0c089 fix blocklist
build / build (push) Successful in 2m31s
2025-07-12 01:05:34 +02:00
tchivert 778ba57571 debug print
build / build (push) Successful in 2m33s
2025-07-12 00:59:47 +02:00
tchivert f9995359de fix custom zones
build / build (push) Successful in 2m29s
2025-07-12 00:56:08 +02:00
tchivert da43b25cf1 add hosts doc
build / build (push) Successful in 2m53s
2025-07-12 00:08:16 +02:00
tchivert c4eb798fa3 switched from env vars to command
build / build (push) Failing after 4m51s
2025-07-11 23:53:11 +02:00
tom.chivert b16c4f29cd custom hosts feature - first commit 2025-07-10 19:01:43 +02:00
tchivert 47d59c1c8a update blocklist script
build / build (push) Successful in 3m19s
2025-03-31 01:41:09 +02:00
tchivert eff126cd6f notls condition
build / build (push) Successful in 2m46s
v1.0
2024-12-28 15:08:51 +01:00
tchivert dea8a2aecd various fixes and updates
build / build (push) Successful in 2m41s
2024-12-28 15:03:51 +01:00
tchivert 53dce7797f Removed needless step
build / build (push) Successful in 2m11s
2024-12-16 23:56:16 +01:00
tchivert 8991c43758 Updated modules and build steps
build / build (push) Has been cancelled
2024-12-16 23:54:15 +01:00
Tom Chivert f81fc66376 Update blocklist_update
build / build (push) Failing after 1m4s
2024-02-03 14:12:57 +01:00
tchivert 2a0694a45d update blocklist
build / build (push) Successful in 4m49s
2023-11-04 13:22:13 +01:00
tchivert bfe6e149e6 improve blocklist
build / build (push) Successful in 5m37s
2023-08-28 15:00:46 +02:00
tchivert cf06d152e1 update blocklist
build / build (push) Successful in 3m31s
2023-07-15 23:14:26 +02:00
tchivert bc35e55768 change ci system 2023-07-15 23:11:37 +02:00
tchivert bbaa0a23ea name task
continuous-integration/drone Build is failing
2023-07-15 15:46:30 +02:00
tchivert c58fac9feb add ci release
continuous-integration/drone Build is passing
2023-07-15 15:42:27 +02:00
razian e079bbdc6d Update README.md 2023-06-30 16:08:23 +02:00
tchivert 50fcc8894d add readme and license 2023-06-30 15:40:33 +02:00
tchivert 0923ae48cd Update blocklist and update script
continuous-integration/drone/push Build is passing
2023-05-30 14:30:50 +02:00
tchivert 2c712076f6 Remove a print
continuous-integration/drone/push Build is passing
2023-03-24 15:15:14 +01:00
tchivert 1cbd92013a Update cached items count more often
continuous-integration/drone/push Build is passing
2023-03-01 17:30:57 +01:00