run nixfmt
This commit is contained in:
@@ -1,19 +1,48 @@
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
services = {
|
||||
ssh = { tcp = [ 22 ]; };
|
||||
dhcp = { udp = [ 67 68 ]; };
|
||||
dns = { udp = [ 53 853 ]; tcp = [ 53 853 ]; };
|
||||
web = { tcp = [ 80 443 ]; };
|
||||
ssh = {
|
||||
tcp = [ 22 ];
|
||||
};
|
||||
dhcp = {
|
||||
udp = [
|
||||
67
|
||||
68
|
||||
];
|
||||
};
|
||||
dns = {
|
||||
udp = [
|
||||
53
|
||||
853
|
||||
];
|
||||
tcp = [
|
||||
53
|
||||
853
|
||||
];
|
||||
};
|
||||
web = {
|
||||
tcp = [
|
||||
80
|
||||
443
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
rulesForServices = enabledServices:
|
||||
rulesForServices =
|
||||
enabledServices:
|
||||
lib.foldr
|
||||
(service: { allowedUDPPorts, allowedTCPPorts }: {
|
||||
allowedUDPPorts = allowedUDPPorts ++ services.${service}.udp or [ ];
|
||||
allowedTCPPorts = allowedTCPPorts ++ services.${service}.tcp or [ ];
|
||||
})
|
||||
{ allowedUDPPorts = [ ]; allowedTCPPorts = [ ]; }
|
||||
(
|
||||
service:
|
||||
{ allowedUDPPorts, allowedTCPPorts }:
|
||||
{
|
||||
allowedUDPPorts = allowedUDPPorts ++ services.${service}.udp or [ ];
|
||||
allowedTCPPorts = allowedTCPPorts ++ services.${service}.tcp or [ ];
|
||||
}
|
||||
)
|
||||
{
|
||||
allowedUDPPorts = [ ];
|
||||
allowedTCPPorts = [ ];
|
||||
}
|
||||
enabledServices;
|
||||
|
||||
cfg = config.modules.firewall;
|
||||
|
||||
Reference in New Issue
Block a user