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.toss4os:def:252955
# TOSS must reveal error messages only to authorized users.
# Per-module read mechanism curated from static teardown of DISA's SCC tool
# (SCAP Compliance Checker) -- see the SCC Automation Reference above.
# file_object (file_test)
test_1() {
( (stat -c '%A' '/var/log/messages' | awk '{print (substr($0,7,1)=="x" || substr($0,7,1)=="s")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log/messages' | awk '{print (substr($0,8,1)=="r")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log/messages' | awk '{print (substr($0,4,1)=="x" || substr($0,4,1)=="s")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log/messages' | awk '{print (substr($0,10,1)=="t" || substr($0,10,1)=="T")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log/messages' | awk '{print (substr($0,7,1)=="s" || substr($0,7,1)=="S")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log/messages' | awk '{print (substr($0,4,1)=="s" || substr($0,4,1)=="S")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log/messages' | awk '{print (substr($0,10,1)=="x" || substr($0,10,1)=="t")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log/messages' | awk '{print (substr($0,9,1)=="w")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log/messages' | awk '{print (substr($0,6,1)=="w")?"true":"false"}') | grep -qxF 'false' )
}
# file_object (file_test)
test_2() {
[ "$(stat -c '%u' '/var/log/messages')" -eq 0 ]
}
# file_object (file_test)
test_3() {
( (stat -c '%A' '/var/log' | awk '{print (substr($0,10,1)=="t" || substr($0,10,1)=="T")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log' | awk '{print (substr($0,7,1)=="s" || substr($0,7,1)=="S")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log' | awk '{print (substr($0,4,1)=="s" || substr($0,4,1)=="S")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log' | awk '{print (substr($0,9,1)=="w")?"true":"false"}') | grep -qxF 'false' ) && ( (stat -c '%A' '/var/log' | awk '{print (substr($0,6,1)=="w")?"true":"false"}') | grep -qxF 'false' )
}
# file_object (file_test)
test_4() {
[ "$(stat -c '%u' '/var/log')" -eq 0 ]
}
if ( test_1 && test_2 && test_3 && test_4 ); 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 Definition: oval:mil.disa.stig.toss4os:def:252955
if [ ! -f "/var/log/messages" ]; then echo "PASS"; exit 0; fi; if [ ! -r "/var/log/messages" ] || [ ! -w "/var/log/messages" ] || [ -w /var/log/messages ] || [ -x /var/log/messages ] || [ -s /var/log/messages ]; then echo "FAIL"; exit 1; fi; if [ $(stat -c %u /var/log/messages) -ne 0 ]; then echo "PASS"; exit 0; fi; if [ ! -d "/var/log" ]; then echo "PASS"; exit 0; fi; if [ ! -r "/var/log" ] || [ ! -w "/var/log" ] || [ -w /var/log ] || [ -x /var/log ] || [ -s /var/log ]; then echo "FAIL"; exit 1; fi; if [ $(stat -c %u /var/log) -ne 0 ]; then echo "PASS"; exit 0; fi; echo "PASS"; exit 0