CompactDNS, also known as CDNS is a authoritative and forwarding DNS server.
- Easy to setup
- Can be configured as an adblocker
- Caches responses locally
Install CDNS from source
git clone https://github.com/ninjamar/compactdns
cd compactdns
pip install .
For development,
pip install -e .
After installation, CDNS can be used by running:
cdns [command] [options]
Starts the DNS server.
cdns run [options]
Configuration is stored in a toml
or json
file. See config.toml
for an example configuration.
cdns run --config config.toml
cdns shell [options]
Options:
--host
, -h
: The host address of the shell server in the format of a.b.c.d:port
--secret
, s
: The secret of the shell server. The secret is logged when cdns is started.
A key and certificate file is needed to use TLS. Generate it:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
For debugging, CDNS includes an interactive python shell. The shell can be accessed using the shell
command.
>>> help(self.command)
>>> help(cdns.manager.ServerManager.command)
DNS zones can be stored in a folder. Make sure that each filename is in the format of domain.zone
.
On MacOS:
networksetup -setdnsservers Wi-Fi A.B.C.D
DNS runs over port 53
for both UDP and TCP.
Send test queries using dig.
dig @A.B.C.D -p PORT google.com
This project is licensed under the MIT License. Please see the LICENSE file for more details.