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.ubuntu1804:def:200
# The Ubuntu operating system must generate audit records for successful/unsuccessful uses of the creat, open, openat, open_by_handle_at, truncate, and ftruncate system calls.
# Per-module read mechanism curated from static teardown of DISA's SCC tool
# (SCAP Compliance Checker) -- see the SCC Automation Reference above.
# auditd package is installed
# dpkginfo_object (dpkginfo_test)
test_1() {
grep -A1 '^Package: auditd$' /var/lib/dpkg/status &>/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 open syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_3() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+open[\s]+|([\s]+|[,])open([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(unset|-1|4294967295).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of open syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_4() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+open[\s]+|([\s]+|[,])open([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(unset|-1|4294967295).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of open syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_5() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+open[\s]+|([\s]+|[,])open([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(unset|-1|4294967295).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of open syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_6() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+open[\s]+|([\s]+|[,])open([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(unset|-1|4294967295).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of openat syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_7() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+openat[\s]+|([\s]+|[,])openat([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of openat syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_8() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+openat[\s]+|([\s]+|[,])openat([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of openat syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_9() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+openat[\s]+|([\s]+|[,])openat([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of openat syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_10() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+openat[\s]+|([\s]+|[,])openat([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of open_by_handle_at syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_11() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+open_by_handle_at[\s]+|([\s]+|[,])open_by_handle_at([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of open_by_handle_at syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_12() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+open_by_handle_at[\s]+|([\s]+|[,])open_by_handle_at([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of open_by_handle_at syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_13() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+open_by_handle_at[\s]+|([\s]+|[,])open_by_handle_at([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of open_by_handle_at syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_14() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+open_by_handle_at[\s]+|([\s]+|[,])open_by_handle_at([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of creat syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_15() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+creat[\s]+|([\s]+|[,])creat([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of creat syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_16() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+creat[\s]+|([\s]+|[,])creat([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of creat syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_17() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+creat[\s]+|([\s]+|[,])creat([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of creat syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_18() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+creat[\s]+|([\s]+|[,])creat([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of truncate syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_19() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+truncate[\s]+|([\s]+|[,])truncate([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of truncate syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_20() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+truncate[\s]+|([\s]+|[,])truncate([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of truncate syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_21() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+truncate[\s]+|([\s]+|[,])truncate([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of truncate syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_22() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+truncate[\s]+|([\s]+|[,])truncate([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of ftruncate syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_23() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+ftruncate[\s]+|([\s]+|[,])ftruncate([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of ftruncate syscall that exit with EPERM
# textfilecontent54_object (textfilecontent54_test)
test_24() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+ftruncate[\s]+|([\s]+|[,])ftruncate([\s]+|[,])).*)-F\s+exit=-EPERM\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 32-bit invocations of ftruncate syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_25() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b32\s+(?:.*(-S[\s]+ftruncate[\s]+|([\s]+|[,])ftruncate([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-k[\s]+|-F[\s]+key=)[-\w]+[\s]*$' '/etc/audit/audit.rules' &>/dev/null
}
# Audit 64-bit invocations of ftruncate syscall that exit with EACCES
# textfilecontent54_object (textfilecontent54_test)
test_26() {
grep -Pq '^\s*-a\s+(always,exit|exit,always)\s+-F\s+arch=b64\s+(?:.*(-S[\s]+ftruncate[\s]+|([\s]+|[,])ftruncate([\s]+|[,])).*)-F\s+exit=-EACCES\s+-F\s+auid>=1000\s+-F\s+auid!=(4294967295|-1|unset).*(-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 && test_15 && test_16 && test_17 && test_18 && test_19 && test_20 && test_21 && test_22 && test_23 && test_24 && test_25 && test_26 ); then
echo "PASS"
else
echo "FAIL"
fi