diff options
| author | Caroline Larimore <caroline@larimo.re> | 2026-03-03 20:51:31 -0800 |
|---|---|---|
| committer | Caroline Larimore <caroline@larimo.re> | 2026-03-03 20:51:31 -0800 |
| commit | 109565579735b6f066b3b1a1252fd7857df526ec (patch) | |
| tree | cd0802d5b08f3e1d1b1429c87fae7373ef4ec524 /modules | |
| parent | d3ab30e2219f8ee17631827e28992ce98cec6db4 (diff) | |
unbound: initial setup
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/nixos/services/unbound/default.nix | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/modules/nixos/services/unbound/default.nix b/modules/nixos/services/unbound/default.nix new file mode 100644 index 0000000..a926b55 --- /dev/null +++ b/modules/nixos/services/unbound/default.nix @@ -0,0 +1,55 @@ +{ options, config, lib, namespace, pkgs, ... }: + +with lib; with lib.${namespace}; let + cfg = config.${namespace}.services.unbound; + impermanence = config.${namespace}.system.impermanence; +in { + options.${namespace}.services.unbound = with types; { + enable = mkEnableOption "unbound dns server"; + }; + + config = mkIf cfg.enable { + networking.firewall.allowedTCPPorts = [ 53 ]; + networking.firewall.allowedUDPPorts = [ 53 ]; + + services.unbound = { + enable = true; + settings = { + server = { + logfile = "unbound.log"; + verbosity = 3; + + interface = [ + "0.0.0.0" + "::0" + ]; + access-control = [ + "10.0.0.0/8 allow" + "192.168.0.0/16 allow" + "2001:DB8::/64 allow" + ]; + + do-not-query-localhost = false; + + local-zone = ''"cxl.sh." redirect''; + local-data = [ + ''"cxl.sh. 30 IN A 192.168.254.11"'' + ]; + }; + + forward-zone = [{ + name = "."; + # sobbing + # forward-addr = [ + # "1.1.1.1@853#cloudflare-dns.com" + # "1.0.0.1@853#cloudflare-dns.com" + # ]; + forward-addr = [ + "1.1.1.1" + "1.0.0.1" + ]; + }]; + }; + }; + }; +} |