TMAegisBeta
Više pravila za linux

Linux distributions

TMA-ALMA8-1.4.2

Ensure access to bootloader config is configured

SrednjaNivo 1Automatskalinux

Opis

The grub files contain information on boot settings and passwords for unlocking boot options.

Kako se proverava

Metod provere: Komanda ljuske

shell
alt0() { o=$(bash -c '#!/usr/bin/env bash

{
   a_output=() a_output2=()
   file_access_chk()
   {
      a_out=() a_out2=()
      [[ "$(dirname "$l_file")" =~ ^\/boot\/efi\/EFI ]] && l_pmask="0077" || l_pmask="0177"
      l_maxperm="$( printf '"'"'%o'"'"' $(( 0777 & ~$l_pmask )) )"
      if [ $(( $l_mode & $l_pmask )) -gt 0 ]; then
         a_out2+=("   - Is mode \"$l_mode\" and should be mode: \"$l_maxperm\" or more restrictive")
      else
         a_out+=("   - Is correctly mode: \"$l_mode\" which is mode: \"$l_maxperm\" or more restrictive")
      fi
      if [ "$l_user" = "root" ]; then
         a_out+=("   - Is correctly owned by user: \"$l_user\"")
      else
         a_out2+=("   - Is owned by user: \"$l_user\" and should be owned by user: \"root\"")
      fi
      if [ "$l_group" = "root" ]; then
         a_out+=("   - Is correctly group-owned by group: \"$l_user\"")
      else
         a_out2+=("   - Is group-owned by group: \"$l_user\" and should be group-owned by group: \"root\"")
      fi
      [ "${#a_out[@]}" -gt 0 ] && a_output+=("  - File: \"$l_file\"" "${a_out[@]}" "")
      [ "${#a_out2[@]}" -gt 0 ] && a_output2+=("  - File: \"$l_file\"" "${a_out2[@]}" "")
   }
   while IFS= read -r -d $'"'"'\0'"'"' l_gfile; do
      while IFS=: read -r l_file l_mode l_user l_group; do
         file_access_chk
      done <<< "$(stat -Lc '"'"'%n:%#a:%U:%G'"'"' "$l_gfile")"
   done < <(find /boot -type f \( -name '"'"'grub*'"'"' -o -name '"'"'user.cfg'"'"' \) - print0)
   if [ "${#a_output2[@]}" -le 0 ]; then
      printf '"'"'%s\n'"'"' "" "- Audit Result:" "  ** PASS **" "${a_output[@]}" ""
   else
      printf '"'"'%s\n'"'"' "" "- Audit Result:" "  ** FAIL **" " - Reason(s) for audit failure:" "${a_output2[@]}"
      [ "${#a_output[@]}" -gt 0 ] && printf '"'"'%s\n'"'"' "" "- Correctly set:" "${a_output[@]}" ""
   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
Očekivani izlaz
compliant

Kako se ispravlja

Metod ispravke: Smernica ili zakrpa infrastrukture

Run the following to update the mode, ownership, and group ownership of the grub configuration files: - IF - Files are located in /boot/efi/EFI/* Note: This is a vFat filesystem Edit /etc/fstab and add the fmask=0077, uid=0, and gid=0 options: Example: <device> /boot/efi vfat defaults,umask=0027,fmask=0077,uid=0,gid=0 0 0 Note: This may require a re-boot to enable the change - OR - - IF - Files are located in /boot/grub2/*: Run the following commands to set ownership and permissions on your grub configuration file(s): # [ -f /boot/grub2/grub.cfg ] && chown root:root /boot/grub2/grub.cfg # [ -f /boot/grub2/grub.cfg ] && chmod u-x,go-rwx /boot/grub2/grub.cfg # [ -f /boot/grub2/grubenv ] && cho…

Svojstva

Operativni sistemi
almalinux-8
Oznake
cis-convertedlinux
Referenca
CIS AlmaLinux OS 8 Benchmark v4.0.0 - 1.4.2

Proverite ovaj računar

Pokrenite ovo na računaru za koji imate dozvolu za proveru. Skeniranje radi u režimu samo za čitanje.

shell
tmaegis scan --target linux