diff options
Diffstat (limited to '')
| -rw-r--r-- | modules/by-name/ns/nsd/module.nix (renamed from modules/by-name/dn/dns/module.nix) | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/modules/by-name/dn/dns/module.nix b/modules/by-name/ns/nsd/module.nix index c429bba..816cc7a 100644 --- a/modules/by-name/dn/dns/module.nix +++ b/modules/by-name/ns/nsd/module.nix @@ -3,7 +3,7 @@ lib, ... }: let - cfg = config.vhack.dns; + cfg = config.vhack.nsd; localInterface = "127.0.0.1@5353"; @@ -47,8 +47,8 @@ in lib.unique (parsePorts cfg.interfaces); in { - options.vhack.dns = { - enable = lib.mkEnableOption "custom dns server"; + options.vhack.nsd = { + enable = lib.mkEnableOption "nsd, a authoritative dns server"; openFirewall = lib.mkOption { type = lib.types.bool; @@ -79,34 +79,11 @@ in { }; config = lib.mkIf cfg.enable { - vhack.persist.directories = [ - { - directory = "/var/lib/unbound"; - user = "unbound"; - group = "unbound"; - mode = "0700"; - } - ]; - - # Use unbound for resolving all local DNS queries. - # unbounds also has the upside to verify DNSSEC. services.unbound = { - enable = true; - stateDir = "/var/lib/unbound"; - resolveLocalQueries = true; settings = { server = { + # Otherwise, unbound will never ask the local nsd via the stub zones. do-not-query-localhost = false; - - 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"; }; # Forward queries for in our zones to the local nsd. @@ -119,12 +96,12 @@ in { }; }; - # Use nsd to serve our own zone files, with the configured NS record pointing to the - # servers ip address. services.nsd = { enable = true; verbosity = 4; - interfaces = [localInterface] ++ cfg.interfaces; + interfaces = + (lib.lists.optionals config.vhack.unbound.enable [localInterface]) + ++ cfg.interfaces; inherit zones; }; @@ -140,13 +117,5 @@ in { "network-online.target" ]; }; - users = { - users = { - "unbound".uid = config.vhack.constants.ids.uids.unbound; - }; - groups = { - "unbound".gid = config.vhack.constants.ids.gids.unbound; - }; - }; }; } |
