Following the generate-domains-blacklist.py Python script that is part of dnscrypt-proxy. Started as steps from github.com/oznu/dns-zone-blacklist using Golang.
$ cd sinkhole
$ docker build -t sinkhole .
$ docker run -ti -p 5300:5300/udp sinkhole
$ dig @127.0.0.1 -p 5300 adafruit.com
Which shows the domain has round-robin between 104.20.38.240 and 104.20.39.240. So far so good.
$ dig @127.0.0.1 -p 5300 doubleclick.net
The result will be 0.0.0.0 which means success!
To choose the port, either pass a build arg to docker or use your own config file.
Example of the build arg:
$ docker build --build-arg PORT=5353 -t sinkhole .
Example of the config file approach:
$ curl -o dns.toml https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml
$ nano dns.toml
#search for the bind line
[127.0.0.1:53]
$ docker run -ti -p 5353:5353/udp -v $(pwd):/opt/mydns sinkhole -c /opt/mydns/dns.toml
dnscache from djbdns
cloudflared Argo Tunnel by CloudFlare(LICENSE)
DNS library by Miek Gieben(LICENSE)
dnscrypt-proxy by Frank Denis(LICENSE)
Unbound image by Kyle Harding(LICENSE)
BIND, Dnsmasq, Unbound blacklist project
Unified hosts file by Steven Black (LICENSE)
Pi-hole guide on recursive DNS
- raspberry pi 4
- ubuntu-server arm64 image
- ip a (wlan0)
- /etc/netplan/wireless.yaml (from /usr/share/doc/cloud-init/examples)
- sudo netplan --debug try/generate/apply
- sudo apt update -y && sudo apt upgrade -y && sudo apt dist-upgrade -y
- sudo apt install -y unbound
- sudo vi /etc/unbound/unbound.conf.d/pihole.conf (see pi-hole guide for unbound recursive dns)
- curl -o unbound.bl https://raw.githubusercontent.com/oznu/dns-zone-blacklist/master/unbound/unbound.blacklist
- sudo systemctl stop systemd-resolved
- sudo vi /etc/systemd/resolved.conf
- sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
- sudo ufw allow in on wlan0 from 192.168.0.0/16 to any port 53
- sudo ufw enable
- sudo ufw status
- sudo echo "127.0.0.1 pihole" >> /etc/hosts
- sudo rm /etc/hostname && echo pihole > /etc/hostname
- optionally, touch /etc/cloud/cloud-init.disabled
Content type
Image
Digest
Size
6.2 MB
Last updated
about 6 years ago
docker pull patterns/sinkhole