nix-configs/nixos-modules/unbound.nix

52 lines
1.1 KiB
Nix
Raw Normal View History

2024-12-31 13:28:56 -05:00
{ config, lib, ... }:
2024-12-29 18:59:34 -05:00
{
2024-12-31 13:28:56 -05:00
options = {
mainInterface = lib.mkOption {
type = lib.types.str;
2024-12-29 18:59:34 -05:00
};
};
2024-12-31 13:28:56 -05:00
config = {
environment.etc."unbound/ads.zone".text = ''
tiktock.com CNAME .
*.tiktock.com CNAME .
iogames.space CNAME .
*.iogames.space CNAME .
taming.io CNAME .
*.taming.io CNAME .
'';
2024-12-29 18:59:34 -05:00
2024-12-31 13:28:56 -05:00
networking = {
firewall = {
allowedUDPPorts = [
53
];
allowedTCPPorts = [ 53 ];
};
2024-12-29 18:59:34 -05:00
};
2024-12-31 13:28:56 -05:00
services = {
unbound = {
enable = true;
localControlSocketPath = "/var/lib/unbound/control.sock";
settings = {
server = {
do-ip6 = "no";
qname-minimisation = "yes";
interface = [ config.mainInterface ];
access-control = [
"10.0.0.0/8 allow"
"fc::/7 allow"
];
};
include = [
"${../configs/unbound-local.conf}"
"${../configs/unbound-threat-zone.conf}"
"${../configs/unbound-local-block.conf}"
2024-12-29 18:59:34 -05:00
];
};
};
};
};
}