TMAegis
Thêm quy tắc cho linux

TMA-ROCKY8-1.7.1

Ensure /etc/motd is configured

Trung bìnhCấp 1Tự độnglinux

Mô tả

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

Cách kiểm tra

Phương pháp kiểm tra: Lệnh shell

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
Đầu ra mong đợi
compliant

Cách khắc phục

Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng

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…

Thuộc tính

Hệ điều hành
rocky-8
Thẻ
cis-convertedlinux
Tham chiếu
CIS Rocky Linux 8 Benchmark v3.0.0 - 1.7.1

Kiểm tra máy này

Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.

shell
tmaegis scan --target linux