2019-05-05 09:07:56 +02:00
[![Travis Status ](https://travis-ci.org/DNSCrypt/dnscrypt-server-docker.svg?branch=master )](https://travis-ci.org/DNSCrypt/dnscrypt-server-docker/builds/)
[![DNSCrypt ](https://raw.github.com/jedisct1/dnscrypt-server-docker/master/dnscrypt-small.png )](https://dnscrypt.info)
2015-08-08 18:18:12 +02:00
2015-07-06 01:39:54 +02:00
DNSCrypt server Docker image
============================
Run your own caching, non-censoring, non-logging, DNSSEC-capable,
2019-10-09 18:11:51 +02:00
[DNSCrypt ](https://dnscrypt.info )-enabled DNS resolver virtually anywhere!
2015-07-06 01:39:54 +02:00
If you are already familiar with Docker, it shouldn't take more than 5 minutes
to get your resolver up and running.
2019-09-26 18:05:40 +02:00
Table of Contents
=================
- [Quickstart ](#quickstart )
- [Installation ](#installation )
- [Customizing Unbound ](#customizing-unbound )
- [Serve custom DNS records on a local network ](#serve-custom-dns-records-on-a-local-network )
- [Troubleshooting ](#troubleshooting )
- [Details ](#details )
- [Kubernetes ](#kubernetes )
2019-10-09 18:17:10 +02:00
- [Join the network ](#join-the-network )
2019-09-26 18:05:40 +02:00
2018-02-01 23:13:36 +01:00
Quickstart
==========
2019-09-22 15:38:22 +02:00
* [How to setup your own DNSCrypt server in less than 10 minutes on Scaleway ](https://github.com/dnscrypt/dnscrypt-proxy/wiki/How-to-setup-your-own-DNSCrypt-server-in-less-than-10-minutes )
* [DNSCrypt server with vultr.com ](https://github.com/dnscrypt/dnscrypt-proxy/wiki/DNSCrypt-server-with-vultr.com )
2018-02-01 23:13:36 +01:00
2015-07-06 01:39:54 +02:00
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
2015-07-06 01:56:35 +02:00
a registered domain.
2015-07-06 01:39:54 +02:00
Let's pick `example.com` here.
2015-07-12 17:54:03 +02:00
Download, create and initialize the container, once and for all:
2015-07-06 01:39:54 +02:00
2015-08-29 00:17:30 +02:00
$ docker run --name=dnscrypt-server -p 443:443/udp -p 443:443/tcp --net=host \
2018-01-26 16:49:50 +01:00
jedisct1/dnscrypt-server init -N example.com -E 192.168.1.1:443
2015-07-06 01:39:54 +02:00
2018-01-22 18:21:50 +01:00
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.
2015-08-29 00:17:30 +02:00
`--net=host` provides the best network performance, but may have to be
removed on some shared containers hosting services.
2015-07-06 01:39:54 +02:00
Now, to start the whole stack:
$ docker start dnscrypt-server
Done.
2016-08-25 00:42:13 +02:00
Customizing Unbound
2018-01-22 15:53:47 +01:00
===================
2016-08-25 00:42:13 +02:00
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
2018-01-22 20:25:29 +01:00
-------------------------------------------
2016-08-25 00:42:13 +02:00
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 \
2018-01-26 16:49:50 +01:00
jedisct1/dnscrypt-server init -N example.com -E 192.168.1.1:443
2016-08-25 00:42:13 +02:00
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:
2016-10-02 17:09:12 +02:00
$ docker logs dnscrypt-server
$ docker exec dnscrypt-server /opt/unbound/sbin/unbound-checkconf
2016-08-25 00:42:13 +02:00
2015-07-06 01:39:54 +02:00
Details
=======
2019-10-09 18:07:46 +02:00
- A minimal Ubuntu Linux as a base image.
2015-07-06 01:39:54 +02:00
- Caching resolver: [Unbound ](https://www.unbound.net/ ), with DNSSEC, prefetching,
and no logs. The number of threads and memory usage are automatically adjusted.
2015-12-11 10:30:32 +01:00
Latest stable version, compiled from source. qname minimisation is enabled.
2019-09-22 15:38:22 +02:00
- [encrypted-dns-server ](https://github.com/jedisct1/dnscrypt-dns-server ).
Compiled from source.
2015-07-06 01:47:58 +02:00
2019-09-22 15:38:22 +02:00
Keys and certificates are automatically rotated every 8 hour.
2015-07-06 01:47:58 +02:00
2017-07-16 11:29:46 +02:00
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.
2017-07-17 00:37:40 +02:00
* Create a static IP on GCE. This will be used for the LoadBalancer.
2017-07-16 11:29:46 +02:00
* Edit `kube/dnscrypt-init-job.yml` and change `example.com` to your desired hostname.
2017-07-17 00:37:40 +02:00
* Edit `kube/dnscrypt-srv.yml` and change `loadBalancerIP` to your static IP.
2017-07-16 11:29:46 +02:00
* 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.
2019-10-09 18:17:10 +02:00
Join the network
================
If you want to help against DNS centralization and surveillance,
announce your server on the list of [public DNS DoH and DNSCrypt servers ](https://dnscrypt.info/public-servers )!
The best way to do so is to send a pull request to the
[dnscrypt-resolvers ](https://github.com/DNSCrypt/dnscrypt-resolvers/ ) repository.