mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 21:19: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
|
||||
|> lib.attrValues
|
||||
|> 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 {
|
||||
|
|
|
|||
|
|
@ -58,18 +58,24 @@ let
|
|||
};
|
||||
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 {
|
||||
services = {
|
||||
nsd = {
|
||||
enable = true;
|
||||
interfaces = [ netCfg.overlay.interface ];
|
||||
interfaces = [ "${netCfg.overlay.address}@${toString cfg.port}" ];
|
||||
zones.${netCfg.overlay.domain}.data = zoneData;
|
||||
};
|
||||
|
||||
nebula.networks.mesh.firewall.inbound = lib.singleton {
|
||||
port = 53;
|
||||
inherit (cfg) port;
|
||||
proto = "any";
|
||||
host = "any";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -66,6 +66,10 @@ in
|
|||
{
|
||||
options.custom.services.public-nameserver = {
|
||||
enable = lib.mkEnableOption "";
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 53;
|
||||
};
|
||||
zones = lib.mkOption {
|
||||
type = lib.types.nonEmptyListOf lib.types.nonEmptyStr;
|
||||
default = [ ];
|
||||
|
|
@ -73,14 +77,9 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 53 ];
|
||||
allowedUDPPorts = [ 53 ];
|
||||
};
|
||||
|
||||
services.nsd = {
|
||||
enable = true;
|
||||
interfaces = [ netCfg.underlay.interface ];
|
||||
interfaces = [ "${netCfg.underlay.address}@${toString cfg.port}" ];
|
||||
zones =
|
||||
cfg.zones
|
||||
|> lib.map (zone: {
|
||||
|
|
@ -89,5 +88,10 @@ in
|
|||
})
|
||||
|> lib.listToAttrs;
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ cfg.port ];
|
||||
allowedUDPPorts = [ cfg.port ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue