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.stig.rhel7:def:1122
# The Red Hat Enterprise Linux operating system must not allow an unrestricted logon to the system.
# Per-module read mechanism curated from static teardown of DISA's SCC tool
# (SCAP Compliance Checker) -- see the SCC Automation Reference above.
# package gdm is installed
# rpminfo_object (rpminfo_test)
test_1() {
rpm -q --quiet 'gdm' &>/dev/null
}
# TimedLoginEnable present in daemon section
# textfilecontent54_object (textfilecontent54_test)
test_2() {
grep -Pq '^\[daemon]\n(?!([^\n]*\n+)*\[[^\n\]]*]([^\n]*\n+)*TimedLoginEnable[ ]?=[ ]?)([^\n]*\n+)*TimedLoginEnable[ ]?=[ ]?' '/etc/gdm/custom.conf' &>/dev/null
}
# All TimedLoginEnable lines are set correctly
# textfilecontent54_object (textfilecontent54_test)
test_3() {
(sed -En 's/^[ ]*TimedLoginEnable[ ]?=[ ]?([^\W]*)[ ]*$/\1/p' '/etc/gdm/custom.conf') | grep -Pq '^[Ff][Aa][Ll][Ss][Ee]$'
}
if ( test_1 || ( test_2 && test_3 ) ); then
echo "PASS"
else
echo "FAIL"
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:mil.disa.stig.rhel7:def:1122
if ! command -v rpm &> /dev/null; then
echo "FAIL"
exit 1
fi
if rpm -q gdm &> /dev/null; then
gdm_conf=$(grep -w '^\\[daemon]' /etc/gdm/custom.conf | grep -w 'TimedLoginEnable=false')
if [ -n "$gdm_conf" ]; then
echo "PASS"
exit 0
else
echo "FAIL"
exit 1
fi
else
echo "PASS"
exit 0
fi