mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/{firewall, nat}: add a nftables based implementation
This commit is contained in:
parent
2379de680d
commit
a43c7b2a70
15 changed files with 1158 additions and 723 deletions
|
@ -53,13 +53,18 @@ in {
|
|||
networking.firewall = mkIf cfg.openFirewall {
|
||||
allowedTCPPortRanges = [{ from = 9100; to = 9200; }];
|
||||
allowedUDPPorts = [ 9003 ];
|
||||
extraCommands = ''
|
||||
extraCommands = optionalString (!config.networking.nftables.enable) ''
|
||||
iptables -A INPUT -s 224.0.0.0/4 -j ACCEPT
|
||||
iptables -A INPUT -d 224.0.0.0/4 -j ACCEPT
|
||||
iptables -A INPUT -s 240.0.0.0/5 -j ACCEPT
|
||||
iptables -A INPUT -m pkttype --pkt-type multicast -j ACCEPT
|
||||
iptables -A INPUT -m pkttype --pkt-type broadcast -j ACCEPT
|
||||
'';
|
||||
extraInputRules = optionalString config.networking.nftables.enable ''
|
||||
ip saddr { 224.0.0.0/4, 240.0.0.0/5 } accept
|
||||
ip daddr 224.0.0.0/4 accept
|
||||
pkttype { multicast, broadcast } accept
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ in {
|
|||
{ from = 30000; to = 30010; }
|
||||
];
|
||||
allowedUDPPorts = [ 9003 ];
|
||||
extraCommands = ''
|
||||
extraCommands = optionalString (!config.networking.nftables.enable) ''
|
||||
## IGMP / Broadcast ##
|
||||
iptables -A INPUT -s 224.0.0.0/4 -j ACCEPT
|
||||
iptables -A INPUT -d 224.0.0.0/4 -j ACCEPT
|
||||
|
@ -66,6 +66,11 @@ in {
|
|||
iptables -A INPUT -m pkttype --pkt-type multicast -j ACCEPT
|
||||
iptables -A INPUT -m pkttype --pkt-type broadcast -j ACCEPT
|
||||
'';
|
||||
extraInputRules = optionalString config.networking.nftables.enable ''
|
||||
ip saddr { 224.0.0.0/4, 240.0.0.0/5 } accept
|
||||
ip daddr 224.0.0.0/4 accept
|
||||
pkttype { multicast, broadcast } accept
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue