NLnetLabs / unbound

Unbound is a validating, recursive, and caching DNS resolver.
https://nlnetlabs.nl/unbound
BSD 3-Clause "New" or "Revised" License
3.13k stars 359 forks source link

[FR] Echo back requester's IP #443

Closed NightMachinery closed 3 years ago

NightMachinery commented 3 years ago

Some DNS servers have a feature where they echo back the requester's IP:

❯ dig TXT +short o-o.myaddr.l.google.com @8.8.4.4
"2a00:1450:400a:1001::104"
"edns0-client-subnet 2.180.196.0/24"

I think this is currently not possible in Unbound?

wcawijngaards commented 3 years ago

No, that would be an unwanted feature. If it was enabled by default.

If you want to have this, you could write a python script or use the dynamic library module. The resip.py example echoes the IP in a TXT record, you could modify it to suit your need, perhaps. https://github.com/NLnetLabs/unbound/blob/master/pythonmod/examples/resip.py

NightMachinery commented 3 years ago

@wcawijngaards Thanks, I think that would work. Does the docker image support python modules?

NightMachinery commented 3 years ago

https://github.com/NLnetLabs/pythonunbound is not up-to-date, but it should work. Thanks!

ximon18 commented 3 years ago

@NightMachinary: I just manually built and pushed nlnetlabs/pythonunbound:1.13.1 to Docker Hub based on Unbound 1.13.1 (still running in Ubuntu 18.04 with Python 3.6.9). I have also updated the Docker :latest tag to point to the new image version.