mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 15:29:07 +01:00
nameservers: Specify ports
This commit is contained in:
parent
7fcbc3dcad
commit
2aba83de58
3 changed files with 23 additions and 10 deletions
|
|
@ -64,7 +64,10 @@ in
|
||||||
allHosts
|
allHosts
|
||||||
|> lib.attrValues
|
|> lib.attrValues
|
||||||
|> lib.filter (host: host.config.custom.services.private-nameserver.enable)
|
|> lib.filter (host: host.config.custom.services.private-nameserver.enable)
|
||||||
|> lib.map (host: host.config.custom.networking.overlay.address);
|
|> lib.map (
|
||||||
|
host:
|
||||||
|
"${host.config.custom.networking.overlay.address}:${toString host.config.custom.services.private-nameserver.port}"
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
implementation = lib.mkOption {
|
implementation = lib.mkOption {
|
||||||
|
|
|
||||||
|
|
@ -58,18 +58,24 @@ let
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.custom.services.private-nameserver.enable = lib.mkEnableOption "";
|
options.custom.services.private-nameserver = {
|
||||||
|
enable = lib.mkEnableOption "";
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 5335;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
services = {
|
services = {
|
||||||
nsd = {
|
nsd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interfaces = [ netCfg.overlay.interface ];
|
interfaces = [ "${netCfg.overlay.address}@${toString cfg.port}" ];
|
||||||
zones.${netCfg.overlay.domain}.data = zoneData;
|
zones.${netCfg.overlay.domain}.data = zoneData;
|
||||||
};
|
};
|
||||||
|
|
||||||
nebula.networks.mesh.firewall.inbound = lib.singleton {
|
nebula.networks.mesh.firewall.inbound = lib.singleton {
|
||||||
port = 53;
|
inherit (cfg) port;
|
||||||
proto = "any";
|
proto = "any";
|
||||||
host = "any";
|
host = "any";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,10 @@ in
|
||||||
{
|
{
|
||||||
options.custom.services.public-nameserver = {
|
options.custom.services.public-nameserver = {
|
||||||
enable = lib.mkEnableOption "";
|
enable = lib.mkEnableOption "";
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 53;
|
||||||
|
};
|
||||||
zones = lib.mkOption {
|
zones = lib.mkOption {
|
||||||
type = lib.types.nonEmptyListOf lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyListOf lib.types.nonEmptyStr;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
|
|
@ -73,14 +77,9 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
networking.firewall = {
|
|
||||||
allowedTCPPorts = [ 53 ];
|
|
||||||
allowedUDPPorts = [ 53 ];
|
|
||||||
};
|
|
||||||
|
|
||||||
services.nsd = {
|
services.nsd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interfaces = [ netCfg.underlay.interface ];
|
interfaces = [ "${netCfg.underlay.address}@${toString cfg.port}" ];
|
||||||
zones =
|
zones =
|
||||||
cfg.zones
|
cfg.zones
|
||||||
|> lib.map (zone: {
|
|> lib.map (zone: {
|
||||||
|
|
@ -89,5 +88,10 @@ in
|
||||||
})
|
})
|
||||||
|> lib.listToAttrs;
|
|> lib.listToAttrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [ cfg.port ];
|
||||||
|
allowedUDPPorts = [ cfg.port ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue