|
|
8a3219 |
From 86d498cfd51b8a89d90a639951ff392671a5364b Mon Sep 17 00:00:00 2001
|
|
|
8a3219 |
From: Eric Garver <eric@garver.life>
|
|
|
8a3219 |
Date: Thu, 13 Jun 2019 12:08:52 -0400
|
|
|
8a3219 |
Subject: [PATCH 02/20] fix: CLI: show service includes with --info-service
|
|
|
8a3219 |
|
|
|
8a3219 |
Fixes: rhbz 1720300
|
|
|
8a3219 |
(cherry picked from commit 36c49fc5a0ec531ad8268347f1f511e6740c9e0c)
|
|
|
8a3219 |
---
|
|
|
8a3219 |
src/firewall/command.py | 2 ++
|
|
|
8a3219 |
src/tests/features/service_include.at | 29 ++++++++++++++++++++++++++-
|
|
|
8a3219 |
2 files changed, 30 insertions(+), 1 deletion(-)
|
|
|
8a3219 |
|
|
|
8a3219 |
diff --git a/src/firewall/command.py b/src/firewall/command.py
|
|
|
8a3219 |
index 1449b6dfc3ea..85e58d731a80 100644
|
|
|
8a3219 |
--- a/src/firewall/command.py
|
|
|
8a3219 |
+++ b/src/firewall/command.py
|
|
|
8a3219 |
@@ -448,6 +448,7 @@ class FirewallCommand(object):
|
|
|
8a3219 |
description = settings.getDescription()
|
|
|
8a3219 |
destinations = settings.getDestinations()
|
|
|
8a3219 |
short_description = settings.getShort()
|
|
|
8a3219 |
+ includes = settings.getIncludes()
|
|
|
8a3219 |
self.print_msg(service)
|
|
|
8a3219 |
if self.verbose:
|
|
|
8a3219 |
self.print_msg(" summary: " + short_description)
|
|
|
8a3219 |
@@ -462,6 +463,7 @@ class FirewallCommand(object):
|
|
|
8a3219 |
self.print_msg(" destination: " +
|
|
|
8a3219 |
" ".join(["%s:%s" % (k, v)
|
|
|
8a3219 |
for k, v in destinations.items()]))
|
|
|
8a3219 |
+ self.print_msg(" includes: " + " ".join(sorted(includes)))
|
|
|
8a3219 |
|
|
|
8a3219 |
def print_icmptype_info(self, icmptype, settings):
|
|
|
8a3219 |
destinations = settings.getDestinations()
|
|
|
8a3219 |
diff --git a/src/tests/features/service_include.at b/src/tests/features/service_include.at
|
|
|
8a3219 |
index 992c5ef0ba92..0bf59f63b81b 100644
|
|
|
8a3219 |
--- a/src/tests/features/service_include.at
|
|
|
8a3219 |
+++ b/src/tests/features/service_include.at
|
|
|
8a3219 |
@@ -1,5 +1,5 @@
|
|
|
8a3219 |
FWD_START_TEST([service include])
|
|
|
8a3219 |
-AT_KEYWORDS(service xml gh273)
|
|
|
8a3219 |
+AT_KEYWORDS(service xml gh273 rhbz1720300)
|
|
|
8a3219 |
|
|
|
8a3219 |
AT_CHECK([mkdir -p ./services])
|
|
|
8a3219 |
AT_CHECK([cat <<HERE > ./services/my-service-with-include.xml
|
|
|
8a3219 |
@@ -68,6 +68,24 @@ AT_CHECK([grep '<include service="ssh"/>' ./services/my-service-with-include.xml
|
|
|
8a3219 |
FWD_CHECK([--permanent --service=my-service-with-include --get-includes], 0, [dnl
|
|
|
8a3219 |
mdns recursive-service ssdp
|
|
|
8a3219 |
])
|
|
|
8a3219 |
+FWD_CHECK([--permanent --info-service=my-service-with-include | TRIM_WHITESPACE], 0, [m4_strip([dnl
|
|
|
8a3219 |
+my-service-with-include
|
|
|
8a3219 |
+ ports: 12345/tcp
|
|
|
8a3219 |
+ protocols:
|
|
|
8a3219 |
+ source-ports:
|
|
|
8a3219 |
+ modules:
|
|
|
8a3219 |
+ destination:
|
|
|
8a3219 |
+ includes: mdns recursive-service ssdp
|
|
|
8a3219 |
+])])
|
|
|
8a3219 |
+FWD_CHECK([--info-service=my-service-with-include | TRIM_WHITESPACE], 0, [m4_strip([dnl
|
|
|
8a3219 |
+my-service-with-include
|
|
|
8a3219 |
+ ports: 12345/tcp
|
|
|
8a3219 |
+ protocols:
|
|
|
8a3219 |
+ source-ports:
|
|
|
8a3219 |
+ modules:
|
|
|
8a3219 |
+ destination:
|
|
|
8a3219 |
+ includes: mdns recursive-service ssdp
|
|
|
8a3219 |
+])])
|
|
|
8a3219 |
|
|
|
8a3219 |
dnl firewall-offline-cmd
|
|
|
8a3219 |
FWD_OFFLINE_CHECK([--service=my-service-with-include --query-include=recursive-service], 0, [ignore], [ignore])
|
|
|
8a3219 |
@@ -80,6 +98,15 @@ AT_CHECK([grep '<include service="ssh"/>' ./services/my-service-with-include.xml
|
|
|
8a3219 |
FWD_OFFLINE_CHECK([--service=my-service-with-include --get-includes], 0, [dnl
|
|
|
8a3219 |
mdns recursive-service ssdp
|
|
|
8a3219 |
])
|
|
|
8a3219 |
+FWD_OFFLINE_CHECK([--info-service=my-service-with-include | TRIM_WHITESPACE], 0, [m4_strip([dnl
|
|
|
8a3219 |
+my-service-with-include
|
|
|
8a3219 |
+ ports: 12345/tcp
|
|
|
8a3219 |
+ protocols:
|
|
|
8a3219 |
+ source-ports:
|
|
|
8a3219 |
+ modules:
|
|
|
8a3219 |
+ destination:
|
|
|
8a3219 |
+ includes: mdns recursive-service ssdp
|
|
|
8a3219 |
+])])
|
|
|
8a3219 |
|
|
|
8a3219 |
dnl negative test for including service that doesn't exist
|
|
|
8a3219 |
FWD_CHECK([-q --permanent --zone=drop --add-interface=foobar0])
|
|
|
8a3219 |
--
|
|
|
8a3219 |
2.20.1
|
|
|
8a3219 |
|