mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 20:09:07 +01:00
dns: Disable forwarding and resolve all requests yourself
This commit is contained in:
parent
56c7b22bf1
commit
3df7d8f5f0
1 changed files with 21 additions and 33 deletions
|
|
@ -16,41 +16,29 @@ in
|
|||
unbound = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
server = {
|
||||
interface = [ netCfg.overlay.interface ];
|
||||
access-control = [
|
||||
"${toString netCfg.overlay.networkCidr} allow"
|
||||
];
|
||||
settings.server = {
|
||||
interface = [ netCfg.overlay.interface ];
|
||||
access-control = [ "${toString netCfg.overlay.networkCidr} allow" ];
|
||||
|
||||
local-zone = "\"${netCfg.overlay.domain}.\" static";
|
||||
local-data =
|
||||
let
|
||||
nodeRecords =
|
||||
netCfg.nodes
|
||||
|> lib.map (node: "\"${node.hostName}.${node.overlay.domain}. A ${node.overlay.address}\"");
|
||||
serviceRecords =
|
||||
self.nixosConfigurations
|
||||
local-zone = "\"${netCfg.overlay.domain}.\" static";
|
||||
local-data =
|
||||
let
|
||||
nodeRecords =
|
||||
netCfg.nodes
|
||||
|> lib.map (node: "\"${node.hostName}.${node.overlay.domain}. A ${node.overlay.address}\"");
|
||||
serviceRecords =
|
||||
self.nixosConfigurations
|
||||
|> lib.attrValues
|
||||
|> lib.concatMap (
|
||||
host:
|
||||
host.config.custom.services.caddy.virtualHosts
|
||||
|> lib.attrValues
|
||||
|> lib.concatMap (
|
||||
host:
|
||||
host.config.custom.services.caddy.virtualHosts
|
||||
|> lib.attrValues
|
||||
|> lib.map (vHost: vHost.domain)
|
||||
|> lib.filter (domain: self.lib.isPrivateDomain domain)
|
||||
|> lib.map (domain: "\"${domain}. A ${host.config.custom.networking.overlay.address}\"")
|
||||
);
|
||||
in
|
||||
nodeRecords ++ serviceRecords;
|
||||
};
|
||||
|
||||
forward-zone = lib.singleton {
|
||||
name = ".";
|
||||
forward-addr = [
|
||||
"1.1.1.1"
|
||||
"8.8.8.8"
|
||||
];
|
||||
};
|
||||
|> lib.map (vHost: vHost.domain)
|
||||
|> lib.filter (domain: self.lib.isPrivateDomain domain)
|
||||
|> lib.map (domain: "\"${domain}. A ${host.config.custom.networking.overlay.address}\"")
|
||||
);
|
||||
in
|
||||
nodeRecords ++ serviceRecords;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue