Explicit Response Name Rewrite in CoreDNS

65 Views Asked by At

I need to set up a rewrite or other mechanism to make the ANSWER section contain some-service.dev.company.com instead of traefik.ingresscontrollers.svc.cluster.local to which some clients are sensitive (DNS resolvers treat mismatches between the QUESTION SECTION and ANSWER SECTION as a man-in-the-middle attack (MITM)). In other words *.dev.company.com on the IP of the existing service traefik.ingresscontrollers.svc.cluster.local.

Current status

dev.company.com:53 {
errors
log
ready
health
rewrite name regex (.*)\.dev\.company\.com traefik-proxy.ingresscontrollers.svc.cluster.local
kubernetes cluster.local in-addr.arpa ip6.arpa {
  pods insecure
  fallthrough in-addr.arpa ip6.arpa
}
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
root@ubuntu:/# dig @10.0.0.10 some-service.dev.company.com

; <<>> DiG 9.18.18-0ubuntu0.22.04.1-Ubuntu <<>> @10.0.0.10 some-service.dev.company.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62257
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: f3047375f9a141ff (echoed)
;; QUESTION SECTION:
;some-service.dev.company.com. IN   A

;; ANSWER SECTION:
traefik.ingresscontrollers.svc.cluster.local. 5 IN A 10.0.64.215

;; Query time: 0 msec
;; SERVER: 10.0.0.10#53(10.0.0.10) (UDP)
;; WHEN: Wed Jan 10 15:57:44 UTC 2024
;; MSG SIZE  rcvd: 133

I tried to experiment with the https://github.com/coredns/coredns/tree/master/plugin/rewrite#explicit-response-name-rewrite, but unfortunately unsuccessfully.

Expected state In AKS, ingress is at traefik.ingresscontrollers.svc.cluster.local. (10.0.64.215). And I need the client to return the following response to the DNS query *.dev.company.com

root@ubuntu:/# dig @10.0.0.10 some-service.dev.company.com

; <<>> DiG 9.18.18-0ubuntu0.22.04.1-Ubuntu <<>> @10.0.0.10 some-service.dev.company.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62257
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: f3047375f9a141ff (echoed)
;; QUESTION SECTION:
;some-service.dev.company.com. IN   A

;; ANSWER SECTION:
some-service.dev.company.com. 5 IN A 10.0.64.215

;; Query time: 0 msec
;; SERVER: 10.0.0.10#53(10.0.0.10) (UDP)
;; WHEN: Wed Jan 10 15:57:44 UTC 2024
;; MSG SIZE  rcvd: 133

I'm trapped and I don't know how to move on. I would be grateful for any help.

0

There are 0 best solutions below