TMAegisベータ
linux のその他のルール

Linux distributions

TMA-RHEL9-7.2.3

Ensure all groups in /etc/passwd exist in /etc/group

中レベル 1自動linux

説明

Over time, system administration errors and changes can lead to groups being defined in /etc/passwd but not in /etc/group .

チェック方法

監査方法: シェルコマンド

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

{
   a_passwd_group_gid=("$(awk -F: '"'"'{print $4}'"'"' /etc/passwd | sort -u)")
   a_group_gid=("$(awk -F: '"'"'{print $3}'"'"' /etc/group | sort -u)")
   a_passwd_group_diff=("$(printf '"'"'%s\n'"'"' "${a_group_gid[@]}" "${a_passwd_group_gid[@]}" | sort | uniq -u)")
   while IFS= read -r l_gid; do
      awk -F: '"'"'($4 == '"'"'"$l_gid"'"'"') {print "  - User: \"" $1 "\" has GID: \"" $4 "\" which does not exist in /etc/group" }'"'"' /etc/passwd
   done < <(printf '"'"'%s\n'"'"' "${a_passwd_group_gid[@]}" "${a_passwd_group_diff[@]}" | sort | uniq -D | uniq)
   unset a_passwd_group_gid; unset a_group_gid; unset a_passwd_group_diff
}' 2>&1); [ -z "$o" ] || { echo "step1: $o" | head -c 300; return 1; }; }; if alt0; then echo compliant; fi
期待される出力
compliant

修正方法

修正方法: ガイダンスまたは IaC パッチ

Based on the Audit Procedure output, for each local interactive user whose primary group ID (the fourth field of the user's /etc/passwd entry) has no matching group in /etc/group, follow local site policy and perform one of the following: • If the group is legitimate and should exist, create it with the reported GID: # groupadd -g <GID> <groupname> • If the user should instead belong to an existing group, change the user's primary group to a valid one: # usermod -g <groupname> <username>

プロパティ

オペレーティングシステム
rhel-9
タグ
cis-convertedlinux
参照
CIS Red Hat Enterprise Linux 9 Benchmark v3.0.0 - 7.2.3

このホストをチェック

監査が許可されているマシンで実行してください。スキャンは読み取り専用です。

shell
tmaegis scan --target linux