1
1
Fork 0
mirror of https://github.com/DNSCrypt/encrypted-dns-server.git synced 2024-05-08 07:16:04 +02:00
encrypted-dns-server/README.md

98 lines
4.0 KiB
Markdown
Raw Normal View History

2019-09-21 16:53:06 +02:00
# ![Encrypted DNS Server](logo.png)
2019-09-02 23:02:23 +02:00
2019-09-21 16:48:21 +02:00
An easy to install, high-performance, zero maintenance proxy to run an encrypted DNS server.
2019-09-20 12:03:49 +02:00
Written in Rust.
## Protocols
The proxy aims at supporting the following protocols:
2019-09-02 23:02:23 +02:00
2019-09-19 13:23:51 +02:00
- [DNSCrypt v2](https://github.com/DNSCrypt/dnscrypt-protocol/blob/master/DNSCRYPT-V2-PROTOCOL.txt)
2019-09-20 12:03:49 +02:00
- [Anonymized DNSCrypt](https://github.com/DNSCrypt/dnscrypt-protocol/blob/master/ANONYMIZED-DNSCRYPT.txt) (WIP)
2019-09-19 13:24:50 +02:00
- DNS-over-HTTP (DoH)
2019-09-19 13:23:51 +02:00
2019-09-20 12:03:49 +02:00
All of these can be served simultaneously, on the same port (usually port 443). The proxy automatically detects what protocol is being used by each client.
## Installation
2019-09-22 01:51:12 +02:00
### Option 1: precompiled binary for Linux
2019-10-01 09:43:45 +02:00
Download the Encrypted DNS Server [precompiled application for Linux (x86_64)](https://github.com/jedisct1/encrypted-dns-server/suites/245882025/artifacts/71530).
2019-09-22 01:51:12 +02:00
And make the application executable:
```sh
cd encrypted-dns-linux-x86_64
chmod +x encrypted-dns
```
Nothing else has to be installed. It doesn't require any external dependencies.
2019-09-22 01:51:12 +02:00
### Option 2: compilation from source code
2019-09-20 12:03:49 +02:00
The proxy uses recent features of the Rust compiler, and currently requires rust-nightly.
Rust can installed with:
```sh
curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain nightly
2019-09-22 09:39:14 +02:00
source $HOME/.cargo/env
2019-09-20 12:03:49 +02:00
```
2019-09-20 12:21:34 +02:00
Once rust is installed, the proxy can be compiled and installed as follows:
2019-09-20 12:03:49 +02:00
```sh
2019-09-20 12:21:34 +02:00
cargo install encrypted-dns
2019-09-22 10:17:50 +02:00
strip ~/.cargo/bin/encrypted-dns
2019-09-20 12:03:49 +02:00
```
2019-09-20 12:29:25 +02:00
The executable file will be copied to `~/.cargo/bin/encrypted-dns` by default.
2019-09-20 12:03:49 +02:00
## Setup
The proxy requires a recursive DNS resolver, such as Knot, PowerDNS or Unbound.
That resolver can run locally and only respond to `127.0.0.1`. External resolvers such as Quad9 or Cloudflare DNS can also be used, but this may be less reliable due to rate limits.
In order to support DoH in addition to DNSCrypt, a DoH proxy must be running as well. [rust-doh](https://github.com/jedisct1/rust-doh) is the recommended DoH proxy server. DoH support is optional, as it is currently way more complicated to setup than DNSCrypt due to certificate management.
First, make a copy of the `example-encrypted-dns.toml` configuration file named `encrypted.toml`.
Then, review the [`encrypted-dns.toml`](https://raw.githubusercontent.com/jedisct1/encrypted-dns-server/master/encrypted-dns.toml) file. This is where all the parameters can be configured, including the IP addresses to listen to.
You should probably at least change the `listen_addresses` and `provider_name` settings.
2019-09-20 12:03:49 +02:00
Start the proxy. It will automatically create a new provider key pair if there isn't any.
The DNS stamps are printed. They can be used directly with `dnscrypt-proxy`.
There is nothing else to do. Certificates are automatically generated and rotated.
## Migrating from dnscrypt-wrapper
If you are currently running an encrypted DNS server using `dnscrypt-wrapper`, moving to the new proxy is simple:
- Double check that the provider name in `encrypted-dns.toml` matches the one you previously configured. If you forgot it, it can be recovered [from its DNS stamp](https://dnscrypt.info/stamps/).
- Run `dnscrypt-dns --import-from-dnscrypt-wrapper secret.key`, with `secret.key` being the file with the `dnscrypt-wrapper` provider secret key.
Done. Your server is now running the new proxy.
2019-09-21 16:48:21 +02:00
## Built-in DNS cache
The proxy includes a key cache, as well as a DNS cache to significantly reduce the load on upstream servers.
2019-09-22 02:03:54 +02:00
In addition, if a server is slow or unresponsive, expired cached queries will be returned, ensuring that popular domain names always keep being served.
2019-09-21 16:48:21 +02:00
2019-09-20 12:03:49 +02:00
## State file
The proxy creates and updates a file named `encrypted-dns.state` by default. That file contains the provider secret key, as well as certificates and encryption keys.
2019-09-19 13:23:51 +02:00
2019-09-20 12:03:49 +02:00
Do not delete the file, unless you want to change parameters (such as the provider name), and keep it secret, or the keys will be lost.
2019-09-19 13:23:51 +02:00
2019-09-22 02:03:54 +02:00
Putting it in a directory that is only readable by the super-user is not a bad idea.
## Filtering
Domains can be filtered directly by the proxy, see the `[filtering]` section of the configuration file.