Files
rdns-go/.gitea/workflows/test.yml
T
tchivert 8628de05d0
test / test (pull_request) Successful in 35s
harden response handling and packaging; make cookies fully RFC 9018-compliant
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

22 lines
338 B
YAML

name: test
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '>=1.26'
- name: Run tests
run: |
go vet ./...
go test -race ./...