cottand/leng

Only single custom record returned per host

Closed this issue · 1 comments

Ported from looterz/grimd#114

With the following custom records config:

customdnsrecords = [
    "test1.     3600      IN  A   10.8.0.1  ",
    "test1.     3600      IN  A   10.8.0.2  ",
]

I get the following dig output:

❯ dig test1

; <<>> DiG 9.10.6 <<>> test1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48412
;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;test1.				IN	A

;; ANSWER SECTION:
test1.			3600	IN	A	10.8.0.2

;; Query time: 107 msec
;; SERVER: 10.8.0.1#53(10.8.0.1)
;; WHEN: Wed Aug 09 23:56:53 WEST 2023
;; MSG SIZE  rcvd: 44

I would expect the answer section to have all of the A records I provided (so, both 10.8.0.1 and 10.8.0.2).
More critically, this also happens when using several DNS records of different types. For the following config:

customdnsrecords = [
    "test1.     3600      IN  A              10.8.0.1  ",
    "test1.     3600      IN  SRV 0 0  443   test1.    ",
]

I get:

❯ dig test1

; <<>> DiG 9.10.6 <<>> test1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51739
;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;test1.				IN	A

;; ANSWER SECTION:
test1.			3600	IN	SRV	0 0 443 test1.

;; Query time: 95 msec
;; SERVER: 10.8.0.1#53(10.8.0.1)
;; WHEN: Thu Aug 10 00:01:53 WEST 2023
;; MSG SIZE  rcvd: 53

With no A record in the answer section

Fixed by #7