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
new file mode 100644
index 00000000000..d0d74058b74
--- /dev/null
+++ b/linux_os/guide/services/mail/has_nonlocal_mta/oval/shared.xml
@@ -0,0 +1,27 @@
+
# ss -lntu | grep -E ':25\s' | grep -E -v '\s(127.0.0.1|::1):25\s'+ Nothing should be returned 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 new file mode 100644 index 00000000000..c332f0d9cc1 --- /dev/null +++ b/linux_os/guide/services/mail/has_nonlocal_mta/tests/correct.pass.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# packages = postfix + +echo "inet_interfaces = localhost" > /etc/postfix/main.cf +systemctl restart postfix 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 new file mode 100644 index 00000000000..03d0ea05a6f --- /dev/null +++ b/linux_os/guide/services/mail/has_nonlocal_mta/tests/wrong.fail.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# packages = postfix +# remediation = none + +echo "inet_interfaces = all" > /etc/postfix/main.cf +systemctl restart postfix diff --git a/linux_os/guide/services/mail/postfix_client/postfix_network_listening_disabled/bash/shared.sh b/linux_os/guide/services/mail/postfix_client/postfix_network_listening_disabled/bash/shared.sh index 93a9e58780f..befe1acf3bf 100644 --- a/linux_os/guide/services/mail/postfix_client/postfix_network_listening_disabled/bash/shared.sh +++ b/linux_os/guide/services/mail/postfix_client/postfix_network_listening_disabled/bash/shared.sh @@ -3,3 +3,5 @@ {{{ bash_instantiate_variables("var_postfix_inet_interfaces") }}} {{{ set_config_file(path="/etc/postfix/main.cf", parameter="inet_interfaces", value="$var_postfix_inet_interfaces", create=true, insensitive=true, separator="=", separator_regex="\s\+=\s\+", prefix_regex="^\s*") }}} + +systemctl restart postfix diff --git a/products/ubuntu2004/profiles/cis_level1_server.profile b/products/ubuntu2004/profiles/cis_level1_server.profile index 405bffe40a1..a61824eb3b5 100644 --- a/products/ubuntu2004/profiles/cis_level1_server.profile +++ b/products/ubuntu2004/profiles/cis_level1_server.profile @@ -280,6 +280,7 @@ selections: ### 2.2.15 Ensure mail transfer agent is configured for local-only mode (Automated) - var_postfix_inet_interfaces=loopback-only - postfix_network_listening_disabled + - has_nonlocal_mta ### 2.2.16 Ensure rsync service is not installed (Automated) - package_rsync_removed diff --git a/products/ubuntu2204/profiles/cis_level1_server.profile b/products/ubuntu2204/profiles/cis_level1_server.profile index fffe2556baa..da1d0627067 100644 --- a/products/ubuntu2204/profiles/cis_level1_server.profile +++ b/products/ubuntu2204/profiles/cis_level1_server.profile @@ -313,6 +313,7 @@ selections: ### 2.2.15 Ensure mail transfer agent is configured for local-only mode (Automated) - var_postfix_inet_interfaces=loopback-only - postfix_network_listening_disabled + - has_nonlocal_mta ### 2.2.16 Ensure rsync service is not installed (Automated) - package_rsync_removed