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.ubuntu2004:def:212
# The Ubuntu operating system must configure the /var/log directory to have mode "0755" or less permissive.
# Per-module read mechanism curated from static teardown of DISA's SCC tool
# (SCAP Compliance Checker) -- see the SCC Automation Reference above.
# Mode of /var/log directory is 755 or less permissive
# file_object (file_test)
test_1() {
( (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' )
}
# dpkginfo_object (dpkginfo_test)
test_2() {
grep -A1 '^Package: rsyslog$' /var/lib/dpkg/status &>/dev/null
}
# process58_object (process58_test)
test_3() {
ps -eo args | grep -P '^/usr/sbin/rsyslogd\b' &>/dev/null
}
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
# DISA STIG / SCAP compliance check for Ubuntu /var/log directory mode (oval:mil.disa.stig.ubuntu2004:def:212)
if [ ! -d "/var/log" ]; then echo "PASS"; exit 0; fi
if [ ! -w "$EUID" ] && [ ! -w "$GID" ] && [ ! -w "Others" ]; then echo "PASS"; exit 0; fi
echo "FAIL"; exit 1