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.sles12:def:180
# The SUSE operating system must generate audit records for all uses of the setxattr, fsetxattr, lsetxattr, removexattr, fremovexattr, and lremovexattr syscalls.
# Per-module read mechanism curated from static teardown of DISA's SCC tool
# (SCAP Compliance Checker) -- see the SCC Automation Reference above.
# package audit is installed
# rpminfo_object (rpminfo_test)
test_1() {
rpm -q --quiet 'audit' &>/dev/null
}
# check for running auditd
# process58_object (process58_test)
test_2() {
ps -eo args | grep -P '^/sbin/auditd\b' &>/dev/null
}
# Audit 32-bit invocations of setxattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_3() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S\s+setxattr\s+|(\s+|,)setxattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of setxattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_4() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S\s+setxattr\s+|(\s+|,)setxattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of lsetxattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_5() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S\s+lsetxattr\s+|(\s+|,)lsetxattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of lsetxattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_6() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S\s+lsetxattr\s+|(\s+|,)lsetxattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of fsetxattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_7() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S\s+fsetxattr\s+|(\s+|,)fsetxattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of fsetxattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_8() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S\s+fsetxattr\s+|(\s+|,)fsetxattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of removexattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_9() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S\s+removexattr\s+|(\s+|,)removexattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of removexattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_10() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S\s+removexattr\s+|(\s+|,)removexattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of lremovexattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_11() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S\s+lremovexattr\s+|(\s+|,)lremovexattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of lremovexattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_12() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S\s+lremovexattr\s+|(\s+|,)lremovexattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of fremovexattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_13() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S\s+fremovexattr\s+|(\s+|,)fremovexattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of fremovexattr syscall
# textfilecontent54_object (textfilecontent54_test)
test_14() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S\s+fremovexattr\s+|(\s+|,)fremovexattr(\s+|,))).*-F\s+auid>=1000\s+-F\s+auid!=4294967295(\s+(-k\s+|-F\s+key=)[-\w]+)*\s*$' '/etc/audit/audit.rules' &>/dev/null
}
if ( test_1 && test_2 && test_3 && test_4 && test_5 && test_6 && test_7 && test_8 && test_9 && test_10 && test_11 && test_12 && test_13 && test_14 ); 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.sles12:def:180
if ! command -v rpm &> /dev/null; then
echo "FAIL"
exit 1
fi
if ! pgrep -f "/sbin/auditd" &> /dev/null; then
echo "FAIL"
exit 1
fi
audit_rules="/etc/audit/audit.rules"
if ! grep -q "^\\s*-a\\s+(always,exit|exit,always)\\s+-F\\s+arch=b32\\s+(?:.*(-S\\s+setxattr\\s+|(\\s+|,)setxattr(\\s+|,))).*-F\\s+auid>=1000\\s+-F\\s+auid != 4294967295(\\s+(-k\\s+|-F\\s+key=)[-\\w]+)*\\s*$" "$audit_rules"; then
echo "FAIL"
exit 1
fi
if ! grep -q "^\\s*-a\\s+(always,exit|exit,always)\\s+-F\\s+arch=b64\\s+(?:.*(-S\\s+setxattr\\s+|(\\s+|,)setxattr(\\s+|,))).*-F\\s+auid>=1000\\s+-F\\s+auid != 4294967295(\\s+(-k\\s+|-F\\s+key=)[-\\w]+)*\\s*$" "$audit_rules"; then
echo "FAIL"
exit 1
fi
if ! grep -q "^\\s*-a\\s+(always,exit|exit,always)\\s+-F\\s+arch=b32\\s+(?:.*(-S\\s+lsetxattr\\s+|(\\s+|,)lsetxattr(\\s+|,))).*-F\\s+auid>=1000\\s+-F\\s+auid != 4294967295(\\s+(-k\\s+|-F\\s+key=)[-\\w]+)*\\s*$" "$audit_rules"; then
echo "FAIL"
exit 1
fi
if ! grep -q "^\\s*-a\\s+(always,exit|exit,always)\\s+-F\\s+arch=b64\\s+(?:.*(-S\\s+lsetxattr\\s+|(\\s+|,)lsetxattr(\\s+|,))).*-F\\s+auid>=1000\\s+-F\\s+auid != 4294967295(\\s+(-k\\s+|-F\\s+key=)[-\\w]+)*\\s*$" "$audit_rules"; then
echo "FAIL"
exit 1
fi
if ! grep -q "^\\s*-a\\s+(always,exit|exit,always)\\s+-F\\s+arch=b32\\s+(?:.*(-S\\s+fsetxattr\\s+|(\\s+|,)fsetxattr(\\s+|,))).*-F\\s+auid>=1000\\s+-F\\s+auid != 4294967295(\\s+(-k\\s+|-F\\s+key=)[-\\w]+)*\\s*$" "$audit_rules"; then
echo "FAIL"
exit 1
fi
if ! grep -q "^\\s*-a\\s+(always,exit|exit,always)\\s+-F\\s+arch=b64\\s+(?:.*(-S\\s+fsetxattr\\s+|(\\s+|,)fsetxattr(\\s+|,))).*-F\\s+auid>=1000\\s+-F\\s+auid != 4294967295(\\s+(-k\\s+|-F\\s+key=)[-\\w]+)*\\s*$" "$audit_rules"; then
echo "FAIL"
exit 1
fi
echo "PASS"
exit 0