133 lines
4.3 KiB
Diff
133 lines
4.3 KiB
Diff
From ff17d85fd863e7be2b4088c92360185aca6693b0 Mon Sep 17 00:00:00 2001
|
|
From: Eric Garver <eric@garver.life>
|
|
Date: Thu, 7 Nov 2019 08:21:52 -0500
|
|
Subject: [PATCH] fix: CLI: service: also output helpers for service info
|
|
|
|
Fixes: 0c07b704f76d ("feat: CLI: add "helper" support for services")
|
|
Fixes: rhbz 1769520
|
|
(cherry picked from commit 6bfffe65f55b727afc37a8c1fb4068f6589bb890)
|
|
---
|
|
src/firewall/command.py | 2 ++
|
|
src/tests/features/helpers_custom.at | 42 ++++++++++++++++++++++++++-
|
|
src/tests/features/service_include.at | 3 ++
|
|
3 files changed, 46 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/firewall/command.py b/src/firewall/command.py
|
|
index 85e58d731a80..c371dc23584c 100644
|
|
--- a/src/firewall/command.py
|
|
+++ b/src/firewall/command.py
|
|
@@ -449,6 +449,7 @@ class FirewallCommand(object):
|
|
destinations = settings.getDestinations()
|
|
short_description = settings.getShort()
|
|
includes = settings.getIncludes()
|
|
+ helpers = settings.getHelpers()
|
|
self.print_msg(service)
|
|
if self.verbose:
|
|
self.print_msg(" summary: " + short_description)
|
|
@@ -464,6 +465,7 @@ class FirewallCommand(object):
|
|
" ".join(["%s:%s" % (k, v)
|
|
for k, v in destinations.items()]))
|
|
self.print_msg(" includes: " + " ".join(sorted(includes)))
|
|
+ self.print_msg(" helpers: " + " ".join(sorted(helpers)))
|
|
|
|
def print_icmptype_info(self, icmptype, settings):
|
|
destinations = settings.getDestinations()
|
|
diff --git a/src/tests/features/helpers_custom.at b/src/tests/features/helpers_custom.at
|
|
index c65f067a06ec..4c9024d1e2b8 100644
|
|
--- a/src/tests/features/helpers_custom.at
|
|
+++ b/src/tests/features/helpers_custom.at
|
|
@@ -1,5 +1,5 @@
|
|
FWD_START_TEST([customer helpers])
|
|
-AT_KEYWORDS(helpers rhbz1733066 gh514)
|
|
+AT_KEYWORDS(helpers rhbz1733066 gh514 rhbz1769520)
|
|
|
|
FWD_CHECK([-q --permanent --new-helper="ftptest" --module="nf_conntrack_ftp"])
|
|
FWD_CHECK([-q --permanent --helper=ftptest --add-port="2121/tcp"])
|
|
@@ -8,7 +8,27 @@ FWD_CHECK([-q --permanent --new-service="ftptest"])
|
|
FWD_CHECK([-q --permanent --service=ftptest --add-module="ftptest"])
|
|
FWD_CHECK([-q --permanent --service=ftptest --query-module="ftptest"])
|
|
FWD_CHECK([-q --permanent --service=ftptest --add-port="2121/tcp"])
|
|
+FWD_CHECK([--permanent --info-service=ftptest | TRIM_WHITESPACE], 0, [m4_strip([dnl
|
|
+ftptest
|
|
+ ports: 2121/tcp
|
|
+ protocols:
|
|
+ source-ports:
|
|
+ modules: ftptest
|
|
+ destination:
|
|
+ includes:
|
|
+ helpers:
|
|
+])])
|
|
FWD_RELOAD
|
|
+FWD_CHECK([--info-service=ftptest | TRIM_WHITESPACE], 0, [m4_strip([dnl
|
|
+ftptest
|
|
+ ports: 2121/tcp
|
|
+ protocols:
|
|
+ source-ports:
|
|
+ modules: ftptest
|
|
+ destination:
|
|
+ includes:
|
|
+ helpers:
|
|
+])])
|
|
|
|
FWD_CHECK([-q --add-service=ftptest])
|
|
|
|
@@ -42,7 +62,27 @@ dnl Same thing as above, but with the new "helper" in service.
|
|
FWD_CHECK([-q --permanent --service=ftptest --remove-module="ftptest"])
|
|
FWD_CHECK([-q --permanent --service=ftptest --query-module="ftptest"], 1)
|
|
FWD_CHECK([-q --permanent --service=ftptest --add-helper="ftptest"])
|
|
+FWD_CHECK([--permanent --info-service=ftptest | TRIM_WHITESPACE], 0, [m4_strip([dnl
|
|
+ftptest
|
|
+ ports: 2121/tcp
|
|
+ protocols:
|
|
+ source-ports:
|
|
+ modules:
|
|
+ destination:
|
|
+ includes:
|
|
+ helpers: ftptest
|
|
+])])
|
|
FWD_RELOAD
|
|
+FWD_CHECK([--info-service=ftptest | TRIM_WHITESPACE], 0, [m4_strip([dnl
|
|
+ftptest
|
|
+ ports: 2121/tcp
|
|
+ protocols:
|
|
+ source-ports:
|
|
+ modules:
|
|
+ destination:
|
|
+ includes:
|
|
+ helpers: ftptest
|
|
+])])
|
|
|
|
FWD_CHECK([-q --add-service=ftptest])
|
|
|
|
diff --git a/src/tests/features/service_include.at b/src/tests/features/service_include.at
|
|
index 219d5b42767b..7f02701a9419 100644
|
|
--- a/src/tests/features/service_include.at
|
|
+++ b/src/tests/features/service_include.at
|
|
@@ -76,6 +76,7 @@ my-service-with-include
|
|
modules:
|
|
destination:
|
|
includes: mdns recursive-service ssdp
|
|
+ helpers:
|
|
])])
|
|
FWD_CHECK([--info-service=my-service-with-include | TRIM_WHITESPACE], 0, [m4_strip([dnl
|
|
my-service-with-include
|
|
@@ -85,6 +86,7 @@ my-service-with-include
|
|
modules:
|
|
destination:
|
|
includes: mdns recursive-service ssdp
|
|
+ helpers:
|
|
])])
|
|
|
|
dnl firewall-offline-cmd
|
|
@@ -106,6 +108,7 @@ my-service-with-include
|
|
modules:
|
|
destination:
|
|
includes: mdns recursive-service ssdp
|
|
+ helpers:
|
|
])])
|
|
|
|
dnl negative test for including service that doesn't exist
|
|
--
|
|
2.23.0
|
|
|