# sdns **Repository Path**: wheatj/sdns ## Basic Information - **Project Name**: sdns - **Description**: No description available - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-10-15 - **Last Updated**: 2023-10-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

sdns 📂

A DNS server based on minimal static configuration

[![Build Status](https://travis-ci.org/cirocosta/sdns.svg?branch=master)](https://travis-ci.org/cirocosta/sdns) ### Use cases #### Make a domain always resolve to localhost ``` sudo sdns \ --port 53 \ --addr 127.0.0.11 \ 'domain=test.cirocosta.io,ip=192.168.0.103,ns=mynameserver.com' \ 'domain=*.cirocosta.io,ip=127.0.0.1,ip=10.0.0.10' ``` #### Retrieve information about each DNS request being performed ``` sudo sdns \ --debug \ # logs the requests to 'stderr' --port 53 \ --addr 127.0.0.11 \ --recursor 8.8.8.8 ``` ### Install Pick the latest version in the [project's releases page](https://github.com/cirocosta/sdns/releases) and then "untar" the binary to the desired location in `$PATH`. For instance: ``` URL=https://github.com/cirocosta/sdns/releases/download/v0.0.1/sdns_0.0.1_darwin_amd64.tar.gz mkdir -p /tmp/sdns curl -o /tmp/sdns/sdns.tar.gz -L $URL tar xzfv /tmp/sdns/sdns.tar.gz -C /tmp/sdns sudo mv /tmp/sdns/sdns /usr/local/bin/sdns ``` Note.: you can also use `go` to install it: `go get -u github.com/cirocosta/sdns`. Just make sure that you can run the binary with the necessary privileges to bind to port `53`. ### Docker Using `sdns` in a Docker container is completely fine, you can find the image under [cirocosta/sdns](https://hub.docker.com/r/cirocosta/sdns). ``` docker run -d \ --network host \ # use the host network stack (not required) cirocosta/sdns \ # use the image --debug \ # logs the requests to 'stderr' --port 53 \ --addr 127.0.0.11 \ --recursor 8.8.8.8 ``` ### Usage ``` Usage: sdns [--port PORT] [--address ADDRESS] [--debug] [--recursor RECURSOR] [DOMAINS [DOMAINS ...]] Positional arguments: DOMAINS list of domains Options: --port PORT, -p PORT port to listen to [default: 1053] --address ADDRESS, -a ADDRESS address to bind to --debug, -d turn debug mode on [default: true] --recursor RECURSOR, -r RECURSOR list of recursors to honor [default: [8.8.8.8 8.8.4.4]] --help, -h display this help and exit ``` ### Running as the system's DNS ### Ubuntu 17.04 If you're on Ubuntu 17.04 you might have noticed that `systemd` places a DNS resolver at `127.0.0.53`: ```sh cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN # 127.0.0.53 is the systemd-resolved stub resolver. # run "systemd-resolve --status" to see details about the actual nameservers. 127.0.0.53 ``` As `systemd-resolve` is a `systemd` service like any other, we just need to stop the unit and then place `sdns` at `127.0.0.53` listening on the default DNS service port (`53`): ``` sudo systemctl stop systemd-resolved sudo sdns \ # run as sudo to be able to bind to 53 --debug \ # with --debug we capture more logs --address 127.0.0.53 \ # listen on the expected IP --port 53 # on port 53 # Now if you stop 'sdns' you'll lose DNS resolving. # To get systemd-resolve in place again just # issue `sudo systemctl start systemd-resolved`. ``` Now you can head to your web browser and see the queries coming to SDNS. If you wish you can also run `sdns` as a `systemd` service (like `systemd-resolved`)