diff --git a/controls/cis_ubuntu2404.yml b/controls/cis_ubuntu2404.yml index a65a4d83f94..c6f9801c78b 100644 --- a/controls/cis_ubuntu2404.yml +++ b/controls/cis_ubuntu2404.yml @@ -865,11 +865,11 @@ controls: levels: - l1_server - l1_workstation - related_rules: + rules: - has_nonlocal_mta + - var_postfix_inet_interfaces=loopback-only - postfix_network_listening_disabled - status: planned - notes: TODO. Partial/incorrect implementation exists.See related rules. Analogous to ubuntu2204/2.2.15. + status: automated - id: 2.1.22 title: Ensure only approved services are listening on a network interface (Manual) 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 d0d74058b74..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,27 +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 %}} - + + + ::1 + + + {{% macro generate_test_listening_port(port) %}} + + tcp 127.0.0.1 - 25 - ste_not_port_25 + {{{ port }}} + ste_not_port_{{{ port }}} ste_not_on_localhost - - 25 - - - ::1 + + + {{{ port }}} + - + id="tst_nothing_listening_external_mta_port_{{{ port }}}" version="1" + comment="mta is not listening on any non-loopback address {{{ port }}}"> + + + {{% endmacro %}} + + {{{ generate_test_listening_port("25") }}} + {{% if 'ubuntu' in product %}} + {{{ generate_test_listening_port("465")}}} + {{{ generate_test_listening_port("587")}}} + {{% endif %}} diff --git a/linux_os/guide/services/mail/has_nonlocal_mta/tests/correct.pass.sh b/linux_os/guide/services/mail/has_nonlocal_mta/tests/correct.pass.sh index c332f0d9cc1..14b25e5f9b9 100644 --- a/linux_os/guide/services/mail/has_nonlocal_mta/tests/correct.pass.sh +++ b/linux_os/guide/services/mail/has_nonlocal_mta/tests/correct.pass.sh @@ -2,4 +2,4 @@ # packages = postfix echo "inet_interfaces = localhost" > /etc/postfix/main.cf -systemctl restart postfix +postfix reload || postfix start diff --git a/linux_os/guide/services/mail/has_nonlocal_mta/tests/wrong.fail.sh b/linux_os/guide/services/mail/has_nonlocal_mta/tests/wrong.fail.sh index 03d0ea05a6f..929ce132a79 100644 --- a/linux_os/guide/services/mail/has_nonlocal_mta/tests/wrong.fail.sh +++ b/linux_os/guide/services/mail/has_nonlocal_mta/tests/wrong.fail.sh @@ -3,4 +3,4 @@ # remediation = none echo "inet_interfaces = all" > /etc/postfix/main.cf -systemctl restart postfix +postfix reload || postfix start