Repository navigation
feat: stig-ubuntu2204 revision 2: 38 audit rule controls, and an audit collector - #309
Merged
Merged
Conversation
…it collector, audit.path-audited and audit.command-audited)
… count, symlinked and surplus files, perms validated, per-letter permissions, a size check before the read, no rule list in the facts)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
stig-ubuntu2204goes from 27 to 65 controls of the 188 of V2R8 (revision 2): the 38 controls of the audit rules for commands, programs and files (UBTU-22-654010to654235, the ones that name a path). No other profile changes.The audit collector
New collector
audit(factsaudit.paths,audit.user_paths): it reads the audit rules the host loads at boot from/etc/audit/rules.d/*.rules(name order, symbolic links followed, as augenrules does), or/etc/audit/audit.ruleswithout them. It reads files only, throughinternal/hostfs, nothing is run, and no secret can be in them (the-kkeys are dropped). It says what it can decide and nothing more:auid=,uid=,success=,exit=, ...), or for some system calls only, is left out; aneverrule for a path removes the path (the kernel takes the first rule that matches, so before or after); aneverrule that names no path, a delete rule (-d), an include (-R), an unknown line, an invalid permission, more than 100 files, 5000 rules, a line over 4 KiB or a file over 1 MiB make the facts incomplete, so a check on them isERROR, never a pass.-Ddeletes what came before; the form-a always,exit -S all -F path=... -F perm=x -F auid>=1000 -F auid!=unset(also-1,4294967295) is the STIG's form for a command and fillsuser_paths;-wandpath=/dir=rules withperm=fillpaths.rules.d/audit.rulesthat the Ubuntu 22.04auditdpackage installs (taken from a container), and astig.rulesmade of the fix text of the 38 controls. A fuzz target (FuzzAuditRules) ran 3 million executions clean, twice.The checks
audit.command-audited(the STIG's command form, for logged-in users) andaudit.path-audited(a watch or a path rule withperm=, per letter r, w, a, x). Both are generic (the profile gives the path), N/A on a container image, and tested for PASS, FAIL, absent and incomplete.Verified on a real host
On a stock
ubuntu:22.04container withauditdinstalled: the 38 controls FAIL with its default rules and PASS with the STIG's rules inrules.d; adding-a never,exit -F path=/usr/bin/sudomakesUBTU-22-654105FAIL.Review
/code-review high(new parser of host files): ten findings, all addressed: narrowing filters andneverrules counted as audited (false PASS), symlinked rules files and surplus files dropped silently, the size limit applied after the read, an option and a rule on one line, invalid permissions, substring comparison of permissions (now per letter), the unused rule list in the facts (removed). Documented, not changed: a rule on a directory (dir=) counts for the directory, not the files in it, and paths are the STIG's own spelling (/bin/su, not/usr/bin/su): a false FAIL, never a false PASS, said in the check and docs/stig.md.Docs
docs/stig.md and .ko.md (65 of 188, the audit rules, what is not read), README en/ko, the generated English page (65 controls). Control titles are ours, IDs and importance the STIG's; the rule lines in the fixture are the STIG's example rules (a US government work).