Blame SOURCES/0002-RHEL-only-default-to-AllowZoneDrifting-yes.patch

8072fb
From 42c3c63410d53f1f1eef8a756202231a7872aafa Mon Sep 17 00:00:00 2001
087194
From: Eric Garver <eric@garver.life>
087194
Date: Tue, 4 Feb 2020 09:12:17 -0500
8072fb
Subject: [PATCH 2/6] RHEL only: default to AllowZoneDrifting=yes
087194
087194
---
087194
 config/firewalld.conf               | 4 ++--
087194
 doc/xml/firewalld.conf.xml          | 2 +-
087194
 doc/xml/firewalld.dbus.xml          | 2 +-
087194
 src/firewall/config/__init__.py.in  | 2 +-
8072fb
 src/tests/cli/firewall-cmd.at       | 8 ++++++++
40251c
 src/tests/dbus/firewalld.conf.at    | 4 ++--
087194
 src/tests/features/rfc3964_ipv4.at  | 4 ++++
087194
 src/tests/functions.at              | 1 +
087194
 src/tests/regression/rhbz1514043.at | 4 ++++
8072fb
 src/tests/regression/rhbz1715977.at | 9 +++++++++
8072fb
 10 files changed, 33 insertions(+), 7 deletions(-)
087194
087194
diff --git a/config/firewalld.conf b/config/firewalld.conf
40251c
index 532f0452212e..f791b2358ab8 100644
087194
--- a/config/firewalld.conf
087194
+++ b/config/firewalld.conf
40251c
@@ -71,5 +71,5 @@ RFC3964_IPv4=yes
087194
 # Note: If "yes" packets will only drift from source based zones to interface
087194
 # based zones (including the default zone). Packets never drift from interface
087194
 # based zones to other interfaces based zones (including the default zone).
087194
-# Possible values; "yes", "no". Defaults to "no".
087194
-AllowZoneDrifting=no
087194
+# Possible values; "yes", "no". Defaults to "yes".
087194
+AllowZoneDrifting=yes
087194
diff --git a/doc/xml/firewalld.conf.xml b/doc/xml/firewalld.conf.xml
40251c
index fcfbfd2b68c1..c21ef87813bc 100644
087194
--- a/doc/xml/firewalld.conf.xml
087194
+++ b/doc/xml/firewalld.conf.xml
087194
@@ -197,7 +197,7 @@
087194
                 to interface based zones (including the default zone). Packets
087194
                 never drift from interface based zones to other interfaces
087194
                 based zones (including the default zone).
087194
-                Valid values; "yes", "no". Defaults to "no".
087194
+                Valid values; "yes", "no". Defaults to "yes".
087194
                 </para>
087194
             </listitem>
087194
         </varlistentry>
087194
diff --git a/doc/xml/firewalld.dbus.xml b/doc/xml/firewalld.dbus.xml
40251c
index 5d77af976443..77ad77c01675 100644
087194
--- a/doc/xml/firewalld.dbus.xml
087194
+++ b/doc/xml/firewalld.dbus.xml
40251c
@@ -2591,7 +2591,7 @@
087194
                 to interface based zones (including the default zone). Packets
087194
                 never drift from interface based zones to other interfaces
087194
                 based zones (including the default zone).
087194
-                Valid values; "yes", "no". Defaults to "no".
087194
+                Valid values; "yes", "no". Defaults to "yes".
087194
             </para></listitem>
087194
           </varlistentry>
087194
           <varlistentry id="FirewallD1.config.Properties.AutomaticHelpers">
087194
diff --git a/src/firewall/config/__init__.py.in b/src/firewall/config/__init__.py.in
40251c
index 481eb8de758d..645c76b66c8d 100644
087194
--- a/src/firewall/config/__init__.py.in
087194
+++ b/src/firewall/config/__init__.py.in
40251c
@@ -130,4 +130,4 @@ FALLBACK_AUTOMATIC_HELPERS = "no"
087194
 FALLBACK_FIREWALL_BACKEND = "nftables"
087194
 FALLBACK_FLUSH_ALL_ON_RELOAD = True
087194
 FALLBACK_RFC3964_IPV4 = True
