Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No following for CNAME resolution for custom records #1

Closed
cottand opened this issue Aug 25, 2023 · 1 comment · Fixed by #26
Closed

No following for CNAME resolution for custom records #1

cottand opened this issue Aug 25, 2023 · 1 comment · Fixed by #26
Labels
bug Something isn't working

Comments

@cottand
Copy link
Owner

cottand commented Aug 25, 2023

Ported from looterz/grimd#113

With the following custom records config (other config params mostly defaults):

customdnsrecords = [
    "example.memez         3600      IN  A       0.0.0.1",
    "example.different     3600      IN  CNAME   example.memez",
]

It seems when looking up example.different replies do not contain A 0.0.0.1 in the answer section.

dig output:

❯ dig @10.8.0.1 example.different

; <<>> DiG 9.10.6 <<>> @10.8.0.1 example.different
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40343
;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;example.different.		IN	A

;; ANSWER SECTION:
example.different.	3600	IN	CNAME	example.memez.

;; Query time: 86 msec
;; SERVER: 10.8.0.1#53(10.8.0.1)
;; WHEN: Wed Aug 09 14:17:51 WEST 2023
;; MSG SIZE  rcvd: 79

nslookup output:

❯ nslookup example.different
Server:		10.8.0.1
Address:	10.8.0.1#53

Non-authoritative answer:
example.different	canonical name = example.memez.


❯ nslookup example.memez
Server:		10.8.0.1
Address:	10.8.0.1#53

Non-authoritative answer:
Name:	example.memez
Address: 0.0.0.1

Not flattening is fine for some OSs (MacOS in my case does not mind) but on a Docker image (grafana/grafana:9.4.7) I found it to not be fine, resulting in the following:

# on grafana/grafana:9.4.7
/usr/share/grafana # ping example.different
ping: bad address 'example.different'

/usr/share/grafana # ping example.memez
PING example.memez (0.0.0.1): 56 data bytes
--- example.memez ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss

# on MacOS
❯ ping example.different
PING example.memez (0.0.0.1): 56 data bytes
ping: sendto: No route to host
Request timeout for icmp_seq 0

So as you can see it can't recurse, maybe because the image is based on alpine?

Other DNS servers (like blocky) do flatten custom DNS but do not allow
specyfing the records themselves (SRV, CNAME...) but grimd is the only one I have found that allows specifying custom DNS records and does adblocking. So I would love for this to work.

@cottand cottand added the bug Something isn't working label Aug 25, 2023
@cottand cottand changed the title No recursion/flattening for CNAME resolution for custom records #113 No recursion/flattening for CNAME resolution for custom records Aug 25, 2023
@cottand
Copy link
Owner Author

cottand commented Nov 7, 2023

Turns out this is not CNAME flattening or recursion (as described here) but normal DNS resolution, as per https://www.rfc-editor.org/rfc/rfc6895.html#section-3.2

which makes this bug even more important to implement to be able to use grimd custom DNS records properly

@cottand cottand changed the title No recursion/flattening for CNAME resolution for custom records No following for CNAME resolution for custom records Nov 7, 2023
cottand added a commit that referenced this issue Nov 8, 2023
* refactor handler into EventLoop and doRequest()

* delete reaper subrepo

* refactor handler to be able to resolve from req to response

* implement CNAME-following for external domains

* feat(RFC-1034): implement CNAME following

* fix(CI): use Go 1.21 to test in CI

* update README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant