···2828in
29293030{
3131+ meta = {
3232+ maintainers = with maintainers; [ joachifm ];
3333+ doc = ./dnscrypt-proxy.xml;
3434+ };
3535+3136 options = {
3237 services.dnscrypt-proxy = {
3333- enable = mkEnableOption "dnscrypt-proxy" // { description = ''
3434- Whether to enable the DNSCrypt client proxy. The proxy relays
3535- DNS queries to a DNSCrypt enabled upstream resolver. The traffic
3636- between the client and the upstream resolver is encrypted and
3737- authenticated, mitigating the risk of MITM attacks and third-party
3838- snooping (assuming the upstream is trustworthy).
3939-4040- Enabling this option does not alter the system nameserver; to relay
4141- local queries, prepend <literal>127.0.0.1</literal> to
4242- <option>networking.nameservers</option>.
3838+ enable = mkEnableOption "DNSCrypt client proxy";
43394444- The recommended configuration is to run DNSCrypt proxy as a forwarder
4545- for a caching DNS client, as in
4646- <programlisting>
4747- {
4848- services.dnscrypt-proxy.enable = true;
4949- services.dnscrypt-proxy.localPort = 43;
5050- services.dnsmasq.enable = true;
5151- services.dnsmasq.servers = [ "127.0.0.1#43" ];
5252- services.dnsmasq.resolveLocalQueries = true; # this is the default
5353- }
5454- </programlisting>
5555- ''; };
5640 localAddress = mkOption {
5741 default = "127.0.0.1";
5842 type = types.str;
···11+<chapter xmlns="http://docbook.org/ns/docbook"
22+ xmlns:xlink="http://www.w3.org/1999/xlink"
33+ xmlns:xi="http://www.w3.org/2001/XInclude"
44+ version="5.0"
55+ xml:id="sec-dnscrypt-proxy">
66+77+ <title>DNSCrypt client proxy</title>
88+99+ <para>
1010+ The DNSCrypt client proxy relays DNS queries to a DNSCrypt enabled
1111+ upstream resolver. The traffic between the client and the upstream
1212+ resolver is encrypted and authenticated, mitigating the risk of MITM
1313+ attacks, DNS poisoning attacks, and third-party snooping (assuming the
1414+ upstream is trustworthy).
1515+ </para>
1616+1717+ <sect1><title>Basic configuration</title>
1818+1919+ <para>
2020+ To enable the client proxy, set
2121+ <programlisting>
2222+ services.dnscrypt-proxy.enable = true;
2323+ </programlisting>
2424+ </para>
2525+2626+ <para>
2727+ Enabling the client proxy does not alter the system nameserver; to
2828+ relay local queries, prepend <literal>127.0.0.1</literal> to
2929+ <option>networking.nameservers</option>.
3030+ </para>
3131+3232+ </sect1>
3333+3434+ <sect1><title>As a forwarder for a caching DNS client</title>
3535+3636+ <para>
3737+ By default, DNSCrypt proxy acts as a transparent proxy for the
3838+ system stub resolver. Because the client does not cache lookups, this
3939+ setup can significantly slow down e.g., web browsing. The recommended
4040+ configuration is to run DNSCrypt proxy as a forwarder for a caching DNS
4141+ client. To achieve this, change the default proxy listening port to
4242+ a non-standard value and point the caching client to it:
4343+ <programlisting>
4444+ services.dnscrypt-proxy.localPort = 43;
4545+ </programlisting>
4646+ </para>
4747+4848+ <sect2><title>dnsmasq</title>
4949+ <para>
5050+ <programlisting>
5151+ {
5252+ services.dnsmasq.enable = true;
5353+ services.dnsmasq.servers = [ "127.0.0.1#43" ];
5454+ }
5555+ </programlisting>
5656+ </para>
5757+ </sect2>
5858+5959+ <sect2><title>unbound</title>
6060+ <para>
6161+ <programlisting>
6262+ {
6363+ networking.nameservers = [ "127.0.0.1" ];
6464+ services.unbound.enable = true;
6565+ services.unbound.forwardAddresses = [ "127.0.0.1@43" ];
6666+ services.unbound.extraConfig = ''
6767+ do-not-query-localhost: no
6868+ '';
6969+ }
7070+ </programlisting>
7171+ </para>
7272+ </sect2>
7373+7474+ </sect1>
7575+7676+</chapter>