···190 usage in non-X11 environments, e.g. Wayland.
191 </para>
192 </listitem>
00000000193 </itemizedlist>
194 </section>
195</section>
···190 usage in non-X11 environments, e.g. Wayland.
191 </para>
192 </listitem>
193+ <listitem>
194+ <para>
195+ The <literal>services.stubby</literal> module was converted to
196+ a
197+ <link xlink:href="https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md">settings-style</link>
198+ configuration.
199+ </para>
200+ </listitem>
201 </itemizedlist>
202 </section>
203</section>
+2
nixos/doc/manual/release-notes/rl-2205.section.md
···78 added, decoupling the setting of `SSH_ASKPASS` from
79 `services.xserver.enable`. This allows easy usage in non-X11 environments,
80 e.g. Wayland.
00
···78 added, decoupling the setting of `SSH_ASKPASS` from
79 `services.xserver.enable`. This allows easy usage in non-X11 environments,
80 e.g. Wayland.
81+82+- 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
···1-{ config, lib, pkgs, ...}:
23with lib;
45let
6 cfg = config.services.stubby;
7-8- fallbacks = concatMapStringsSep "\n " (x: "- ${x}") cfg.fallbackProtocols;
9- listeners = concatMapStringsSep "\n " (x: "- ${x}") cfg.listenAddresses;
10-11- # By default, the recursive resolvers maintained by the getdns
12- # project itself are enabled. More information about both getdns's servers,
13- # as well as third party options for upstream resolvers, can be found here:
14- # https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Test+Servers
15- #
16- # You can override these values by supplying a yaml-formatted array of your
17- # preferred upstream resolvers in the following format:
18- #
19- # 106 # - address_data: IPv4 or IPv6 address of the upstream
20- # port: Port for UDP/TCP (default is 53)
21- # tls_auth_name: Authentication domain name checked against the server
22- # certificate
23- # tls_pubkey_pinset: An SPKI pinset verified against the keys in the server
24- # certificate
25- # - digest: Only "sha256" is currently supported
26- # value: Base64 encoded value of the sha256 fingerprint of the public
27- # key
28- # tls_port: Port for TLS (default is 853)
29-30- defaultUpstream = ''
31- - address_data: 145.100.185.15
32- tls_auth_name: "dnsovertls.sinodun.com"
33- tls_pubkey_pinset:
34- - digest: "sha256"
35- value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=
36- - address_data: 145.100.185.16
37- tls_auth_name: "dnsovertls1.sinodun.com"
38- tls_pubkey_pinset:
39- - digest: "sha256"
40- value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=
41- - address_data: 185.49.141.37
42- tls_auth_name: "getdnsapi.net"
43- tls_pubkey_pinset:
44- - digest: "sha256"
45- value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=
46- - address_data: 2001:610:1:40ba:145:100:185:15
47- tls_auth_name: "dnsovertls.sinodun.com"
48- tls_pubkey_pinset:
49- - digest: "sha256"
50- value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=
51- - address_data: 2001:610:1:40ba:145:100:185:16
52- tls_auth_name: "dnsovertls1.sinodun.com"
53- tls_pubkey_pinset:
54- - digest: "sha256"
55- value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=
56- - address_data: 2a04:b900:0:100::38
57- tls_auth_name: "getdnsapi.net"
58- tls_pubkey_pinset:
59- - digest: "sha256"
60- value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=
61- '';
62-63- # Resolution type is not changeable here because it is required per the
64- # stubby documentation:
65- #
66- # "resolution_type: Work in stub mode only (not recursive mode) - required for Stubby
67- # operation."
68- #
69- # https://dnsprivacy.org/wiki/display/DP/Configuring+Stubby
7071- confFile = pkgs.writeText "stubby.yml" ''
72- resolution_type: GETDNS_RESOLUTION_STUB
73- dns_transport_list:
74- ${fallbacks}
75- appdata_dir: "/var/cache/stubby"
76- tls_authentication: ${cfg.authenticationMode}
77- tls_query_padding_blocksize: ${toString cfg.queryPaddingBlocksize}
78- edns_client_subnet_private: ${if cfg.subnetPrivate then "1" else "0"}
79- idle_timeout: ${toString cfg.idleTimeout}
80- listen_addresses:
81- ${listeners}
82- round_robin_upstreams: ${if cfg.roundRobinUpstreams then "1" else "0"}
83- ${cfg.extraConfig}
84- upstream_recursive_servers:
85- ${cfg.upstreamServers}
86- '';
87-in
88-89-{
90 options = {
91 services.stubby = {
9293 enable = mkEnableOption "Stubby DNS resolver";
9495- fallbackProtocols = mkOption {
96- default = [ "GETDNS_TRANSPORT_TLS" ];
97- type = with types; listOf (enum [
98- "GETDNS_TRANSPORT_TLS"
99- "GETDNS_TRANSPORT_TCP"
100- "GETDNS_TRANSPORT_UDP"
101- ]);
102- description = ''
103- Ordered list composed of one or more transport protocols.
104- Strict mode should only use <literal>GETDNS_TRANSPORT_TLS</literal>.
105- Other options are <literal>GETDNS_TRANSPORT_UDP</literal> and
106- <literal>GETDNS_TRANSPORT_TCP</literal>.
107- '';
108- };
109-110- authenticationMode = mkOption {
111- default = "GETDNS_AUTHENTICATION_REQUIRED";
112- type = types.enum [
113- "GETDNS_AUTHENTICATION_REQUIRED"
114- "GETDNS_AUTHENTICATION_NONE"
115- ];
116- description = ''
117- Selects the Strict or Opportunistic usage profile.
118- For strict, set to <literal>GETDNS_AUTHENTICATION_REQUIRED</literal>.
119- for opportunistic, use <literal>GETDNS_AUTHENTICATION_NONE</literal>.
120- '';
121- };
122-123- queryPaddingBlocksize = mkOption {
124- default = 128;
125- type = types.int;
126- description = ''
127- EDNS0 option to pad the size of the DNS query to the given blocksize.
128- '';
129- };
130-131- subnetPrivate = mkOption {
132- default = true;
133- type = types.bool;
134- description = ''
135- EDNS0 option for ECS client privacy. Default is
136- <literal>true</literal>. If set, this option prevents the client
137- subnet from being sent to authoritative nameservers.
138- '';
139- };
140-141- idleTimeout = mkOption {
142- default = 10000;
143- type = types.int;
144- description = "EDNS0 option for keepalive idle timeout expressed in
145- milliseconds.";
146- };
147-148- listenAddresses = mkOption {
149- default = [ "127.0.0.1" "0::1" ];
150- type = with types; listOf str;
151- description = ''
152- Sets the listen address for the stubby daemon.
153- Uses port 53 by default.
154- Ise IP@port to specify a different port.
155- '';
156- };
157-158- roundRobinUpstreams = mkOption {
159- default = true;
160- type = types.bool;
161- description = ''
162- Instructs stubby to distribute queries across all available name
163- servers. Default is <literal>true</literal>. Set to
164- <literal>false</literal> in order to use the first available.
165 '';
166- };
167-168- upstreamServers = mkOption {
169- default = defaultUpstream;
170- type = types.lines;
171 description = ''
172- Replace default upstreams. See <citerefentry><refentrytitle>stubby
173- </refentrytitle><manvolnum>1</manvolnum></citerefentry> for an
174- example of the entry formatting. In Strict mode, at least one of the
175- following settings must be supplied for each nameserver:
176- <literal>tls_auth_name</literal> or
177- <literal>tls_pubkey_pinset</literal>.
178 '';
179 };
180···184 description = "Enable or disable debug level logging.";
185 };
186187- extraConfig = mkOption {
188- default = "";
189- type = types.lines;
190- description = ''
191- Add additional configuration options. see <citerefentry>
192- <refentrytitle>stubby</refentrytitle><manvolnum>1</manvolnum>
193- </citerefentry>for more options.
194- '';
195- };
196 };
197 };
198199 config = mkIf cfg.enable {
200- environment.systemPackages = [ pkgs.stubby ];
0000000000201 systemd.services.stubby = {
202 description = "Stubby local DNS resolver";
203 after = [ "network.target" ];
···1+{ config, lib, pkgs, ... }:
23with lib;
45let
6 cfg = config.services.stubby;
7+ settingsFormat = pkgs.formats.yaml { };
8+ confFile = settingsFormat.generate "stubby.yml" cfg.settings;
9+in {
10+ imports = map (x:
11+ (mkRemovedOptionModule [ "services" "stubby" x ]
12+ "Stubby configuration moved to services.stubby.settings.")) [
13+ "authenticationMode"
14+ "fallbackProtocols"
15+ "idleTimeout"
16+ "listenAddresses"
17+ "queryPaddingBlocksize"
18+ "roundRobinUpstreams"
19+ "subnetPrivate"
20+ "upstreamServers"
21+ ];
00000000000000000000000000000000000000000000000022000000000000000000023 options = {
24 services.stubby = {
2526 enable = mkEnableOption "Stubby DNS resolver";
2728+ settings = mkOption {
29+ type = types.attrsOf settingsFormat.type;
30+ example = lib.literalExpression ''
31+ pkgs.stubby.passthru.settingsExample // {
32+ upstream_recursive_servers = [{
33+ address_data = "158.64.1.29";
34+ tls_auth_name = "kaitain.restena.lu";
35+ tls_pubkey_pinset = [{
36+ digest = "sha256";
37+ value = "7ftvIkA+UeN/ktVkovd/7rPZ6mbkhVI7/8HnFJIiLa4=";
38+ }];
39+ }];
40+ };
00000000000000000000000000000000000000000000000000000000041 '';
0000042 description = ''
43+ Content of the Stubby configuration file. All Stubby settings may be set or queried
44+ here. The default settings are available at
45+ <literal>pkgs.stubby.passthru.settingsExample</literal>. See
46+ <link xlink:href="https://dnsprivacy.org/wiki/display/DP/Configuring+Stubby"/>.
47+ A list of the public recursive servers can be found here:
48+ <link xlink:href="https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Test+Servers"/>.
49 '';
50 };
51···55 description = "Enable or disable debug level logging.";
56 };
5700000000058 };
59 };
6061 config = mkIf cfg.enable {
62+ assertions = [{
63+ assertion =
64+ (cfg.settings.resolution_type or "") == "GETDNS_RESOLUTION_STUB";
65+ message = ''
66+ services.stubby.settings.resolution_type must be set to "GETDNS_RESOLUTION_STUB".
67+ Is services.stubby.settings unset?
68+ '';
69+ }];
70+71+ services.stubby.settings.appdata_dir = "/var/cache/stubby";
72+73 systemd.services.stubby = {
74 description = "Stubby local DNS resolver";
75 after = [ "network.target" ];
···64 license = licenses.mit;
65 maintainers = with maintainers; [ AndersonTorres ];
66 inherit (jdk.meta) platforms;
67+ broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/staging-next/dapl-native.x86_64-darwin
68 };
69}
70# TODO: Processing app
+78-28
pkgs/development/libraries/getdns/default.nix
···1-{ lib, stdenv, fetchurl, unbound, libidn2, openssl, doxygen, cmake }:
00000000000000000000000000023-stdenv.mkDerivation rec {
4- pname = "getdns";
5- version = "1.6.0";
6- versionRewrite = builtins.splitVersion version;
78- src = fetchurl {
9- url = "https://getdnsapi.net/releases/${pname}-${
10- builtins.concatStringsSep "-" versionRewrite
11- }/${pname}-${version}.tar.gz";
12- sha256 = "0jhg7258wz287kjymimvdvv04n69lwxdc3sb62l2p453f5s77ra0";
0000000000013 };
1415- nativeBuildInputs = [ cmake ];
0001617- buildInputs = [ unbound libidn2 openssl doxygen ];
0000001819- meta = with lib; {
20- description = "A modern asynchronous DNS API";
21- longDescription = ''
22- getdns is an implementation of a modern asynchronous DNS API; the
23- specification was originally edited by Paul Hoffman. It is intended to make all
24- types of DNS information easily available to application developers and non-DNS
25- experts. DNSSEC offers a unique global infrastructure for establishing and
26- enhancing cryptographic trust relations. With the development of this API the
27- developers intend to offer application developers a modern and flexible
28- interface that enables end-to-end trust in the DNS architecture, and which will
29- inspire application developers to implement innovative security solutions in
30- their applications.
31 '';
32- homepage = "https://getdnsapi.net";
33- maintainers = with maintainers; [ leenaars ehmry ];
34- license = licenses.bsd3;
35- platforms = platforms.all;
00000000000036 };
037}
···1+# Getdns and Stubby are released together, see https://getdnsapi.net/releases/
2+3+{ lib, stdenv, fetchurl, cmake, darwin, doxygen, libidn2, libyaml, openssl
4+, systemd, unbound, yq }:
5+let
6+ metaCommon = with lib; {
7+ maintainers = with maintainers; [ leenaars ehmry ];
8+ license = licenses.bsd3;
9+ platforms = platforms.all;
10+ };
11+in rec {
12+13+ getdns = stdenv.mkDerivation rec {
14+ pname = "getdns";
15+ version = "1.7.0";
16+ outputs = [ "out" "dev" "lib" "man" ];
17+18+ src = fetchurl {
19+ url = "https://getdnsapi.net/releases/${pname}-${
20+ with builtins;
21+ concatStringsSep "-" (splitVersion version)
22+ }/${pname}-${version}.tar.gz";
23+ sha256 = "sha256-6ocTzl4HesdrFBjOtq/SXm1OOelgD29egdOjoTpg9lI=";
24+ };
25+26+ nativeBuildInputs = [ cmake doxygen ];
27+28+ buildInputs = [ libidn2 openssl unbound ];
2930+ postInstall = "rm -r $out/share/doc";
0003132+ meta = with lib;
33+ metaCommon // {
34+ description = "A modern asynchronous DNS API";
35+ longDescription = ''
36+ getdns is an implementation of a modern asynchronous DNS API; the
37+ specification was originally edited by Paul Hoffman. It is intended to make all
38+ types of DNS information easily available to application developers and non-DNS
39+ experts. DNSSEC offers a unique global infrastructure for establishing and
40+ enhancing cryptographic trust relations. With the development of this API the
41+ developers intend to offer application developers a modern and flexible
42+ interface that enables end-to-end trust in the DNS architecture, and which will
43+ inspire application developers to implement innovative security solutions in
44+ their applications.
45+ '';
46+ homepage = "https://getdnsapi.net";
47+ };
48 };
4950+ stubby = stdenv.mkDerivation rec {
51+ pname = "stubby";
52+ version = "0.4.0";
53+ outputs = [ "out" "man" "stubbyExampleJson" ];
5455+ inherit (getdns) src;
56+ sourceRoot = "${getdns.name}/stubby";
57+58+ nativeBuildInputs = [ cmake doxygen yq ];
59+60+ buildInputs = [ getdns libyaml openssl systemd ]
61+ ++ lib.optionals stdenv.isDarwin [ darwin.Security ];
6263+ postInstall = ''
64+ rm -r $out/share/doc
65+ yq \
66+ < $NIX_BUILD_TOP/$sourceRoot/stubby.yml.example \
67+ > $stubbyExampleJson
000000068 '';
69+70+ passthru.settingsExample = with builtins;
71+ fromJSON (readFile stubby.stubbyExampleJson);
72+73+ meta = with lib;
74+ metaCommon // {
75+ description = "A local DNS Privacy stub resolver (using DNS-over-TLS)";
76+ longDescription = ''
77+ Stubby is an application that acts as a local DNS Privacy stub
78+ resolver (using RFC 7858, aka DNS-over-TLS). Stubby encrypts DNS
79+ queries sent from a client machine (desktop or laptop) to a DNS
80+ Privacy resolver increasing end user privacy. Stubby is developed by
81+ the getdns team.
82+ '';
83+ homepage = "https://dnsprivacy.org/wiki/x/JYAT";
84+ };
85 };
86+87}