diff options
Diffstat (limited to 'config/networking/services/firewall')
| -rw-r--r-- | config/networking/services/firewall/ruleset.nix | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/config/networking/services/firewall/ruleset.nix b/config/networking/services/firewall/ruleset.nix index 83a1f08..5e6cc06 100644 --- a/config/networking/services/firewall/ruleset.nix +++ b/config/networking/services/firewall/ruleset.nix @@ -5,8 +5,8 @@ let sonos-play1 sonos-move ; - inherit (interfaces.all.wan.machines) - hephaistos + inherit (interfaces.all.enp2s0.machines) + hermaphroditos ; }; makeTable = @@ -140,6 +140,7 @@ in wan_in.rules = with rulesCommon; dns + dhcp + ssh + ssdp; iot_in.rules = with rulesCommon; dns + dhcp + igmp; guest_in.rules = with rulesCommon; dns + dhcp; + enp2s0_in.rules = with rulesCommon; dns + dhcp; enp3s0_in.rules = with rulesCommon; dns + dhcp; input = makeBaseChain "filter" "input" { rules = @@ -151,6 +152,7 @@ in , wan : goto wan_in \ , iot : goto iot_in \ , guest : goto guest_in \ + , enp2s0 : goto enp2s0_in \ , enp3s0 : goto enp3s0_in } ''; }; @@ -162,6 +164,7 @@ in meta iifname wan accept ip daddr != { 192.168.0.0-192.168.255.255, 172.16.0.0-172.31.255.255 } accept ''; + server.rules = with rulesCommon; ssh + http; forward = makeBaseChain "filter" "forward" { rules = with rulesCommon; @@ -170,7 +173,10 @@ in '' + conntrack + '' - meta oifname ppp0 goto extranet + meta oifname ppp0 \ + goto extranet + meta iifname { ppp0, wan } oifname enp2s0 \ + goto server meta iifname . meta oifname vmap \ { wan . iot : goto wan_iot \ , iot . wan : goto iot_wan \ @@ -182,6 +188,19 @@ in }; nat = makeTable { chains = { + prerouting = makeBaseChain "nat" "prerouting" { + priority = "dstnat"; + policy = "accept"; + rules = '' + meta oif != 0 accept + meta iifname != ppp0 accept + ip protocol igmp \ + dnat to ${machines.hermaphroditos.ip} + ip protocol tcp \ + tcp dport { 80, 443 } \ + dnat to ${machines.hermaphroditos.ip} + ''; + }; postrouting = makeBaseChain "nat" "postrouting" { priority = "srcnat"; policy = "accept"; |
