···190190 usage in non-X11 environments, e.g. Wayland.
191191 </para>
192192 </listitem>
193193+ <listitem>
194194+ <para>
195195+ The <literal>services.stubby</literal> module was converted to
196196+ a
197197+ <link xlink:href="https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md">settings-style</link>
198198+ configuration.
199199+ </para>
200200+ </listitem>
193201 </itemizedlist>
194202 </section>
195203</section>
+2
nixos/doc/manual/release-notes/rl-2205.section.md
···7878 added, decoupling the setting of `SSH_ASKPASS` from
7979 `services.xserver.enable`. This allows easy usage in non-X11 environments,
8080 e.g. Wayland.
8181+8282+- The `services.stubby` module was converted to a [settings-style](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md) configuration.
+46-174
nixos/modules/services/networking/stubby.nix
···11-{ config, lib, pkgs, ...}:
11+{ config, lib, pkgs, ... }:
2233with lib;
4455let
66 cfg = config.services.stubby;
77-88- fallbacks = concatMapStringsSep "\n " (x: "- ${x}") cfg.fallbackProtocols;
99- listeners = concatMapStringsSep "\n " (x: "- ${x}") cfg.listenAddresses;
1010-1111- # By default, the recursive resolvers maintained by the getdns
1212- # project itself are enabled. More information about both getdns's servers,
1313- # as well as third party options for upstream resolvers, can be found here:
1414- # https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Test+Servers
1515- #
1616- # You can override these values by supplying a yaml-formatted array of your
1717- # preferred upstream resolvers in the following format:
1818- #
1919- # 106 # - address_data: IPv4 or IPv6 address of the upstream
2020- # port: Port for UDP/TCP (default is 53)
2121- # tls_auth_name: Authentication domain name checked against the server
2222- # certificate
2323- # tls_pubkey_pinset: An SPKI pinset verified against the keys in the server
2424- # certificate
2525- # - digest: Only "sha256" is currently supported
2626- # value: Base64 encoded value of the sha256 fingerprint of the public
2727- # key
2828- # tls_port: Port for TLS (default is 853)
2929-3030- defaultUpstream = ''
3131- - address_data: 145.100.185.15
3232- tls_auth_name: "dnsovertls.sinodun.com"
3333- tls_pubkey_pinset:
3434- - digest: "sha256"
3535- value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=
3636- - address_data: 145.100.185.16
3737- tls_auth_name: "dnsovertls1.sinodun.com"
3838- tls_pubkey_pinset:
3939- - digest: "sha256"
4040- value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=
4141- - address_data: 185.49.141.37
4242- tls_auth_name: "getdnsapi.net"
4343- tls_pubkey_pinset:
4444- - digest: "sha256"
4545- value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=
4646- - address_data: 2001:610:1:40ba:145:100:185:15
4747- tls_auth_name: "dnsovertls.sinodun.com"
4848- tls_pubkey_pinset:
4949- - digest: "sha256"
5050- value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=
5151- - address_data: 2001:610:1:40ba:145:100:185:16
5252- tls_auth_name: "dnsovertls1.sinodun.com"
5353- tls_pubkey_pinset:
5454- - digest: "sha256"
5555- value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=
5656- - address_data: 2a04:b900:0:100::38
5757- tls_auth_name: "getdnsapi.net"
5858- tls_pubkey_pinset:
5959- - digest: "sha256"
6060- value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=
6161- '';
6262-6363- # Resolution type is not changeable here because it is required per the
6464- # stubby documentation:
6565- #
6666- # "resolution_type: Work in stub mode only (not recursive mode) - required for Stubby
6767- # operation."
6868- #
6969- # https://dnsprivacy.org/wiki/display/DP/Configuring+Stubby
77+ settingsFormat = pkgs.formats.yaml { };
88+ confFile = settingsFormat.generate "stubby.yml" cfg.settings;
99+in {
1010+ imports = map (x:
1111+ (mkRemovedOptionModule [ "services" "stubby" x ]
1212+ "Stubby configuration moved to services.stubby.settings.")) [
1313+ "authenticationMode"
1414+ "fallbackProtocols"
1515+ "idleTimeout"
1616+ "listenAddresses"
1717+ "queryPaddingBlocksize"
1818+ "roundRobinUpstreams"
1919+ "subnetPrivate"
2020+ "upstreamServers"
2121+ ];
70227171- confFile = pkgs.writeText "stubby.yml" ''
7272- resolution_type: GETDNS_RESOLUTION_STUB
7373- dns_transport_list:
7474- ${fallbacks}
7575- appdata_dir: "/var/cache/stubby"
7676- tls_authentication: ${cfg.authenticationMode}
7777- tls_query_padding_blocksize: ${toString cfg.queryPaddingBlocksize}
7878- edns_client_subnet_private: ${if cfg.subnetPrivate then "1" else "0"}
7979- idle_timeout: ${toString cfg.idleTimeout}
8080- listen_addresses:
8181- ${listeners}
8282- round_robin_upstreams: ${if cfg.roundRobinUpstreams then "1" else "0"}
8383- ${cfg.extraConfig}
8484- upstream_recursive_servers:
8585- ${cfg.upstreamServers}
8686- '';
8787-in
8888-8989-{
9023 options = {
9124 services.stubby = {
92259326 enable = mkEnableOption "Stubby DNS resolver";
94279595- fallbackProtocols = mkOption {
9696- default = [ "GETDNS_TRANSPORT_TLS" ];
9797- type = with types; listOf (enum [
9898- "GETDNS_TRANSPORT_TLS"
9999- "GETDNS_TRANSPORT_TCP"
100100- "GETDNS_TRANSPORT_UDP"
101101- ]);
102102- description = ''
103103- Ordered list composed of one or more transport protocols.
104104- Strict mode should only use <literal>GETDNS_TRANSPORT_TLS</literal>.
105105- Other options are <literal>GETDNS_TRANSPORT_UDP</literal> and
106106- <literal>GETDNS_TRANSPORT_TCP</literal>.
107107- '';
108108- };
109109-110110- authenticationMode = mkOption {
111111- default = "GETDNS_AUTHENTICATION_REQUIRED";
112112- type = types.enum [
113113- "GETDNS_AUTHENTICATION_REQUIRED"
114114- "GETDNS_AUTHENTICATION_NONE"
115115- ];
116116- description = ''
117117- Selects the Strict or Opportunistic usage profile.
118118- For strict, set to <literal>GETDNS_AUTHENTICATION_REQUIRED</literal>.
119119- for opportunistic, use <literal>GETDNS_AUTHENTICATION_NONE</literal>.
120120- '';
121121- };
122122-123123- queryPaddingBlocksize = mkOption {
124124- default = 128;
125125- type = types.int;
126126- description = ''
127127- EDNS0 option to pad the size of the DNS query to the given blocksize.
128128- '';
129129- };
130130-131131- subnetPrivate = mkOption {
132132- default = true;
133133- type = types.bool;
134134- description = ''
135135- EDNS0 option for ECS client privacy. Default is
136136- <literal>true</literal>. If set, this option prevents the client
137137- subnet from being sent to authoritative nameservers.
138138- '';
139139- };
140140-141141- idleTimeout = mkOption {
142142- default = 10000;
143143- type = types.int;
144144- description = "EDNS0 option for keepalive idle timeout expressed in
145145- milliseconds.";
146146- };
147147-148148- listenAddresses = mkOption {
149149- default = [ "127.0.0.1" "0::1" ];
150150- type = with types; listOf str;
151151- description = ''
152152- Sets the listen address for the stubby daemon.
153153- Uses port 53 by default.
154154- Ise IP@port to specify a different port.
155155- '';
156156- };
157157-158158- roundRobinUpstreams = mkOption {
159159- default = true;
160160- type = types.bool;
161161- description = ''
162162- Instructs stubby to distribute queries across all available name
163163- servers. Default is <literal>true</literal>. Set to
164164- <literal>false</literal> in order to use the first available.
2828+ settings = mkOption {
2929+ type = types.attrsOf settingsFormat.type;
3030+ example = lib.literalExpression ''
3131+ pkgs.stubby.passthru.settingsExample // {
3232+ upstream_recursive_servers = [{
3333+ address_data = "158.64.1.29";
3434+ tls_auth_name = "kaitain.restena.lu";
3535+ tls_pubkey_pinset = [{
3636+ digest = "sha256";
3737+ value = "7ftvIkA+UeN/ktVkovd/7rPZ6mbkhVI7/8HnFJIiLa4=";
3838+ }];
3939+ }];
4040+ };
16541 '';
166166- };
167167-168168- upstreamServers = mkOption {
169169- default = defaultUpstream;
170170- type = types.lines;
17142 description = ''
172172- Replace default upstreams. See <citerefentry><refentrytitle>stubby
173173- </refentrytitle><manvolnum>1</manvolnum></citerefentry> for an
174174- example of the entry formatting. In Strict mode, at least one of the
175175- following settings must be supplied for each nameserver:
176176- <literal>tls_auth_name</literal> or
177177- <literal>tls_pubkey_pinset</literal>.
4343+ Content of the Stubby configuration file. All Stubby settings may be set or queried
4444+ here. The default settings are available at
4545+ <literal>pkgs.stubby.passthru.settingsExample</literal>. See
4646+ <link xlink:href="https://dnsprivacy.org/wiki/display/DP/Configuring+Stubby"/>.
4747+ A list of the public recursive servers can be found here:
4848+ <link xlink:href="https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Test+Servers"/>.
17849 '';
17950 };
18051···18455 description = "Enable or disable debug level logging.";
18556 };
18657187187- extraConfig = mkOption {
188188- default = "";
189189- type = types.lines;
190190- description = ''
191191- Add additional configuration options. see <citerefentry>
192192- <refentrytitle>stubby</refentrytitle><manvolnum>1</manvolnum>
193193- </citerefentry>for more options.
194194- '';
195195- };
19658 };
19759 };
1986019961 config = mkIf cfg.enable {
200200- environment.systemPackages = [ pkgs.stubby ];
6262+ assertions = [{
6363+ assertion =
6464+ (cfg.settings.resolution_type or "") == "GETDNS_RESOLUTION_STUB";
6565+ message = ''
6666+ services.stubby.settings.resolution_type must be set to "GETDNS_RESOLUTION_STUB".
6767+ Is services.stubby.settings unset?
6868+ '';
6969+ }];
7070+7171+ services.stubby.settings.appdata_dir = "/var/cache/stubby";
7272+20173 systemd.services.stubby = {
20274 description = "Stubby local DNS resolver";
20375 after = [ "network.target" ];
···6464 license = licenses.mit;
6565 maintainers = with maintainers; [ AndersonTorres ];
6666 inherit (jdk.meta) platforms;
6767+ broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/staging-next/dapl-native.x86_64-darwin
6768 };
6869}
6970# TODO: Processing app
+78-28
pkgs/development/libraries/getdns/default.nix
···11-{ lib, stdenv, fetchurl, unbound, libidn2, openssl, doxygen, cmake }:
11+# Getdns and Stubby are released together, see https://getdnsapi.net/releases/
22+33+{ lib, stdenv, fetchurl, cmake, darwin, doxygen, libidn2, libyaml, openssl
44+, systemd, unbound, yq }:
55+let
66+ metaCommon = with lib; {
77+ maintainers = with maintainers; [ leenaars ehmry ];
88+ license = licenses.bsd3;
99+ platforms = platforms.all;
1010+ };
1111+in rec {
1212+1313+ getdns = stdenv.mkDerivation rec {
1414+ pname = "getdns";
1515+ version = "1.7.0";
1616+ outputs = [ "out" "dev" "lib" "man" ];
1717+1818+ src = fetchurl {
1919+ url = "https://getdnsapi.net/releases/${pname}-${
2020+ with builtins;
2121+ concatStringsSep "-" (splitVersion version)
2222+ }/${pname}-${version}.tar.gz";
2323+ sha256 = "sha256-6ocTzl4HesdrFBjOtq/SXm1OOelgD29egdOjoTpg9lI=";
2424+ };
2525+2626+ nativeBuildInputs = [ cmake doxygen ];
2727+2828+ buildInputs = [ libidn2 openssl unbound ];
22933-stdenv.mkDerivation rec {
44- pname = "getdns";
55- version = "1.6.0";
66- versionRewrite = builtins.splitVersion version;
3030+ postInstall = "rm -r $out/share/doc";
73188- src = fetchurl {
99- url = "https://getdnsapi.net/releases/${pname}-${
1010- builtins.concatStringsSep "-" versionRewrite
1111- }/${pname}-${version}.tar.gz";
1212- sha256 = "0jhg7258wz287kjymimvdvv04n69lwxdc3sb62l2p453f5s77ra0";
3232+ meta = with lib;
3333+ metaCommon // {
3434+ description = "A modern asynchronous DNS API";
3535+ longDescription = ''
3636+ getdns is an implementation of a modern asynchronous DNS API; the
3737+ specification was originally edited by Paul Hoffman. It is intended to make all
3838+ types of DNS information easily available to application developers and non-DNS
3939+ experts. DNSSEC offers a unique global infrastructure for establishing and
4040+ enhancing cryptographic trust relations. With the development of this API the
4141+ developers intend to offer application developers a modern and flexible
4242+ interface that enables end-to-end trust in the DNS architecture, and which will
4343+ inspire application developers to implement innovative security solutions in
4444+ their applications.
4545+ '';
4646+ homepage = "https://getdnsapi.net";
4747+ };
1348 };
14491515- nativeBuildInputs = [ cmake ];
5050+ stubby = stdenv.mkDerivation rec {
5151+ pname = "stubby";
5252+ version = "0.4.0";
5353+ outputs = [ "out" "man" "stubbyExampleJson" ];
16541717- buildInputs = [ unbound libidn2 openssl doxygen ];
5555+ inherit (getdns) src;
5656+ sourceRoot = "${getdns.name}/stubby";
5757+5858+ nativeBuildInputs = [ cmake doxygen yq ];
5959+6060+ buildInputs = [ getdns libyaml openssl systemd ]
6161+ ++ lib.optionals stdenv.isDarwin [ darwin.Security ];
18621919- meta = with lib; {
2020- description = "A modern asynchronous DNS API";
2121- longDescription = ''
2222- getdns is an implementation of a modern asynchronous DNS API; the
2323- specification was originally edited by Paul Hoffman. It is intended to make all
2424- types of DNS information easily available to application developers and non-DNS
2525- experts. DNSSEC offers a unique global infrastructure for establishing and
2626- enhancing cryptographic trust relations. With the development of this API the
2727- developers intend to offer application developers a modern and flexible
2828- interface that enables end-to-end trust in the DNS architecture, and which will
2929- inspire application developers to implement innovative security solutions in
3030- their applications.
6363+ postInstall = ''
6464+ rm -r $out/share/doc
6565+ yq \
6666+ < $NIX_BUILD_TOP/$sourceRoot/stubby.yml.example \
6767+ > $stubbyExampleJson
3168 '';
3232- homepage = "https://getdnsapi.net";
3333- maintainers = with maintainers; [ leenaars ehmry ];
3434- license = licenses.bsd3;
3535- platforms = platforms.all;
6969+7070+ passthru.settingsExample = with builtins;
7171+ fromJSON (readFile stubby.stubbyExampleJson);
7272+7373+ meta = with lib;
7474+ metaCommon // {
7575+ description = "A local DNS Privacy stub resolver (using DNS-over-TLS)";
7676+ longDescription = ''
7777+ Stubby is an application that acts as a local DNS Privacy stub
7878+ resolver (using RFC 7858, aka DNS-over-TLS). Stubby encrypts DNS
7979+ queries sent from a client machine (desktop or laptop) to a DNS
8080+ Privacy resolver increasing end user privacy. Stubby is developed by
8181+ the getdns team.
8282+ '';
8383+ homepage = "https://dnsprivacy.org/wiki/x/JYAT";
8484+ };
3685 };
8686+3787}