Revert "ruleset: dispatch ct states using verdict map"
[project/firewall4.git] / tests / 01_configuration / 01_ruleset
index cd32edceca5cc584b191758bb43f3b50dd0b16f2..2a0e5df19d04f78b1c54ba8b48080b8892a3f261 100644 (file)
@@ -27,9 +27,11 @@ table inet fw4 {
        flowtable ft {
                hook ingress priority 0;
                devices = { "eth0", "eth1" };
+               counter;
                flags offload;
        }
 
+
        #
        # CT helper definitions
        #
@@ -83,20 +85,17 @@ table inet fw4 {
        }
 
 
-       #
-       # Set definitions
-       #
-
-
        #
        # Defines
        #
 
        define lan_devices = { "br-lan" }
        define lan_subnets = { 10.0.0.0/24, 192.168.26.0/24, 2001:db8:1000::/60, fd63:e2f:f706::/60 }
+
        define wan_devices = { "pppoe-wan" }
        define wan_subnets = { 10.11.12.0/24, 2001:db8:54:321::/64 }
 
+
        #
        # User includes
        #
@@ -109,7 +108,7 @@ table inet fw4 {
        #
 
        chain input {
-               type filter hook input priority filter; policy accept;
+               type filter hook input priority filter; policy drop;
 
                iifname "lo" accept comment "!fw4: Accept traffic from loopback"
 
@@ -117,6 +116,7 @@ table inet fw4 {
                tcp flags & (fin | syn | rst | ack) == syn jump syn_flood comment "!fw4: Rate limit TCP syn packets"
                iifname "br-lan" jump input_lan comment "!fw4: Handle lan IPv4/IPv6 input traffic"
                iifname "pppoe-wan" jump input_wan comment "!fw4: Handle wan IPv4/IPv6 input traffic"
+               jump handle_reject
        }
 
        chain forward {
@@ -142,7 +142,7 @@ table inet fw4 {
 
        chain prerouting {
                type filter hook prerouting priority filter; policy accept;
-               iifname "br-lan" jump helper_lan comment "!fw4: lan IPv4/IPv6 CT helper assignment"
+               iifname "br-lan" jump helper_lan comment "!fw4: Handle lan IPv4/IPv6 helper assignment"
        }
 
        chain handle_reject {
@@ -215,6 +215,7 @@ table inet fw4 {
        }
 
        chain accept_to_wan {
+               meta nfproto ipv4 oifname "pppoe-wan" ct state invalid counter drop comment "!fw4: Prevent NAT leakage"
                oifname "pppoe-wan" counter accept comment "!fw4: accept wan IPv4/IPv6 traffic"
        }
 
@@ -305,6 +306,12 @@ table inet fw4 {
 [!] Section @defaults[0] specifies unknown option 'unknown_defaults_option'
 [!] Section @rule[9] (Test-Deprecated-Rule-Option) option '_name' is deprecated by fw4
 [!] Section @rule[9] (Test-Deprecated-Rule-Option) specifies unknown option 'unknown_rule_option'
+[call] fs.glob pattern </usr/share/nftables.d/ruleset-pre/*.nft>
+[call] fs.glob pattern </usr/share/nftables.d/ruleset-post/*.nft>
+[call] fs.glob pattern </usr/share/nftables.d/table-pre/*.nft>
+[call] fs.glob pattern </usr/share/nftables.d/table-post/*.nft>
+[call] fs.lsdir path </usr/share/nftables.d/chain-pre>
+[call] fs.lsdir path </usr/share/nftables.d/chain-post>
 [call] ctx.call object <network.device> method <status> args <null>
 [call] fs.opendir path </sys/class/net/br-lan>
 [call] fs.opendir path </sys/class/net/eth0>
@@ -318,6 +325,6 @@ table inet fw4 {
                }
        ' 2>/dev/null> timeout <null>
 [call] fs.popen cmdline </usr/sbin/nft --terse --json list flowtables inet> mode <r>
-[call] fs.open path </sys/class/net/br-lan/flags> mode <r>
-[call] fs.open path </sys/class/net/br-lan/flags> mode <r>
+[call] fs.readfile path </sys/class/net/br-lan/flags> limit <null>
+[call] fs.readfile path </sys/class/net/br-lan/flags> limit <null>
 -- End --