blob: 7506ab207b66c681ec90f92722ba5ae468d1bfdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.modules.services.dns;
in
{
options.modules.services.dns = {
enable = mkEnableOption "dns";
port = mkOption {
default = 53;
type = types.int;
};
subnet = mkOption {
default = "192.168.0.0/24";
type = types.str;
};
verbosity = mkOption {
default = 1;
type = types.int;
};
ipv6 = mkOption {
default= false;
type = types.bool;
};
};
config = mkIf cfg.enable {
networking.firewall = {
allowedTCPPorts = [ cfg.port ];
allowedUDPPorts = [ cfg.port ];
};
services.unbound = {
enable = true;
package = pkgs.unbound-with-systemd;
enableRootTrustAnchor = true;
resolveLocalQueries = true;
settings.server = {
verbosity = cfg.verbosity;
do-ip6 = cfg.ipv6;
interface = [ "0.0.0.0" ];
port = cfg.port;
access-control = [ "${cfg.subnet} allow" ];
harden-glue = true;
harden-dnssec-stripped = true;
use-caps-for-id = false;
edns-buffer-size = 1232;
prefetch = true;
hide-identity = true;
hide-version = true;
};
};
};
}
|