Linux distributions
TMA-ROCKY8-1.7.1
Ensure /etc/motd is configured
说明
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
检查方式
审计方法: Shell 命令
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- 预期输出
compliant
修复方式
修复方法: 操作指南或基础设施补丁
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…
属性
- 操作系统
- rocky-8
- 标签
- cis-convertedlinux
- 参考
- CIS Rocky Linux 8 Benchmark v3.0.0 - 1.7.1
检查本机
请在您有权审计的机器上运行此命令。扫描为只读操作。
tmaegis scan --target linux