From 25f339926fab91982ebfb2bf81e3640a262e1eca Mon Sep 17 00:00:00 2001 From: Alan Moore Date: Mon, 13 Jan 2025 18:04:06 +0000 Subject: [PATCH] Use macro to generate oval listen port parts --- .../mail/has_nonlocal_mta/oval/shared.xml | 63 +++++++++---------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/linux_os/guide/services/mail/has_nonlocal_mta/oval/shared.xml b/linux_os/guide/services/mail/has_nonlocal_mta/oval/shared.xml index 8ab1188ee55..5472925707f 100644 --- a/linux_os/guide/services/mail/has_nonlocal_mta/oval/shared.xml +++ b/linux_os/guide/services/mail/has_nonlocal_mta/oval/shared.xml @@ -1,56 +1,49 @@ +{{% macro generate_criteria_listening_port(port) %}} + +{{% endmacro %}} + {{{ oval_metadata("Verify MTA is not listening on any non-loopback address") }}} - + {{{ generate_criteria_listening_port("25")}}} {{% if 'ubuntu' in product %}} - + {{{ generate_criteria_listening_port("465")}}} + {{{ generate_criteria_listening_port("587")}}} {{% endif %}} - - tcp - 127.0.0.1 - 25 - ste_not_port_25 - ste_not_on_localhost - - - 25 - + ::1 - - - -{{% if 'ubuntu' in product %}} - + + {{% macro generate_test_listening_port(port) %}} + + tcp 127.0.0.1 - 465 - 587 - ste_not_ports_465 - ste_not_ports_587 + {{{ port }}} + ste_not_port_{{{ port }}} ste_not_on_localhost - - 465 - - - - 587 + + {{{ port }}} - + id="tst_nothing_listening_external_mta_port_{{{ port }}}" version="1" + comment="mta is not listening on any non-loopback address {{{ port }}}"> + -{{% endif %}} + + {{% endmacro %}} + + {{{ generate_test_listening_port("25") }}} + {{% if 'ubuntu' in product %}} + {{{ generate_test_listening_port("465")}}} + {{{ generate_test_listening_port("587")}}} + {{% endif %}}