The reconstructed evaluation script behind this rule's OVAL check(s) — every module a compound check combines, with this rule's own concrete values and DISA's SCC tool's real per-module mechanism curated from static teardown of SCC releases.
#!/bin/bash
# Reconstructed from oval:mil.disa.fso.rhel11:def:131
# All global initialization files must be group-owned by root, sys, bin, other, system, or the system default.
# Per-module read mechanism curated from static teardown of DISA's SCC tool
# (SCAP Compliance Checker) -- see the SCC Automation Reference above.
#
# MANUAL REVIEW REQUIRED -- the module(s) below could not be reconstructed
# into working code from curated SCC reference data, and are excluded from
# the automated result:
# - file_object (file_test) -- check /etc/profile.d directory files are group-owned by root, bin, or sys: no extractor for field "group_id"
# check /etc/csh.cshrc file is group-owned by root, bin, or sys
# file_object (file_test)
test_1() {
( [ "$(stat -c '%g' '/etc/csh.cshrc')" -eq 0 ] ) || ( [ "$(stat -c '%g' '/etc/csh.cshrc')" -eq 1 ] ) || ( [ "$(stat -c '%g' '/etc/csh.cshrc')" -eq 3 ] )
}
# check /etc/profile file is group-owned by root, bin, or sys
# file_object (file_test)
test_2() {
( [ "$(stat -c '%g' '/etc/profile')" -eq 0 ] ) || ( [ "$(stat -c '%g' '/etc/profile')" -eq 1 ] ) || ( [ "$(stat -c '%g' '/etc/profile')" -eq 3 ] )
}
# check /etc/bashrc file is group-owned by root, bin, or sys
# file_object (file_test)
test_3() {
( [ "$(stat -c '%g' '/etc/bashrc')" -eq 0 ] ) || ( [ "$(stat -c '%g' '/etc/bashrc')" -eq 1 ] ) || ( [ "$(stat -c '%g' '/etc/bashrc')" -eq 3 ] )
}
# check /etc/environment file is group-owned by root, bin, or sys
# file_object (file_test)
test_4() {
( [ "$(stat -c '%g' '/etc/environment')" -eq 0 ] ) || ( [ "$(stat -c '%g' '/etc/environment')" -eq 1 ] ) || ( [ "$(stat -c '%g' '/etc/environment')" -eq 3 ] )
}
# check /etc/csh.login file is group-owned by root, bin, or sys
# file_object (file_test)
test_5() {
( [ "$(stat -c '%g' '/etc/csh.login')" -eq 0 ] ) || ( [ "$(stat -c '%g' '/etc/csh.login')" -eq 1 ] ) || ( [ "$(stat -c '%g' '/etc/csh.login')" -eq 3 ] )
}
# check /etc/csh.logout file is group-owned by root, bin, or sys
# file_object (file_test)
test_6() {
( [ "$(stat -c '%g' '/etc/csh.logout')" -eq 0 ] ) || ( [ "$(stat -c '%g' '/etc/csh.logout')" -eq 1 ] ) || ( [ "$(stat -c '%g' '/etc/csh.logout')" -eq 3 ] )
}
# check /etc/ksh.kshrc file is group-owned by root, bin, or sys
# file_object (file_test)
test_7() {
( [ "$(stat -c '%g' '/etc/ksh.kshrc')" -eq 0 ] ) || ( [ "$(stat -c '%g' '/etc/ksh.kshrc')" -eq 1 ] ) || ( [ "$(stat -c '%g' '/etc/ksh.kshrc')" -eq 3 ] )
}
# check /etc/suid_profile file is group-owned by root, bin, or sys
# file_object (file_test)
test_8() {
( [ "$(stat -c '%g' '/etc/suid_profile')" -eq 0 ] ) || ( [ "$(stat -c '%g' '/etc/suid_profile')" -eq 1 ] ) || ( [ "$(stat -c '%g' '/etc/suid_profile')" -eq 3 ] )
}
# check /etc/profile.d directory is group-owned by root, bin, or sys
# file_object (file_test)
test_9() {
( [ "$(stat -c '%g' '/etc/profile.d')" -eq 0 ] ) || ( [ "$(stat -c '%g' '/etc/profile.d')" -eq 1 ] ) || ( [ "$(stat -c '%g' '/etc/profile.d')" -eq 3 ] )
}
if ( test_1 && test_2 && test_3 && test_4 && test_5 && test_6 && test_7 && test_8 && test_9 ); then
echo "PASS (automated portion only -- MANUAL REVIEW still required, see notes above)"
else
echo "FAIL (or see MANUAL REVIEW note above)"
fi Assessment Script Powered by AISandbox-executed
A standalone Shell script to assess this control automatically. Review before running it in your environment.
Syntax-checked and actually executed in an isolated sandbox (not the real system this checks) — confirmed to run without errors.
#!/bin/sh
# OVAL definition: oval:mil.disa.fso.rhel11:def:131
if [ ! -f "/etc/csh.cshrc" ] || [ "$(stat -c "%G" "/etc/csh.cshrc")" = "root" ] || [ "$(stat -c "%G" "/etc/csh.cshrc")" = "sys" ] || [ "$(stat -c "%G" "/etc/csh.cshrc")" = "bin" ]; then :; else chgrp root /etc/csh.cshrc; fi
if [ ! -f "/etc/profile" ] || [ "$(stat -c "%G" "/etc/profile")" = "root" ] || [ "$(stat -c "%G" "/etc/profile")" = "sys" ] || [ "$(stat -c "%G" "/etc/profile")" = "bin" ]; then :; else chgrp root /etc/profile; fi
if [ ! -f "/etc/bashrc" ] || [ "$(stat -c "%G" "/etc/bashrc")" = "root" ] || [ "$(stat -c "%G" "/etc/bashrc")" = "sys" ] || [ "$(stat -c "%G" "/etc/bashrc")" = "bin" ]; then :; else chgrp root /etc/bashrc; fi
if [ ! -f "/etc/environment" ] || [ "$(stat -c "%G" "/etc/environment")" = "root" ] || [ "$(stat -c "%G" "/etc/environment")" = "sys" ] || [ "$(stat -c "%G" "/etc/environment")" = "bin" ]; then :; else chgrp root /etc/environment; fi
echo "PASS"
exit 0