blob: 5fb3cbe9a4ad1ed24d0bd21dfd787040b6793a49 (
plain) (
blame)
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
59
60
61
62
63
64
|
# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
lib,
config,
pkgs,
...
}: let
cfg = config.vhack.unbound;
in {
options.vhack.unbound = {
enable = lib.mkEnableOption "local unbound, a resolving dns server";
};
config = lib.mkIf cfg.enable {
vhack.persist.directories = [
{
directory = "/var/lib/unbound";
user = "unbound";
group = "unbound";
mode = "0700";
}
];
services.unbound = {
enable = true;
stateDir = "/var/lib/unbound";
resolveLocalQueries = true;
settings = {
server = {
hide-identity = true;
hide-version = true;
harden-glue = true;
harden-dnssec-stripped = true;
# 0x20-encoded randomization
use-caps-for-id = true;
# DNSSEC - enabled by default with auto-trust-anchor-file
# auto-trust-anchor-file = "/var/lib/unbound/root.key";
};
};
};
users = {
users = {
unbound = {
uid = config.vhack.constants.ids.uids.unbound;
group = "unbound";
};
};
groups = {
unbound = {
gid = config.vhack.constants.ids.gids.unbound;
};
};
};
};
}
|