TMA-ROCKY8-1.7.1
Ensure /etc/motd is configured
Description
The contents of the /etc/motd file are displayed to users after login and function as a message of the day for authenticated users. Unix-based systems have typically displayed information about the OS release and patch level upon logging in to the system. This information can be useful to developers who are developing software for a particular OS platform. If mingetty(8) supports the following options, they display operating system information: \m - machine architecture \r - operating system release \s - operating system name \v - operating system version
How it is checked
Audit method: Shell command
alt0() { o=$(bash -c '#!/usr/bin/env bash
{
l_output="" l_output2=""
a_files=()
for l_file in /etc/motd{,.d/*}; do
if grep -Psqi -- "(\\\v|\\\r|\\\m|\\\s|\b$(grep ^ID= /etc/os-release | cut -d= -f2 | sed -e '"'"'s/"//g'"'"')\b)" "$l_file"; then
l_output2="$l_output2\n - File: \"$l_file\" includes system information"
else
a_files+=("$l_file")
fi
done
if [ "${#a_files[@]}" -gt 0 ]; then
echo -e "\n- ** Please review the following files and verify their contents follow local site policy **\n"
printf '"'"'%s\n'"'"' "${a_files[@]}"
elif [ -z "$l_output2" ]; then
echo -e "- ** No MOTD files with any size were found. Please verify this conforms to local site policy ** -"
fi
if [ -z "$l_output2" ]; then
l_output=" - No MOTD files include system information"
echo -e "\n- Audit Result:\n ** PASS **\n$l_output\n"
else
echo -e "\n- Audit Result:\n ** FAIL **\n - Reason(s) for audit failure:\n$l_output2\n"
fi
}' 2>&1); printf '%s\n' "$o" | grep -q '\*\* PASS \*\*' || { echo "step1: script did not report PASS"; return 1; }; }; if alt0; then echo compliant; fi- Expected output
compliant
How it is fixed
Fix method: Guidance or infrastructure patch
Edit the file found in /etc/motd.d/* with the appropriate contents according to your site policy, remove any instances of \m , \r , \s , \v or references to the OS platform - OR - - IF - the motd is not used, this file can be removed. Run the following command to remove the motd file: # rm /etc/motd Run the following script and review and/or update all returned files' contents to: • Remove all system information (\v, \r; \m, \s) • Remove any refence to the operating system • Ensure contents follow local site policy #!/usr/bin/env bash { a_files=() for l_file in /etc/motd{,.d/*}; do if grep -Psqi -- "(\\\v|\\\r|\\\m|\\\s|\b$(grep ^ID= /etc/os-release | cut -d= -f2 | sed -e 's/"//g')\b)" "$l_f…
Properties
- Operating systems
- rocky-8
- Tags
- cis-convertedlinux
- Reference
- CIS Rocky Linux 8 Benchmark v3.0.0 - 1.7.1
Check this host
Run this on a machine you are allowed to audit. The scan is read-only.
tmaegis scan --target linux