dnsforward: add use_client_addr_from_ecs for ECS-based client identification - #8571
Open
elkrammer wants to merge 3 commits into
Open
dnsforward: add use_client_addr_from_ecs for ECS-based client identification#8571elkrammer wants to merge 3 commits into
elkrammer wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2514.
Adds a new option to identify clients by the EDNS Client Subnet (ECS) data injected into incoming requests by a forwarder, instead of the connection address. Without this, all queries appear to come from the forwarder's address and per-client filtering, query logs, and statistics lose client identity.
dnsmasq supports this via
add-subnet=32,128(RFC 7871); other forwarders with ECS support also benefit.The existing
edns_cs_use_customoption sends a custom IP out to upstream resolvers for CDN routing. This new option is the inverse: it reads the client address in from incoming ECS options for client identification.What changed
Backend - new config flag
use_client_addr_from_ecs(defaultfalse):ecsClientAddrextracts the client IP from the ECS option in incoming requests, withecsSubnetAddrhandling IPv4/IPv6 family detectiondnsContext.clientAddr()returns the ECS address when valid, falling back to the connection addressdctx.clientAddr()Frontend - new checkbox in Settings -> DNS -> EDNS Client Subnet:
Testing
go test ./internal/dnsforward/,go test ./internal/home/passgo vet,gofumpt,gocyclo --over 10cleanadd-subnet=32,128forwarding to AGH - query log shows real client IPs (eg.192.168.0.163/32) instead of the forwarder's address