This Linux auditd detection lab gives defenders a repeatable way to validate process, privilege, file, service, and network telemetry without using malware or destructive actions. Run it on a disposable host, compare expected events with what your SIEM receives, and keep the worksheet as a regression test after operating-system, kernel, agent, or audit-rule changes.
Overview
Auditd is useful for Linux detection engineering because it can record security-relevant activity close to the operating system: process execution, changes to selected files, privilege-related system calls, and some network operations. It is not a complete security sensor by itself. Coverage depends on the kernel, distribution, audit rules, permissions, event interpretation, forwarding agent, and SIEM mapping.
Use this exercise as a soc validation lab, not as an attack simulation. The lab should run on a disposable virtual machine or an isolated test host. Create a dedicated working directory, use a non-production account, and avoid modifying system configuration except where the test explicitly requires it. Before changing rules, export the current configuration and confirm how to restore it.
The workflow has four stages:
- Record the host, kernel, distribution, auditd version, active rules, and log destination.
- Load or verify narrowly scoped rules for the behaviors being tested.
- Perform safe activities with known timestamps and a unique test marker.
- Compare local
ausearchresults with normalized SIEM events and detection outcomes.
Rule syntax and event fields can vary between distributions and kernel versions. Treat the examples below as lab starting points, then verify them against the audit tooling installed on the test system. For a broader detection regression process, see Detection Rule Regression Testing.
What to track
Start by creating a test record containing the UTC start time, hostname, test account, working-directory path, rule revision, agent version, and SIEM index or data stream. Use a marker such as AUDITD_LAB_2026_01 in a harmless command or filename so that results can be separated from normal background activity.
| Activity | Safe test | Expected audit evidence | Local validation |
|---|---|---|---|
| Process execution | printf 'AUDITD_LAB_2026_01\n' and sleep 2 | EXECVE or related syscall records with command, executable, user IDs, and timestamp fields | ausearch -k process_exec -ts recent -i |
| File activity | Create, append to, rename, and remove a file under /tmp/auditd-lab | Watch-rule records, when the directory or file is covered; path and permission fields may be represented in separate records | ausearch -k auditd_lab_file -ts recent -i |
| Permission change | Run chmod 600 and chmod 640 on the disposable file | PATH, syscall, success, actor identity, and sometimes mode-related fields | ausearch -k auditd_lab_file -ts recent -i |
| Privilege boundary | Run id, sudo -n -l if an approved sudo policy exists, and a permitted sudo -n id test | Process execution plus authentication or authorization records where configured; a denied attempt may be recorded differently from a successful one | ausearch -m USER_CMD,USER_START,USER_END -ts recent -i |
| Service configuration check | systemctl status auditd --no-pager and systemctl show auditd -p ActiveState -p FragmentPath | Process execution and, depending on rules, access to service-unit files; service-manager logs may be outside auditd | ausearch -k process_exec -ts recent -i |
| Local network activity | Inspect with ss -ntup; if approved, connect to a local test listener only | Possible connect syscall records, with process and address fields; network visibility can be high volume | ausearch -k network_connect -ts recent -i |
A minimal lab rule set may include an execution rule, watches for selected identity or privilege files, and a narrowly scoped file watch for the disposable directory. A syscall rule for every network connection can generate substantial volume, so use it only on the isolated test host or constrain it with available filters. If a rule uses architecture filters such as b64, verify whether the host also supports 32-bit execution before adding a corresponding rule.
# Illustrative lab rules; review before loading into a host
-a always,exit -F arch=b64 -S execve,execveat -k process_exec
-w /tmp/auditd-lab -p rwxa -k auditd_lab_file
-w /etc/passwd -p wa -k identity_file
-w /etc/sudoers -p wa -k privilege_file
-a always,exit -F arch=b64 -S setuid,setgid,setresuid,setresgid -k privilege_change
Depending on the distribution, rules may be managed directly with auditctl or through files consumed by augenrules. Confirm the active result with auditctl -l, and do not assume that editing a rule file immediately changes the running configuration.
A Sigma-style analytic can describe the intended logic even when the final query differs by platform:
title: Linux Auditd Lab Process Execution Marker
detection:
selection:
event.module: auditd
audit.key: process_exec
process.command_line|contains: AUDITD_LAB_2026_01
condition: selection
level: informational
Map the fields deliberately. One collector may expose audit.key, another may place the key in a message field, and a third may split the syscall records into a parent event and child records. Preserve the original event where possible so analysts can inspect the raw evidence.
Cadence and checkpoints
Run the complete lab quarterly and run a reduced process-and-file check monthly on important Linux populations. Repeat it after a kernel upgrade, distribution upgrade, audit-rule revision, agent migration, SIEM parser change, or major fleet expansion.
At each checkpoint, record five results:
- Generation: Did the test activity actually occur, and did the local audit log contain a matching record?
- Collection: Did the forwarding agent transmit the event without truncating command, path, identity, or timestamp fields?
- Normalization: Did the SIEM retain a stable hostname, username, executable, event type, audit key, and event time?
- Detection: Did the expected rule match the event, and did it produce the intended severity?
- Operations: Was the alert actionable, or did normal system activity create excessive noise?
Keep an expected-versus-observed worksheet with one row per test. Useful columns include test ID, command, start time, expected record type, expected fields, local result, SIEM result, detection result, and remediation owner. This turns a one-time exercise into a repeatable detection engineering tutorial for the team.
How to interpret changes
If the activity is visible locally but absent from the SIEM, investigate collection, permissions, file rotation, transport, parsing, index selection, and time-zone handling before changing the detection rule. If the event reaches the SIEM but the analytic does not match, compare the normalized field names and data types with the rule assumptions.
If the rule matches but the alert contains incomplete context, improve enrichment rather than broadening the condition. For example, a process alert is more useful when it retains the executable path, command line, actor, parent process where available, host, and event time. Avoid making a broad rule depend on a single fragile field when the same evidence may be represented in multiple audit records.
High volume is not automatically a collection failure. Execution and connection telemetry can be noisy on active servers. First measure baseline volume during a controlled window, then consider exclusions for known service accounts, paths, or binaries only when the exclusion is documented and tested. Re-run the lab after every exclusion to ensure the intended test remains visible.
For a failed privilege test, distinguish “the action was denied” from “no evidence was collected.” Check shell history only as supplementary context; it is not a substitute for audit records. Review ausearch output by time, key, message type, and serial number where available, because one logical action may produce several related records.
When to revisit
Schedule a monthly spot check and a quarterly full run. Revisit immediately after changing audit rules, upgrading the kernel or Linux distribution, replacing a log forwarder, changing SIEM parsing, or onboarding a new server class. Keep a dated copy of the active rules and worksheet so that a future failure can be compared with the last known-good result.
Finish each run with three actions: preserve the evidence, open tickets for collection or rule gaps, and update the detection documentation with the observed field mapping. If your environment also validates Windows or cross-platform analytics, pair this lab with the Sysmon Event ID validation guide and the Windows audit policy baseline.
The goal is not to prove that every Linux event is captured. It is to maintain trustworthy coverage for the behaviors your detections depend on, know where the gaps are, and catch regressions before analysts need the telemetry during an investigation.