1
1
mirror of https://github.com/dnscrypt/dnscrypt-server-docker synced 2024-11-22 15:32:01 +01:00
A Docker image for a non-censoring, non-logging, DNSSEC-capable, DNSCrypt-enabled DNS resolver
Go to file
Peter Dave Hello fee7c88a04 Separate update-ca-certificates in Dockerfile
Combine it with apk operation, will cause missing error issues due to
the following `|| true`, we should prevent that and let apk fail when
it's needed.
2019-08-06 00:31:01 +08:00
kube Unbreak things 2018-01-22 20:23:54 +01:00
.travis.yml Enable Travis CI with basic Docker build testing 2019-05-05 01:05:08 +08:00
dnscrypt-small.png Add logo 2015-08-08 18:18:12 +02:00
dnscrypt-wrapper.sh Quote var/cmd output in shell script to prevent word splitting 2019-05-12 19:10:41 +08:00
dnscrypt.png Add logo 2015-08-08 18:18:12 +02:00
Dockerfile Separate update-ca-certificates in Dockerfile 2019-08-06 00:31:01 +08:00
entrypoint.sh Improve if condition syntax in shell script 2019-05-12 19:17:50 +08:00
key-rotation.sh Use replace non-standard egrep/fgrep with grep -E/-F 2019-05-12 19:19:22 +08:00
LICENSE 2016 2016-01-02 09:05:30 +01:00
queue.h Import queue.h 2017-04-19 14:11:12 +02:00
README.md Add Travis Badge and fix dnscrypt website URL 2019-05-05 09:07:56 +02:00
unbound-check.sh Add bash and find from findutils in order to avoid surprises from busybox 2017-04-27 09:03:55 +02:00
unbound.sh Dropping the cache doesn't work inside a container 2019-06-29 20:04:07 +02:00
watchdog.sh Update unbound; remove dnscrypt-proxy 2018-01-22 15:52:52 +01:00

Travis Status DNSCrypt

DNSCrypt server Docker image

Run your own caching, non-censoring, non-logging, DNSSEC-capable, DNSCrypt-enabled DNS resolver virtually anywhere!

If you are already familiar with Docker, it shouldn't take more than 5 minutes to get your resolver up and running.

Quickstart

Installation

Think about a name. This is going to be part of your DNSCrypt provider name. If you are planning to make your resolver publicly accessible, this name will be public. It has to look like a domain name (example.com), but it doesn't have to be a registered domain.

Let's pick example.com here.

Download, create and initialize the container, once and for all:

$ docker run --name=dnscrypt-server -p 443:443/udp -p 443:443/tcp --net=host \
    jedisct1/dnscrypt-server init -N example.com -E 192.168.1.1:443

This will only accept connections via DNSCrypt on the standard port (443). Replace 192.168.1.1 with the actual external IP address (not the internal Docker one) clients will connect to.

--net=host provides the best network performance, but may have to be removed on some shared containers hosting services.

Now, to start the whole stack:

$ docker start dnscrypt-server

Done.

Note that the actual provider name for DNSCrypt is 2.dnscrypt-cert.example.com, not just example.com as initially entered. The full name has to start with 2.dnscrypt-cert. for the client and the server to use the same version of the protocol.

Customizing Unbound

To add new configuration to Unbound, add files to the /opt/unbound/etc/unbound/zones directory. All files ending in .conf will be processed. In this manner, you can add any directives to the server: section of the Unbound configuration.

Serve custom DNS records on a local network

While Unbound is not a full authoritative name server, it supports resolving custom entries in a way that is serviceable on a small, private LAN. You can use unbound to resolve private hostnames such as my-computer.example.com within your LAN.

To support such custom entries using this image, first map a volume to the zones directory. Add this to your docker run line:

-v /myconfig/zones:/opt/unbound/etc/unbound/zones

The whole command to create and initialize a container would look something like this:

$ docker run --name=dnscrypt-server \
    -v /myconfig/zones:/opt/unbound/etc/unbound/zones \
    -p 443:443/udp -p 443:443/tcp --net=host \
    jedisct1/dnscrypt-server init -N example.com -E 192.168.1.1:443

Create a new .conf file:

$ touch /myconfig/zones/example.conf

Now, add one or more unbound directives to the file, such as:

local-zone: "example.com." static
local-data: "my-computer.example.com. IN A 10.0.0.1"
local-data: "other-computer.example.com. IN A 10.0.0.2"

Troubleshooting

If Unbound doesn't like one of the newly added directives, it will probably not respond over the network. In that case, here are some commands to work out what is wrong:

$ docker logs dnscrypt-server
$ docker exec dnscrypt-server /opt/unbound/sbin/unbound-checkconf

Details

  • Alpine Linux as a base image.
  • Caching resolver: Unbound, with DNSSEC, prefetching, and no logs. The number of threads and memory usage are automatically adjusted. Latest stable version, compiled from source. qname minimisation is enabled.
  • libsodium - Latest stable version, minimal build compiled from source.
  • dnscrypt-wrapper - Latest stable version, compiled from source.

Keys and certificates are automatically rotated every 12 hour.

Kubernetes

Kubernetes configurations are located in the kube directory. Currently these assume a persistent disk named dnscrypt-keys on GCE. You will need to adjust the volumes definition on other platforms. Once that is setup, you can have a dnscrypt server up in minutes.

  • Create a static IP on GCE. This will be used for the LoadBalancer.
  • Edit kube/dnscrypt-init-job.yml and change example.com to your desired hostname.
  • Edit kube/dnscrypt-srv.yml and change loadBalancerIP to your static IP.
  • Run kubectl create -f kube/dnscrypt-init-job.yml to setup your keys.
  • Run kubectl create -f kube/dnscrypt-deployment.yml to deploy the dnscrypt server.
  • Run kubectl create -f kube/dnscrypt-srv.yml to expose your server to the world.

To get your public key just view the logs for the dnscrypt-init job. The public IP for your server is merely the dnscrypt service address.

Coming up next

  • Better isolation of the certificate signing process, in a dedicated container.