087194
-FALLBACK_ALLOW_ZONE_DRIFTING = False
087194
+FALLBACK_ALLOW_ZONE_DRIFTING = True
40251c
diff --git a/src/tests/cli/firewall-cmd.at b/src/tests/cli/firewall-cmd.at
8072fb
index 74f480f8730f..c47c14ea1fc2 100644
40251c
--- a/src/tests/cli/firewall-cmd.at
40251c
+++ b/src/tests/cli/firewall-cmd.at
8072fb
@@ -696,6 +696,10 @@ FWD_START_TEST([ipset])
8072fb
     CHECK_IPSET
8072fb
     CHECK_IPSET_HASH_MAC
8072fb
 
8072fb
+    dnl Expected test results assume this is set to "no"
8072fb
+    AT_CHECK([sed -i 's/^AllowZoneDrifting.*/AllowZoneDrifting=no/' ./firewalld.conf])
8072fb
+    FWD_RELOAD
8072fb
+
8072fb
     FWD_CHECK([--permanent --new-ipset=foobar --type=hash:ip], 0, ignore)
8072fb
     FWD_CHECK([--reload], 0, ignore)
8072fb
     FWD_CHECK([--ipset=foobar --get-entries], 0, [
8072fb
@@ -1197,6 +1201,10 @@ FWD_START_TEST([rich rules priority])
40251c
 
40251c
     CHECK_LOG_AUDIT
40251c
 
40251c
+    dnl Expected test results assume this is set to "no"
40251c
+    AT_CHECK([sed -i 's/^AllowZoneDrifting.*/AllowZoneDrifting=no/' ./firewalld.conf])
40251c
+    FWD_RELOAD
40251c
+
40251c
     dnl Verify generic layout of zone
40251c
     NFT_LIST_RULES([inet], [filter_IN_public], 0, [dnl
40251c
         table inet firewalld {
087194
diff --git a/src/tests/dbus/firewalld.conf.at b/src/tests/dbus/firewalld.conf.at
40251c
index 35aead759a9c..4eefa3286f9f 100644
087194
--- a/src/tests/dbus/firewalld.conf.at
087194
+++ b/src/tests/dbus/firewalld.conf.at
40251c
@@ -4,7 +4,7 @@ AT_KEYWORDS(dbus)
087194
 dnl Verify defaults over dbus. Should be inline with default firewalld.conf.
40251c
 IF_HOST_SUPPORTS_NFT_FIB([
40251c
 DBUS_GETALL([config], [config], 0, [dnl
40251c
-string "AllowZoneDrifting" : variant string "no"
40251c
+string "AllowZoneDrifting" : variant string "yes"
40251c
 string "AutomaticHelpers" : variant string "no"
40251c
 string "CleanupOnExit" : variant string "no"
40251c
 string "DefaultZone" : variant string "public"
40251c
@@ -18,7 +18,7 @@ string "MinimalMark" : variant int32 100
40251c
 string "RFC3964_IPv4" : variant string "yes"
40251c
 ])], [
087194
 DBUS_GETALL([config], [config], 0, [dnl
087194
-string "AllowZoneDrifting" : variant string "no"
087194
+string "AllowZoneDrifting" : variant string "yes"
40251c
 string "AutomaticHelpers" : variant string "no"
087194
 string "CleanupOnExit" : variant string "no"
087194
 string "DefaultZone" : variant string "public"
087194
diff --git a/src/tests/features/rfc3964_ipv4.at b/src/tests/features/rfc3964_ipv4.at
087194
index 54f5f756270b..15fef52612cc 100644
087194
--- a/src/tests/features/rfc3964_ipv4.at
087194
+++ b/src/tests/features/rfc3964_ipv4.at
087194
@@ -1,6 +1,10 @@
087194
 FWD_START_TEST([RFC3964_IPv4])
087194
 AT_KEYWORDS(rfc3964_ipv4)
087194
 
087194
+dnl Expected test results assume this is set to "no"
087194
+AT_CHECK([sed -i 's/^AllowZoneDrifting.*/AllowZoneDrifting=no/' ./firewalld.conf])
087194
+FWD_RELOAD
087194
+
087194
 AT_CHECK([sed -i 's/^LogDenied.*/LogDenied=all/' ./firewalld.conf])
087194
 AT_CHECK([sed -i 's/^RFC3964_IPv4.*/RFC3964_IPv4=yes/' ./firewalld.conf])
087194
 FWD_RELOAD
087194
diff --git a/src/tests/functions.at b/src/tests/functions.at
8072fb
index 5b3ed3ee4a5a..8f5ceba4d3f2 100644
087194
--- a/src/tests/functions.at
087194
+++ b/src/tests/functions.at
40251c
@@ -230,6 +230,7 @@ m4_define([FWD_END_TEST], [
40251c
         IF_HOST_SUPPORTS_IP6TABLES([], [
087194
             sed -i "/WARNING: ip6tables not usable, disabling IPv6 firewall/d" ./firewalld.log
087194
         ])
087194
+        sed -i "/WARNING: AllowZoneDrifting is enabled./d" ./firewalld.log
087194
         if test x"$1" != x"ignore"; then
087194
             if test -n "$1"; then
087194
                 sed -i $1 ./firewalld.log
087194
diff --git a/src/tests/regression/rhbz1514043.at b/src/tests/regression/rhbz1514043.at
087194
index 241cf547f7f3..8e4846a078b8 100644
087194
--- a/src/tests/regression/rhbz1514043.at
087194
+++ b/src/tests/regression/rhbz1514043.at
087194
@@ -1,6 +1,10 @@
087194
 FWD_START_TEST([--set-log-denied does not zero config])
087194
 AT_KEYWORDS(log_denied rhbz1514043)
087194
 
087194
+dnl Expected test results assume this is set to "no"
087194
+AT_CHECK([sed -i 's/^AllowZoneDrifting.*/AllowZoneDrifting=no/' ./firewalld.conf])
087194
+FWD_RELOAD
087194
+
087194
 FWD_CHECK([-q --set-log-denied=all])
087194
 FWD_CHECK([-q --permanent --zone=public --add-service=samba])
087194
 FWD_RELOAD
8072fb
diff --git a/src/tests/regression/rhbz1715977.at b/src/tests/regression/rhbz1715977.at
8072fb
index d548de72b90c..b9886e1a0a2b 100644
8072fb
--- a/src/tests/regression/rhbz1715977.at
8072fb
+++ b/src/tests/regression/rhbz1715977.at
8072fb
@@ -14,6 +14,7 @@ NFT_LIST_RULES([inet], [filter_IN_internal_allow], 0, [dnl
8072fb
             udp dport 137 ct state new,untracked accept
8072fb
             udp dport 138 ct state new,untracked accept
8072fb
             ip6 daddr fe80::/64 udp dport 546 ct state new,untracked accept
8072fb
+            tcp dport 9090 ct state new,untracked accept
8072fb
             ip daddr 192.168.122.235 tcp dport 22 ct state new,untracked accept
8072fb
         }
8072fb
     }
8072fb
@@ -23,6 +24,7 @@ IPTABLES_LIST_RULES([filter], [IN_internal_allow], 0, [dnl
8072fb
     ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:137 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:138 ctstate NEW,UNTRACKED
8072fb
+    ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:9090 ctstate NEW,UNTRACKED
8072fb
     ACCEPT tcp -- 0.0.0.0/0 192.168.122.235 tcp dpt:22 ctstate NEW,UNTRACKED
8072fb
 ])
8072fb
 IP6TABLES_LIST_RULES([filter], [IN_internal_allow], 0, [dnl
8072fb
@@ -31,6 +33,7 @@ IP6TABLES_LIST_RULES([filter], [IN_internal_allow], 0, [dnl
8072fb
     ACCEPT udp ::/0 ::/0 udp dpt:137 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp ::/0 ::/0 udp dpt:138 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp ::/0 fe80::/64 udp dpt:546 ctstate NEW,UNTRACKED
8072fb
+    ACCEPT tcp ::/0 ::/0 tcp dpt:9090 ctstate NEW,UNTRACKED
8072fb
 ])
8072fb
 
8072fb
 FWD_CHECK([-q --zone=internal --add-rich-rule='rule family=ipv4 destination address="192.168.111.222/32" source address="10.10.10.0/24" service name="ssh" accept'])
8072fb
@@ -44,6 +47,7 @@ NFT_LIST_RULES([inet], [filter_IN_internal_allow], 0, [dnl
8072fb
             udp dport 137 ct state new,untracked accept
8072fb
             udp dport 138 ct state new,untracked accept
8072fb
             ip6 daddr fe80::/64 udp dport 546 ct state new,untracked accept
8072fb
+            tcp dport 9090 ct state new,untracked accept
8072fb
             ip daddr 192.168.122.235 tcp dport 22 ct state new,untracked accept
8072fb
             ip daddr 192.168.111.222 ip saddr 10.10.10.0/24 tcp dport 22 ct state new,untracked accept
8072fb
         }
8072fb
@@ -54,6 +58,7 @@ IPTABLES_LIST_RULES([filter], [IN_internal_allow], 0, [dnl
8072fb
     ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:137 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:138 ctstate NEW,UNTRACKED
8072fb
+    ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:9090 ctstate NEW,UNTRACKED
8072fb
     ACCEPT tcp -- 0.0.0.0/0 192.168.122.235 tcp dpt:22 ctstate NEW,UNTRACKED
8072fb
     ACCEPT tcp -- 10.10.10.0/24 192.168.111.222 tcp dpt:22 ctstate NEW,UNTRACKED
8072fb
 ])
8072fb
@@ -63,6 +68,7 @@ IP6TABLES_LIST_RULES([filter], [IN_internal_allow], 0, [dnl
8072fb
     ACCEPT udp ::/0 ::/0 udp dpt:137 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp ::/0 ::/0 udp dpt:138 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp ::/0 fe80::/64 udp dpt:546 ctstate NEW,UNTRACKED
8072fb
+    ACCEPT tcp ::/0 ::/0 tcp dpt:9090 ctstate NEW,UNTRACKED
8072fb
 ])
8072fb
 
8072fb
 FWD_CHECK([-q --zone=internal --add-rich-rule='rule family=ipv4 service name="ssdp" accept'])
8072fb
@@ -76,6 +82,7 @@ NFT_LIST_RULES([inet], [filter_IN_internal_allow], 0, [dnl
8072fb
             udp dport 137 ct state new,untracked accept
8072fb
             udp dport 138 ct state new,untracked accept
8072fb
             ip6 daddr fe80::/64 udp dport 546 ct state new,untracked accept
8072fb
+            tcp dport 9090 ct state new,untracked accept
8072fb
             ip daddr 192.168.122.235 tcp dport 22 ct state new,untracked accept
8072fb
             ip daddr 192.168.111.222 ip saddr 10.10.10.0/24 tcp dport 22 ct state new,untracked accept
8072fb
             ip daddr 239.255.255.250 udp dport 1900 ct state new,untracked accept
8072fb
@@ -87,6 +94,7 @@ IPTABLES_LIST_RULES([filter], [IN_internal_allow], 0, [dnl
8072fb
     ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:137 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:138 ctstate NEW,UNTRACKED
8072fb
+    ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:9090 ctstate NEW,UNTRACKED
8072fb
     ACCEPT tcp -- 0.0.0.0/0 192.168.122.235 tcp dpt:22 ctstate NEW,UNTRACKED
8072fb
     ACCEPT tcp -- 10.10.10.0/24 192.168.111.222 tcp dpt:22 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp -- 0.0.0.0/0 239.255.255.250 udp dpt:1900 ctstate NEW,UNTRACKED
8072fb
@@ -97,6 +105,7 @@ IP6TABLES_LIST_RULES([filter], [IN_internal_allow], 0, [dnl
8072fb
     ACCEPT udp ::/0 ::/0 udp dpt:137 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp ::/0 ::/0 udp dpt:138 ctstate NEW,UNTRACKED
8072fb
     ACCEPT udp ::/0 fe80::/64 udp dpt:546 ctstate NEW,UNTRACKED
8072fb
+    ACCEPT tcp ::/0 ::/0 tcp dpt:9090 ctstate NEW,UNTRACKED
8072fb
 ])
8072fb
 
8072fb
 FWD_CHECK([-q --zone=internal --add-rich-rule='rule family=ipv4 destination address="192.168.122.235/32" service name="mdns" accept'], 122, [ignore], [ignore])
087194
-- 
087194
2.23.0
087194