Blame SOURCES/0015-tests-firewall-cmd-Coverage-for-interface-wildcardin.patch

c8bceb
From 9b204ffe814f6e37f83eed328a0225b8ac8156bb Mon Sep 17 00:00:00 2001
c8bceb
From: Eric Garver <e@erig.me>
c8bceb
Date: Mon, 17 Dec 2018 12:42:16 -0500
c8bceb
Subject: [PATCH 15/23] tests/firewall-cmd: Coverage for interface wildcarding
c8bceb
c8bceb
Coverage for rhbz 1644025.
c8bceb
c8bceb
(cherry picked from commit e3f936080ff57884df20b5def241593eecb10364)
c8bceb
---
c8bceb
 src/tests/firewall-cmd.at | 28 ++++++++++++++++++++++++++++
c8bceb
 1 file changed, 28 insertions(+)
c8bceb
c8bceb
diff --git a/src/tests/firewall-cmd.at b/src/tests/firewall-cmd.at
c8bceb
index 3cb3e8a96ca7..bdd0287ebb01 100644
c8bceb
--- a/src/tests/firewall-cmd.at
c8bceb
+++ b/src/tests/firewall-cmd.at
c8bceb
@@ -115,6 +115,8 @@ FWD_START_TEST([zone interfaces])
c8bceb
 ])
c8bceb
     FWD_CHECK([--permanent --zone=public --remove-interface=perm_dummy], 0, ignore)
c8bceb
     FWD_CHECK([--permanent --zone=public --query-interface perm_dummy], 1, ignore)
c8bceb
+    FWD_CHECK([--permanent --zone=trusted --remove-interface=perm_dummy2], 0, ignore)
c8bceb
+    FWD_RELOAD
c8bceb
 
c8bceb
     FWD_CHECK([--add-interface=foo], 0, ignore)
c8bceb
     FWD_CHECK([--add-interface=bar --zone=public], 0, ignore)
c8bceb
@@ -128,6 +130,32 @@ FWD_START_TEST([zone interfaces])
c8bceb
     FWD_CHECK([--set-default-zone=public], 0, ignore)
c8bceb
     FWD_CHECK([--remove-interface=foo], 0, ignore)
c8bceb
     FWD_CHECK([--remove-interface=bar], 0, ignore)
c8bceb
+
c8bceb
+    dnl exercise wildcards, rhbz 1644025
c8bceb
+    dnl Note: This feature is undocumented, because it's a possible security
c8bceb
+    dnl risk.
c8bceb
+    FWD_CHECK([--zone=trusted --add-interface=+], 0, ignore)
c8bceb
+    FWD_CHECK([--add-interface=foobar+++], 0, ignore)
c8bceb
+    FWD_CHECK([--add-interface=foobar+], 0, ignore)
c8bceb
+    m4_if(nftables, FIREWALL_BACKEND, [
c8bceb
+    NFT_LIST_RULES([inet], [filter_INPUT_ZONES], 0, [dnl
c8bceb
+        table inet firewalld {
c8bceb
+        chain filter_INPUT_ZONES {
c8bceb
+            iifname "foobar*" goto filter_IN_public
c8bceb
+            iifname "foobar++*" goto filter_IN_public
c8bceb
+            jump filter_IN_trusted
c8bceb
+            iifname "perm_dummy" goto filter_IN_work
c8bceb
+            iifname "perm_dummy2" jump filter_IN_trusted
c8bceb
+            goto filter_IN_public
c8bceb
+        }
c8bceb
+        }
c8bceb
+    ])])
c8bceb
+    FWD_CHECK([--zone=trusted --remove-interface=+], 0, ignore)
c8bceb
+    FWD_CHECK([--remove-interface=foobar+++], 0, ignore)
c8bceb
+    FWD_CHECK([--remove-interface=foobar+], 0, ignore)
c8bceb
+    FWD_CHECK([--permanent --add-interface=foobar+], 0, ignore)
c8bceb
+    FWD_CHECK([--permanent --remove-interface=foobar+], 0, ignore)
c8bceb
+    FWD_RELOAD
c8bceb
 FWD_END_TEST([-e '/ERROR: ZONE_CONFLICT: perm_dummy/d'])
c8bceb
 
c8bceb
 FWD_START_TEST([zone sources])
c8bceb
-- 
c8bceb
2.20.1
c8bceb