|
| 1 | +m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [ |
| 2 | +FWD_START_TEST([config watcher - no trigger]) |
| 3 | +AT_KEYWORDS([watcher RHEL-137602]) |
| 4 | + |
| 5 | +AT_DATA([./zones/trusted.xml.bak], [dnl |
| 6 | +<?xml version="1.0" encoding="utf-8"?> |
| 7 | +<zone target="ACCEPT"> |
| 8 | + <short>Trusted</short> |
| 9 | + <description>All network connections are accepted.</description> |
| 10 | + <forward/> |
| 11 | + <service name="ssh"/> |
| 12 | +</zone> |
| 13 | +]) |
| 14 | +sleep 10 |
| 15 | +FWD_OFFLINE_CHECK([--check-config], 0, [ignore], [ignore]) |
| 16 | + |
| 17 | +FWD_END_TEST() |
| 18 | + |
| 19 | +FWD_START_TEST([config watcher - valid]) |
| 20 | +AT_KEYWORDS([watcher RHEL-137602]) |
| 21 | + |
| 22 | +AT_DATA([./zones/trusted.xml], [dnl |
| 23 | +<?xml version="1.0" encoding="utf-8"?> |
| 24 | +<zone target="ACCEPT"> |
| 25 | + <short>Trusted</short> |
| 26 | + <description>All network connections are accepted.</description> |
| 27 | + <forward/> |
| 28 | + <service name="ssh"/> |
| 29 | +</zone> |
| 30 | +]) |
| 31 | +sleep 10 |
| 32 | +FWD_GREP_LOG([Detected permanent [(]on-disk[)] configuration change out-of-band of firewalld!]) |
| 33 | +FWD_GREP_LOG([To load the new configuration, reload firewalld:]) |
| 34 | +FWD_OFFLINE_CHECK([--check-config], 0, [ignore], [ignore]) |
| 35 | + |
| 36 | +FWD_END_TEST([-e '/Detected permanent.* configuration change/d']) |
| 37 | + |
| 38 | +FWD_START_TEST([config watcher - invalid updated]) |
| 39 | +AT_KEYWORDS([watcher RHEL-137602]) |
| 40 | + |
| 41 | +AT_DATA([./zones/trusted.xml], [dnl |
| 42 | +<?xml version="1.0" encoding="utf-8"?> |
| 43 | +<zone target="ACCEPT"> |
| 44 | + <short>Trusted</short> |
| 45 | + <description>All network connections are accepted.</description> |
| 46 | + <forward/> |
| 47 | + <service name="doesnotexist"/> |
| 48 | +</zone> |
| 49 | +]) |
| 50 | +sleep 10 |
| 51 | +FWD_GREP_LOG([WARNING: Unfortunately, the new configuration cannot be loaded by the running firewalld]) |
| 52 | +FWD_OFFLINE_CHECK([--check-config], 101, [ignore], [ignore]) |
| 53 | + |
| 54 | +FWD_END_TEST([ignore]) |
| 55 | + |
| 56 | +FWD_START_TEST([config watcher - invalid new]) |
| 57 | +AT_KEYWORDS([watcher RHEL-137602]) |
| 58 | + |
| 59 | +AT_DATA([./zones/newzone.xml], [dnl |
| 60 | +<?xml version="1.0" encoding="utf-8"?> |
| 61 | +<zone target="ACCEPT"> |
| 62 | + <short>newzone</short> |
| 63 | + <description>A new zone.</description> |
| 64 | + <service name="doesnotexist"/> |
| 65 | +</zone> |
| 66 | +]) |
| 67 | +sleep 10 |
| 68 | +FWD_GREP_LOG([WARNING: Unfortunately, the new configuration cannot be loaded by the running firewalld]) |
| 69 | +FWD_OFFLINE_CHECK([--check-config], 101, [ignore], [ignore]) |
| 70 | + |
| 71 | +FWD_END_TEST([ignore]) |
| 72 | + |
| 73 | +FWD_START_TEST([config watcher - unsupported updated]) |
| 74 | +AT_KEYWORDS([watcher RHEL-137602]) |
| 75 | + |
| 76 | +AT_DATA([./zones/trusted.xml], [dnl |
| 77 | +<?xml version="1.0" encoding="utf-8"?> |
| 78 | +<zone target="ACCEPT"> |
| 79 | + <short>Trusted</short> |
| 80 | + <description>All network connections are accepted.</description> |
| 81 | + <unsupported/> |
| 82 | +</zone> |
| 83 | +]) |
| 84 | +sleep 10 |
| 85 | +FWD_GREP_LOG([WARNING: Unfortunately, the new configuration cannot be loaded by the running firewalld]) |
| 86 | +FWD_OFFLINE_CHECK([--check-config], 28, [ignore], [ignore]) |
| 87 | + |
| 88 | +FWD_END_TEST([ignore]) |
| 89 | + |
| 90 | +FWD_START_TEST([config watcher - unsupported new]) |
| 91 | +AT_KEYWORDS([watcher RHEL-137602]) |
| 92 | + |
| 93 | +AT_DATA([./zones/newzone.xml], [dnl |
| 94 | +<?xml version="1.0" encoding="utf-8"?> |
| 95 | +<zone target="ACCEPT"> |
| 96 | + <short>newzone</short> |
| 97 | + <description>A new zone.</description> |
| 98 | + <unsupportedtwo/> |
| 99 | +</zone> |
| 100 | +]) |
| 101 | +sleep 10 |
| 102 | +FWD_GREP_LOG([WARNING: Unfortunately, the new configuration cannot be loaded by the running firewalld]) |
| 103 | +FWD_OFFLINE_CHECK([--check-config], 28, [ignore], [ignore]) |
| 104 | + |
| 105 | +FWD_END_TEST([ignore]) |
| 106 | + |
| 107 | +FWD_START_TEST([config watcher - log rate limit]) |
| 108 | +AT_KEYWORDS([watcher RHEL-137602]) |
| 109 | +AT_SKIP_IF([! NS_CMD([which truncate >/dev/null 2>&1])]) |
| 110 | + |
| 111 | +AT_DATA([./zones/trusted.xml], [dnl |
| 112 | +<?xml version="1.0" encoding="utf-8"?> |
| 113 | +<zone target="ACCEPT"> |
| 114 | + <short>Trusted</short> |
| 115 | + <description>All network connections are accepted.</description> |
| 116 | + <forward/> |
| 117 | + <service name="ssh"/> |
| 118 | +</zone> |
| 119 | +]) |
| 120 | +sleep 10 |
| 121 | +FWD_GREP_LOG([Detected permanent [(]on-disk[)] configuration change out-of-band of firewalld!]) |
| 122 | +FWD_GREP_LOG([To load the new configuration, reload firewalld:]) |
| 123 | +FWD_OFFLINE_CHECK([--check-config], 0, [ignore], [ignore]) |
| 124 | + |
| 125 | +dnl Do it again and verify that no new log is generated |
| 126 | +AT_CHECK([truncate -s 0 ./firewalld.log]) |
| 127 | +AT_DATA([./zones/trusted2.xml], [dnl |
| 128 | +<?xml version="1.0" encoding="utf-8"?> |
| 129 | +<zone target="ACCEPT"> |
| 130 | + <short>Trusted 2</short> |
| 131 | + <description>All network connections are accepted.</description> |
| 132 | + <forward/> |
| 133 | +</zone> |
| 134 | +]) |
| 135 | +sleep 10 |
| 136 | +FWD_GREP_LOG([Detected permanent [(]on-disk[)] configuration change out-of-band of firewalld!], [1]) |
| 137 | + |
| 138 | +dnl One last time after a reload which should trigger the log again. |
| 139 | +FWD_RELOAD() |
| 140 | +AT_CHECK([truncate -s 0 ./firewalld.log]) |
| 141 | +AT_DATA([./zones/trusted3.xml], [dnl |
| 142 | +<?xml version="1.0" encoding="utf-8"?> |
| 143 | +<zone target="ACCEPT"> |
| 144 | + <short>Trusted 3</short> |
| 145 | + <description>All network connections are accepted.</description> |
| 146 | + <forward/> |
| 147 | +</zone> |
| 148 | +]) |
| 149 | +sleep 10 |
| 150 | +FWD_GREP_LOG([Detected permanent [(]on-disk[)] configuration change out-of-band of firewalld!]) |
| 151 | + |
| 152 | +FWD_END_TEST([-e '/Detected permanent.* configuration change/d']) |
| 153 | +]) |
0 commit comments