mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
feat: automatically generate allowedTCPPorts for mdns enabled
interfaces; simplify nftables rules by adding a general untrusted zone
This commit is contained in:
parent
e37601b486
commit
41df399bb6
14 changed files with 231 additions and 168 deletions
|
@ -89,9 +89,8 @@ in {
|
|||
# TODO mkForce nftables
|
||||
networking.nftables.firewall = {
|
||||
zones = lib.mkForce {
|
||||
untrusted.interfaces = ["wan"];
|
||||
lan.interfaces = ["lan-self"];
|
||||
wan.interfaces = ["wan"];
|
||||
local-vms.interfaces = ["local-vms"];
|
||||
};
|
||||
|
||||
rules = lib.mkForce {
|
||||
|
@ -100,34 +99,24 @@ in {
|
|||
extraLines = ["ip6 nexthdr icmpv6 icmpv6 type { mld-listener-query, nd-router-solicit } accept"];
|
||||
};
|
||||
|
||||
masquerade-wan = {
|
||||
masquerade = {
|
||||
from = ["lan"];
|
||||
to = ["wan"];
|
||||
to = ["untrusted"];
|
||||
masquerade = true;
|
||||
};
|
||||
|
||||
# Rule needed to allow local-vms wireguard traffic
|
||||
lan-to-local = {
|
||||
from = ["lan"];
|
||||
to = ["local"];
|
||||
};
|
||||
|
||||
outbound = {
|
||||
from = ["lan"];
|
||||
to = ["lan" "wan"];
|
||||
to = ["lan" "untrusted"];
|
||||
late = true; # Only accept after any rejects have been processed
|
||||
verdict = "accept";
|
||||
};
|
||||
|
||||
wan-to-local = {
|
||||
from = ["wan"];
|
||||
to = ["local"];
|
||||
};
|
||||
|
||||
lan-to-local = {
|
||||
from = ["lan"];
|
||||
to = ["local"];
|
||||
|
||||
inherit
|
||||
(config.networking.firewall)
|
||||
allowedTCPPorts
|
||||
allowedUDPPorts
|
||||
;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue