diff --git a/README.ko.md b/README.ko.md
index 542ee5c..816ffe8 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -1,4 +1,4 @@
-
+
# vmsctl
[](https://github.com/with-developer/vmsctl/actions/workflows/ci.yml)
@@ -195,7 +195,7 @@ sudo vmsctl scan --config vmsctl.yaml
## 무엇을 점검하나
-`kisa-2026` 프로파일은 KISA 가이드(2026년판)의 Unix 점검 항목 67개를 모두 담았고, `stig-ubuntu2204`는 미국 DISA의 Ubuntu 22.04 STIG 중 vmsctl이 판정할 수 있는 27개를 담았습니다([점검 범위](docs/stig.ko.md)). 점검 항목별 점검 내용, 매개변수,
+`kisa-2026` 프로파일은 KISA 가이드(2026년판)의 Unix 점검 항목 67개를 모두 담았고, `stig-ubuntu2204`는 미국 DISA의 Ubuntu 22.04 STIG 중 vmsctl이 판정할 수 있는 65개를 담았습니다([점검 범위](docs/stig.ko.md)). 점검 항목별 점검 내용, 매개변수,
조치 방법은 [규칙 참조](docs/rules.ko.md)에 한국어로 있고, KISA 점검 항목만 모은 [웹 페이지](https://with-developer.github.io/vmsctl/ko/kisa/)도 있습니다.
- **계정 관리 (U-01–U-13):** root 원격 접속, 비밀번호 길이·복잡도·사용 기간, 계정 잠금, 비밀번호
diff --git a/README.md b/README.md
index 02b7574..ccb2bfe 100644
--- a/README.md
+++ b/README.md
@@ -193,7 +193,7 @@ or a scan that could not run, 130 when interrupted.
## What it checks
-The `kisa-2026` profile maps all 67 Unix controls of the KISA guide (2026 edition), and `stig-ubuntu2204` the 27 controls
+The `kisa-2026` profile maps all 67 Unix controls of the KISA guide (2026 edition), and `stig-ubuntu2204` the 65 controls
of the US DISA STIG for Ubuntu 22.04 that vmsctl can decide ([what it covers](docs/stig.md)); the
[rule reference](docs/rules.md) lists every control with the checks, parameters and fixes behind it:
diff --git a/docs/facts.md b/docs/facts.md
index 45d47d2..6094d0f 100644
--- a/docs/facts.md
+++ b/docs/facts.md
@@ -41,6 +41,25 @@ Accounts are the `accounts` facts: /etc/passwd and /etc/group.
| `accounts.empty_groups[].members` | list of string | |
| `accounts.empty_groups[].source` | string | |
+## `audit`
+
+Audit are the `audit` facts: what the audit rules that the host loads at boot audit, read from the files, not from the running
+kernel (a rule added with auditctl since boot is not seen; see the `services` facts for whether auditd starts). The files are
+/etc/audit/rules.d/*.rules in name order, which is what augenrules merges into /etc/audit/audit.rules; /etc/audit/audit.rules
+itself when there is no rules.d file. A rule counts only when it audits every event for its path: a rule narrowed by another
+filter (a user, an exit code, success) is left out, and a "never" rule for a path removes the path. A line that cannot be read
+makes the facts incomplete.
+
+| Path | Type | |
+|---|---|---|
+| `audit.present` | bool | Present is true when a rules file exists. |
+| `audit.paths` | map of object | Paths holds, for every path that a watch (-w) or an always,exit rule with path= or dir= and perm= audits, the permissions it audits (the union over the rules, in the order r, w, a, x: "wa", "x"), whoever the user is. A directory has no trailing "/". A rule on a directory is stored under the directory, not under the files in it. |
+| `audit.paths{}.perms` | string | |
+| `audit.paths{}.source` | string | Source is the file and line of the first rule that audits it. |
+| `audit.user_paths` | map of object | UserPaths is the same for the rules written for logged-in users: always,exit rules with path=, perm=, auid>=1000 and auid!=unset (also written -1 or 4294967295), the form that the STIG asks for the commands it names. |
+| `audit.user_paths{}.perms` | string | |
+| `audit.user_paths{}.source` | string | Source is the file and line of the first rule that audits it. |
+
## `banner`
Banner is the `banner` facts: the texts shown before and after a login.
diff --git a/docs/rules.ko.md b/docs/rules.ko.md
index 5c50751..b2ad72a 100644
--- a/docs/rules.ko.md
+++ b/docs/rules.ko.md
@@ -1850,7 +1850,7 @@ OpenSSH 서버의 전역 PermitRootLogin 설정을 확인합니다. 실행 중
**조치 방법.** /etc/ssh/sshd_config(또는 그 파일이 포함하는 파일)에 `PermitRootLogin no`를 설정하고 sshd를 다시 불러오세요. 관리자는 각자의 계정으로 로그인한 뒤 sudo나 su를 사용합니다.
-## stig-ubuntu2204 (리비전 1)
+## stig-ubuntu2204 (리비전 2)
Canonical Ubuntu 22.04 LTS STIG(V2R8) 중 vmsctl이 점검하는 항목
@@ -1883,6 +1883,44 @@ Canonical Ubuntu 22.04 LTS STIG(V2R8) 중 vmsctl이 점검하는 항목
| UBTU-22-611035 | 중간 | 비밀번호가 15자 이상임 | [`accounts.password-min-length`](#accountspassword-min-length) |
| UBTU-22-611065 | 높음 | 비밀번호가 비어 있는 계정이 없음 | [`accounts.no-empty-passwords`](#accountsno-empty-passwords) |
| UBTU-22-653010 | 중간 | 감사 데몬(auditd)이 설치되어 있음 | [`packages.installed`](#packagesinstalled) |
+| UBTU-22-654010 | 중간 | apparmor_parser 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654015 | 중간 | chacl 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654020 | 중간 | chage 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654025 | 중간 | chcon 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654030 | 중간 | chfn 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654035 | 중간 | chsh 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654040 | 중간 | crontab 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654045 | 중간 | fdisk 명령을 쓸 때마다 감사 기록을 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654050 | 중간 | gpasswd 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654055 | 중간 | kmod 명령을 쓸 때마다 감사 기록을 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654060 | 중간 | modprobe 명령을 쓸 때마다 감사 기록을 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654065 | 중간 | mount 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654070 | 중간 | newgrp 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654075 | 중간 | pam_timestamp_check 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654080 | 중간 | passwd 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654085 | 중간 | setfacl 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654090 | 중간 | ssh-agent 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654095 | 중간 | ssh-keysign 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654100 | 중간 | su 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654105 | 중간 | sudo 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654110 | 중간 | sudoedit 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654115 | 중간 | umount 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654120 | 중간 | unix_update 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654125 | 중간 | usermod 명령을 쓸 때마다 감사 기록을 남김 | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654130 | 중간 | /etc/group의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654135 | 중간 | /etc/gshadow의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654140 | 중간 | /etc/security/opasswd의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654145 | 중간 | /etc/passwd의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654150 | 중간 | /etc/shadow의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654190 | 중간 | systemd 저널 파일의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654195 | 중간 | /var/log/btmp의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654200 | 중간 | /var/log/wtmp의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654205 | 중간 | /var/run/utmp의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654210 | 중간 | /var/log/faillog의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654215 | 중간 | /var/log/lastlog의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654220 | 중간 | /etc/sudoers의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654225 | 중간 | /etc/sudoers.d의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654235 | 중간 | /var/log/sudo.log의 변경을 감사 기록에 남김 | [`audit.path-audited`](#auditpath-audited) |
### 점검
@@ -1982,6 +2020,35 @@ root 계정에 로그인할 수 있는 비밀번호가 없음 — 심각도 중
**조치 방법.** 계정마다 고유한 UID를 주고(`usermod -u`), 그 계정의 파일 소유자를 바로잡으세요.
+#### `audit.command-audited`
+
+감사 규칙이 점검 항목이 지정한 명령의 모든 사용을 기록함 — 심각도 중간, 식을 평가합니다.
+
+호스트가 부팅할 때 불러오는 감사 규칙(/etc/audit/rules.d/*.rules, 없으면 /etc/audit/audit.rules)에 매개변수 `path`의 프로그램에 대한 규칙이 STIG가 명령에 대해 정한 형태로 있는지 확인합니다. 형태는 `-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset`(`-1`로 써도 됩니다)이고, 로그인한 사용자가 실행한 것이 기록되게 하려는 것입니다. 감시 규칙(`-w`)이나 `auid` 필터 두 개가 없는 규칙은 인정하지 않습니다. 실행 중인 커널이 아니라 파일을 읽습니다. 매개변수는 프로파일만 정합니다. 컨테이너 이미지에는 해당하지 않습니다.
+
+**이유.** 감사하지 않는 권한 있는 프로그램은 누가 실행했는지 기록 없이 실행할 수 있습니다.
+
+**조치 방법.** /etc/audit/rules.d의 파일에 그 프로그램의 규칙을 추가하고(예: `-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage`) `augenrules --load`로 불러오세요.
+
+**매개변수** (설명은 영어).
+
+- `path` (string, 기본값 ``): The program to audit, as the STIG gives its path
+
+#### `audit.path-audited`
+
+감사 규칙이 점검 항목이 지정한 경로를 감시함 — 심각도 중간, 식을 평가합니다.
+
+호스트가 부팅할 때 불러오는 감사 규칙(/etc/audit/rules.d/*.rules, 없으면 /etc/audit/audit.rules)이 매개변수 `path`의 경로를 `perms`의 권한(r, w, a, x 순서, 예: `wa`나 `x`)으로 감사하는지 확인합니다. 감시 규칙(`-w /etc/passwd -p wa`)이나 `path=`와 `perm=`이 있는 always,exit 규칙이면 되고, 사용자는 가리지 않습니다. 어느 경로와 권한인지는 이 점검을 쓰는 프로파일이 정합니다. 실행 중인 커널이 아니라 파일을 읽으므로, 부팅한 뒤 auditctl로 추가한 규칙은 보이지 않습니다. 사용자나 종료 코드 같은 다른 필터로 범위가 좁아진 규칙과 `never` 규칙이 있는 경로는 인정하지 않고, `dir=` 규칙은 그 디렉터리에만 해당하므로 규칙에 적은 경로 그대로 지정해야 합니다. 매개변수는 프로파일만 정합니다. 컨테이너 이미지에는 해당하지 않습니다.
+
+**이유.** 보안 파일을 누가 바꿨는지, 권한 있는 프로그램을 누가 실행했는지 기록이 없으면 사고를 조사하거나 책임을 가릴 수 없습니다.
+
+**조치 방법.** /etc/audit/rules.d의 파일에 그 경로의 규칙을 추가하고(예: `-w /etc/passwd -p wa -k usergroup_modification`) `augenrules --load`로 불러오세요.
+
+**매개변수** (설명은 영어).
+
+- `path` (string, 기본값 ``): The path to audit, without a trailing slash
+- `perms` (string, 기본값 `x`): The permissions to audit: any of r, w, a, x, in that order
+
#### `firewall.ufw-active`
ufw가 켜져 있음 — 심각도 중간, 식을 평가합니다.
diff --git a/docs/rules.md b/docs/rules.md
index 398fba6..a4f12b9 100644
--- a/docs/rules.md
+++ b/docs/rules.md
@@ -1851,7 +1851,7 @@ Checks the global PermitRootLogin setting of the OpenSSH server. On a live host
**Fix.** Set `PermitRootLogin no` in /etc/ssh/sshd_config (or a file it includes) and reload sshd. Administrators log in with their own accounts and use sudo or su.
-## stig-ubuntu2204 (revision 1)
+## stig-ubuntu2204 (revision 2)
Canonical Ubuntu 22.04 LTS STIG (V2R8), the controls vmsctl checks
@@ -1884,6 +1884,44 @@ Canonical Ubuntu 22.04 LTS STIG (V2R8), the controls vmsctl checks
| UBTU-22-611035 | medium | A password has at least 15 characters (비밀번호가 15자 이상임) | [`accounts.password-min-length`](#accountspassword-min-length) |
| UBTU-22-611065 | high | No account has an empty password (비밀번호가 비어 있는 계정이 없음) | [`accounts.no-empty-passwords`](#accountsno-empty-passwords) |
| UBTU-22-653010 | medium | The audit daemon is installed (감사 데몬(auditd)이 설치되어 있음) | [`packages.installed`](#packagesinstalled) |
+| UBTU-22-654010 | medium | Every use of apparmor_parser is audited (apparmor_parser 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654015 | medium | Every use of chacl is audited (chacl 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654020 | medium | Every use of chage is audited (chage 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654025 | medium | Every use of chcon is audited (chcon 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654030 | medium | Every use of chfn is audited (chfn 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654035 | medium | Every use of chsh is audited (chsh 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654040 | medium | Every use of crontab is audited (crontab 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654045 | medium | Every use of fdisk is audited (fdisk 명령을 쓸 때마다 감사 기록을 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654050 | medium | Every use of gpasswd is audited (gpasswd 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654055 | medium | Every use of kmod is audited (kmod 명령을 쓸 때마다 감사 기록을 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654060 | medium | Every use of modprobe is audited (modprobe 명령을 쓸 때마다 감사 기록을 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654065 | medium | Every use of mount is audited (mount 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654070 | medium | Every use of newgrp is audited (newgrp 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654075 | medium | Every use of pam_timestamp_check is audited (pam_timestamp_check 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654080 | medium | Every use of passwd is audited (passwd 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654085 | medium | Every use of setfacl is audited (setfacl 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654090 | medium | Every use of ssh-agent is audited (ssh-agent 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654095 | medium | Every use of ssh-keysign is audited (ssh-keysign 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654100 | medium | Every use of su is audited (su 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654105 | medium | Every use of sudo is audited (sudo 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654110 | medium | Every use of sudoedit is audited (sudoedit 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654115 | medium | Every use of umount is audited (umount 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654120 | medium | Every use of unix_update is audited (unix_update 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654125 | medium | Every use of usermod is audited (usermod 명령을 쓸 때마다 감사 기록을 남김) | [`audit.command-audited`](#auditcommand-audited) |
+| UBTU-22-654130 | medium | Changes to /etc/group are audited (/etc/group의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654135 | medium | Changes to /etc/gshadow are audited (/etc/gshadow의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654140 | medium | Changes to /etc/security/opasswd are audited (/etc/security/opasswd의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654145 | medium | Changes to /etc/passwd are audited (/etc/passwd의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654150 | medium | Changes to /etc/shadow are audited (/etc/shadow의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654190 | medium | Changes to the systemd journal files are audited (systemd 저널 파일의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654195 | medium | Changes to /var/log/btmp are audited (/var/log/btmp의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654200 | medium | Changes to /var/log/wtmp are audited (/var/log/wtmp의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654205 | medium | Changes to /var/run/utmp are audited (/var/run/utmp의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654210 | medium | Changes to /var/log/faillog are audited (/var/log/faillog의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654215 | medium | Changes to /var/log/lastlog are audited (/var/log/lastlog의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654220 | medium | Changes to /etc/sudoers are audited (/etc/sudoers의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654225 | medium | Changes to /etc/sudoers.d are audited (/etc/sudoers.d의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
+| UBTU-22-654235 | medium | Changes to /var/log/sudo.log are audited (/var/log/sudo.log의 변경을 감사 기록에 남김) | [`audit.path-audited`](#auditpath-audited) |
### Checks
@@ -1983,6 +2021,35 @@ Lists accounts that share a UID with another account.
**Fix.** Give each account a unique UID (usermod -u) and fix the ownership of its files.
+#### `audit.command-audited`
+
+The audit rules record every use of a command that the control names (감사 규칙이 점검 항목이 지정한 명령의 모든 사용을 기록함) — severity medium, evaluates an expression.
+
+Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter `path`, in the form that the STIG gives for commands: `-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset` (also written `-1`), so that what a logged-in user runs is recorded. A watch (`-w`) or a rule without the two `auid` filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
+**Why.** A privileged program that is not audited can be run without a record of who ran it.
+
+**Fix.** Add the rule for the program to a file in /etc/audit/rules.d (for example `-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage`) and load it with `augenrules --load`.
+
+**Parameters.**
+
+- `path` (string, default ``): The program to audit, as the STIG gives its path
+
+#### `audit.path-audited`
+
+The audit rules watch a path that the control names (감사 규칙이 점검 항목이 지정한 경로를 감시함) — severity medium, evaluates an expression.
+
+Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter `path` for the permissions named by `perms` (r, w, a, x, in that order, such as `wa` or `x`): a watch (`-w /etc/passwd -p wa`) or an always,exit rule with `path=` and `perm=`, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a `never` rule, do not count; a rule on a directory (`dir=`) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
+**Why.** Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
+**Fix.** Add a rule for the path to a file in /etc/audit/rules.d (for example `-w /etc/passwd -p wa -k usergroup_modification`) and load it with `augenrules --load`.
+
+**Parameters.**
+
+- `path` (string, default ``): The path to audit, without a trailing slash
+- `perms` (string, default `x`): The permissions to audit: any of r, w, a, x, in that order
+
#### `firewall.ufw-active`
ufw is turned on (ufw가 켜져 있음) — severity medium, evaluates an expression.
diff --git a/docs/stig.ko.md b/docs/stig.ko.md
index f40c593..def20a2 100644
--- a/docs/stig.ko.md
+++ b/docs/stig.ko.md
@@ -1,4 +1,4 @@
-
+
# DISA STIG 프로파일 (Ubuntu 22.04)
`stig-ubuntu2204`는 미 국방부가 DISA를 통해 공개하는
@@ -12,9 +12,9 @@ vmsctl explain UBTU-22-255040 # 점검 항목이 무엇을 보고, 왜
## 어디까지 점검하고, 무엇은 점검하지 않나
-**STIG 전체를 평가하는 것이 아닙니다.** V2R8의 점검 항목 188개 중 vmsctl이 판정할 수 있는 27개만 담았고, 나머지 161개는
-아무것도 말하지 않습니다. 감사 규칙, 시스템 명령과 라이브러리의 소유자·권한, 스마트 카드와 PKI, FIPS, 부트로더 비밀번호, 그래픽 세션,
-`sudo` 정책의 세부 사항, 대부분의 PAM 설정은 아직 점검하지 않습니다. 이 프로파일을 통과했다는 것은 그 27개가 통과했다는
+**STIG 전체를 평가하는 것이 아닙니다.** V2R8의 점검 항목 188개 중 vmsctl이 판정할 수 있는 65개만 담았고, 나머지 123개는
+아무것도 말하지 않습니다. 시스템 호출 감사 규칙, 시스템 명령과 라이브러리의 소유자·권한, 스마트 카드와 PKI, FIPS, 부트로더 비밀번호, 그래픽 세션,
+`sudo` 정책의 세부 사항, 대부분의 PAM 설정은 아직 점검하지 않습니다. 이 프로파일을 통과했다는 것은 그 65개가 통과했다는
뜻이지, 호스트가 STIG를 충족한다는 뜻이 아닙니다. 평가에는 STIG의 SCAP 콘텐츠나 체크리스트를 쓰고, 이 프로파일은 점검하는 범위에
대해 항목마다 근거와 함께 결과를 보는 데 쓰세요.
@@ -24,6 +24,7 @@ vmsctl explain UBTU-22-255040 # 점검 항목이 무엇을 보고, 왜
| 패키지 | 설치되어 있어야 함: `215010`(libpam-pwquality), `215015`(chrony), `251010`(ufw), `255010`(openssh-server), `431010`(apparmor), `653010`(auditd). 설치되어 있지 않아야 함: `215020`(systemd-timesyncd), `215025`(ntp), `215030`(rsh-server), `215035`(telnetd), `215040`(nfs-kernel-server) |
| 방화벽 | `251015`(ufw가 켜져 있음), `251020`(ufw 서비스가 부팅할 때 시작) |
| SSH | `255015`(서비스가 부팅할 때 시작), `255025`(빈 비밀번호와 사용자 환경 변수 금지), `255040`(X11 전달 금지) |
+| 감사 규칙 | 명령: `654010`, `654015`, `654020`, `654025`, `654030`, `654035`, `654040`(apparmor_parser, chacl, chage, chcon, chfn, chsh, crontab), `654050`, `654065`, `654070`, `654075`, `654080`, `654085`, `654090`, `654095`, `654100`, `654105`, `654110`, `654115`, `654120`, `654125`(gpasswd, mount, newgrp, pam_timestamp_check, passwd, setfacl, ssh-agent, ssh-keysign, su, sudo, sudoedit, umount, unix_update, usermod). `-w`로 감시하는 프로그램: `654045`(fdisk), `654055`(kmod), `654060`(modprobe). 파일: `654130`, `654135`, `654140`, `654145`, `654150`(group, gshadow, opasswd, passwd, shadow), `654190`, `654195`, `654200`, `654205`, `654210`, `654215`(저널, btmp, wtmp, utmp, faillog, lastlog), `654220`, `654225`(sudoers, sudoers.d), `654235`(sudo.log) |
| 계정과 비밀번호 | `411010`(root 잠금), `411015`(고유한 UID), `411025`(최소 사용 기간 1일), `411030`(최대 사용 기간 60일), `412030`(유휴 셸 15분), `611035`(15자), `611065`(빈 비밀번호 금지) |
(점검 항목 ID는 `UBTU-22-` 뒤에 번호가 붙은 것입니다.)
@@ -43,4 +44,9 @@ vmsctl이 직접 짧게 쓴 것입니다. 연결은 [ComplianceAsCode](https://g
연결 두 개는 STIG보다 엄격합니다(느슨하지는 않습니다). `UBTU-22-611035`가 쓰는 `accounts.password-min-length`는 양수 `dcredit`,
`ucredit` 크레딧을 `minlen`에서 빼므로, `minlen = 15`에 양수 크레딧을 함께 설정한 호스트는 STIG라면 통과시킬 것을 실패로 볼 수 있습니다.
-`accounts.password-max-age`는 0 이하의 값도 실패로 봅니다. 점검이 갖춰지는 대로 항목을 늘립니다(가장 큰 묶음은 감사 규칙입니다).
+`accounts.password-max-age`는 0 이하의 값도 실패로 봅니다. 감사 규칙은 실행 중인 커널이 아니라 호스트가 부팅할 때 불러오는 파일(`/etc/audit/rules.d/*.rules`, 없으면 `/etc/audit/audit.rules`)에서
+읽습니다. 부팅한 뒤 `auditctl`로 추가한 규칙은 보이지 않고, vmsctl이 읽을 수 없는 줄이 있으면 결과는 `ERROR`이며 통과로 처리하지 않습니다.
+명령 규칙은 STIG가 정한 형태(`-a always,exit -F path=... -F perm=x -F auid>=1000 -F auid!=unset`)일 때만 인정하고, 경로도 STIG의
+경로(`/usr/bin/su`가 아니라 `/bin/su`)여야 합니다. 사용자, 종료 코드, 성공 여부 같은 다른 필터로 범위가 좁아진 규칙은 인정하지 않고, 경로에
+대한 `never` 규칙이 있으면 그 경로를 빼며, 경로를 지정하지 않는 `never` 규칙이 있으면 결과는 `ERROR`입니다. 디렉터리에 건 규칙은 그
+디렉터리에만 해당합니다. 점검이 갖춰지는 대로 항목을 늘립니다(남은 가장 큰 묶음은 시스템 호출 감사 규칙입니다).
diff --git a/docs/stig.md b/docs/stig.md
index f484655..d7d7ec2 100644
--- a/docs/stig.md
+++ b/docs/stig.md
@@ -11,10 +11,10 @@ vmsctl explain UBTU-22-255040 # what a control looks at, why, how to fi
## What it covers, and what it does not
-**This is not a complete STIG assessment.** The profile has the 27 controls (of the 188 of V2R8) that vmsctl can decide, and says
-nothing about the other 161: the audit rules, the ownership and mode of system commands and libraries, smart cards and PKI, FIPS, the
+**This is not a complete STIG assessment.** The profile has the 65 controls (of the 188 of V2R8) that vmsctl can decide, and says
+nothing about the other 123: the audit rules for system calls, the ownership and mode of system commands and libraries, smart cards and PKI, FIPS, the
boot loader password, the graphical session, `sudo` policy details and most of the PAM settings are not checked yet. A scan that passes
-the profile means those 27 controls pass; it does not mean the host meets the STIG. Use the STIG's own SCAP content or checklist for an
+the profile means those 65 controls pass; it does not mean the host meets the STIG. Use the STIG's own SCAP content or checklist for an
assessment, and this profile for what it checks, with the evidence behind each result.
| Area | Controls |
@@ -23,6 +23,7 @@ assessment, and this profile for what it checks, with the evidence behind each r
| Packages | installed: `215010` (libpam-pwquality), `215015` (chrony), `251010` (ufw), `255010` (openssh-server), `431010` (apparmor), `653010` (auditd); not installed: `215020` (systemd-timesyncd), `215025` (ntp), `215030` (rsh-server), `215035` (telnetd), `215040` (nfs-kernel-server) |
| Firewall | `251015` (ufw turned on), `251020` (the ufw service starts at boot) |
| SSH | `255015` (the service starts at boot), `255025` (no empty passwords, no user environment), `255040` (no X11 forwarding) |
+| Audit rules | the commands: `654010`, `654015`, `654020`, `654025`, `654030`, `654035`, `654040` (apparmor_parser, chacl, chage, chcon, chfn, chsh, crontab), `654050`, `654065`, `654070`, `654075`, `654080`, `654085`, `654090`, `654095`, `654100`, `654105`, `654110`, `654115`, `654120`, `654125` (gpasswd, mount, newgrp, pam_timestamp_check, passwd, setfacl, ssh-agent, ssh-keysign, su, sudo, sudoedit, umount, unix_update, usermod); the programs watched with `-w`: `654045` (fdisk), `654055` (kmod), `654060` (modprobe); the files: `654130`, `654135`, `654140`, `654145`, `654150` (group, gshadow, opasswd, passwd, shadow), `654190`, `654195`, `654200`, `654205`, `654210`, `654215` (the journal, btmp, wtmp, utmp, faillog, lastlog), `654220`, `654225` (sudoers, sudoers.d), `654235` (sudo.log) |
| Accounts and passwords | `411010` (root locked), `411015` (unique UIDs), `411025` (minimum age 1 day), `411030` (maximum age 60 days), `412030` (idle shell timeout 15 minutes), `611035` (15 characters), `611065` (no empty passwords) |
(Control IDs are `UBTU-22-` followed by the number.)
@@ -43,5 +44,10 @@ standard written for Ubuntu 22.04 says nothing true about another system.
Two mappings are stricter than the STIG, never looser: `UBTU-22-611035` uses `accounts.password-min-length`, which subtracts positive
`dcredit` and `ucredit` credits from `minlen`, so a host that sets `minlen = 15` together with a positive credit can fail where the STIG would
-pass it; and `accounts.password-max-age` also fails a value of 0 or less. More controls come as the checks they need exist (the audit rules
-are the largest group).
+pass it; and `accounts.password-max-age` also fails a value of 0 or less. The audit rules are read from the files that the host loads at boot (`/etc/audit/rules.d/*.rules`, or `/etc/audit/audit.rules` without them),
+not from the running kernel: a rule added with `auditctl` since boot is not seen, and a line that vmsctl cannot read makes the result `ERROR`,
+never a pass. A command rule counts only in the form the STIG gives (`-a always,exit -F path=... -F perm=x -F auid>=1000 -F auid!=unset`); the
+path must be the STIG's own (`/bin/su`, not `/usr/bin/su`). A rule narrowed by another filter (a user, an exit code, success) does not count, a
+`never` rule for a path removes it, and a `never` rule that names no path makes the result `ERROR`; a rule on a directory counts for the directory
+only. More controls come as the checks they need exist (the audit rules for system
+calls are the largest group left).
diff --git a/internal/collect/accounts.go b/internal/collect/accounts.go
index 711b085..5e9e952 100644
--- a/internal/collect/accounts.go
+++ b/internal/collect/accounts.go
@@ -21,7 +21,7 @@ import (
// All returns every collector, for engine.New.
func All() []engine.Collector {
- return []engine.Collector{accountsCollector{}, shadowCollector{}, loginDefsCollector{}, sysctlCollector{}, sshdCollector{}, snmpCollector{}, firewallCollector{}, macCollector{}, updatesCollector{}, postfixCollector{}, bindCollector{}, nfsCollector{}, ftpCollector{}, sambaCollector{}, bannerCollector{}, rsyslogCollector{}, pamCollector{}, shellEnvCollector{}, packagesCollector{}, servicesCollector{}, socketsCollector{}, filesystemCollector{}, homesCollector{}}
+ return []engine.Collector{accountsCollector{}, shadowCollector{}, loginDefsCollector{}, sysctlCollector{}, sshdCollector{}, snmpCollector{}, firewallCollector{}, macCollector{}, auditCollector{}, updatesCollector{}, postfixCollector{}, bindCollector{}, nfsCollector{}, ftpCollector{}, sambaCollector{}, bannerCollector{}, rsyslogCollector{}, pamCollector{}, shellEnvCollector{}, packagesCollector{}, servicesCollector{}, socketsCollector{}, filesystemCollector{}, homesCollector{}}
}
// Accounts are the `accounts` facts: /etc/passwd and /etc/group.
diff --git a/internal/collect/audit.go b/internal/collect/audit.go
new file mode 100644
index 0000000..09d5b54
--- /dev/null
+++ b/internal/collect/audit.go
@@ -0,0 +1,351 @@
+package collect
+
+import (
+ "bufio"
+ "bytes"
+ "context"
+ "fmt"
+ "io/fs"
+ "path"
+ "reflect"
+ "slices"
+ "strings"
+
+ "github.com/with-developer/vmsctl/internal/engine"
+ "github.com/with-developer/vmsctl/internal/hostfs"
+)
+
+// Audit are the `audit` facts: what the audit rules that the host loads at boot audit, read from the files, not from the running
+// kernel (a rule added with auditctl since boot is not seen; see the `services` facts for whether auditd starts). The files are
+// /etc/audit/rules.d/*.rules in name order, which is what augenrules merges into /etc/audit/audit.rules; /etc/audit/audit.rules
+// itself when there is no rules.d file. A rule counts only when it audits every event for its path: a rule narrowed by another
+// filter (a user, an exit code, success) is left out, and a "never" rule for a path removes the path. A line that cannot be read
+// makes the facts incomplete.
+type Audit struct {
+ // Present is true when a rules file exists.
+ Present bool `json:"present"`
+ // Paths holds, for every path that a watch (-w) or an always,exit rule with path= or dir= and perm= audits, the permissions it
+ // audits (the union over the rules, in the order r, w, a, x: "wa", "x"), whoever the user is. A directory has no trailing "/".
+ // A rule on a directory is stored under the directory, not under the files in it.
+ Paths map[string]AuditPath `json:"paths"`
+ // UserPaths is the same for the rules written for logged-in users: always,exit rules with path=, perm=, auid>=1000 and
+ // auid!=unset (also written -1 or 4294967295), the form that the STIG asks for the commands it names.
+ UserPaths map[string]AuditPath `json:"user_paths"`
+}
+
+// AuditPath is what is audited about one path.
+type AuditPath struct {
+ Perms string `json:"perms"`
+ // Source is the file and line of the first rule that audits it.
+ Source string `json:"source"`
+}
+
+const (
+ auditRulesDir = "/etc/audit/rules.d"
+ auditRulesFile = "/etc/audit/audit.rules"
+ auditMaxFiles = 100
+ auditMaxRules = 5000
+ auditMaxLine = 4096
+ auditMaxFileBytes = 1 << 20
+)
+
+type auditCollector struct{}
+
+func (auditCollector) Name() string { return "audit" }
+func (auditCollector) Version() int { return 1 }
+func (auditCollector) Access() engine.Access { return engine.AccessFilesystem }
+func (auditCollector) Type() reflect.Type { return reflect.TypeFor[Audit]() }
+
+// auditState is what the rules read so far amount to.
+type auditState struct {
+ a *Audit
+ rules int
+ // never are the paths that a never rule names: the kernel takes the first rule that matches an event, so a never rule before
+ // or after an always rule for the path keeps the event out of the audit log.
+ never map[string]bool
+}
+
+func (auditCollector) Collect(_ context.Context, h *hostfs.Host) (engine.Facts, error) {
+ st := &auditState{a: &Audit{Paths: map[string]AuditPath{}, UserPaths: map[string]AuditPath{}}, never: map[string]bool{}}
+ var skipped []string
+ files, more, err := auditFiles(h)
+ if err != nil {
+ return engine.Facts{Value: st.a, Complete: false, Skipped: []string{fmt.Sprintf("%s: %v", auditRulesDir, err)}}, nil
+ }
+ if more {
+ skipped = append(skipped, fmt.Sprintf("%s: more than %d rules files", auditRulesDir, auditMaxFiles))
+ }
+ st.a.Present = len(files) > 0
+ for _, file := range files {
+ if fi, err := h.FS.Stat(file); err == nil && fi.Size > auditMaxFileBytes {
+ skipped = append(skipped, file+": too large")
+ continue
+ }
+ data, err := h.FS.ReadFile(file)
+ if err != nil {
+ skipped = append(skipped, fmt.Sprintf("%s: %v", file, err))
+ continue
+ }
+ skipped = append(skipped, st.parse(file, data)...)
+ }
+ for p := range st.never {
+ delete(st.a.Paths, p)
+ delete(st.a.UserPaths, p)
+ }
+ if len(skipped) > 0 {
+ return engine.Facts{Value: st.a, Complete: false, Skipped: skipped}, nil
+ }
+ return engine.Facts{Value: st.a, Complete: true}, nil
+}
+
+// auditFiles are the rules files in the order they are loaded: rules.d/*.rules by name (the C locale order augenrules uses; a
+// symbolic link is followed, as augenrules does), or audit.rules when rules.d has none. A missing directory is not an error. more
+// is true when there were more files than are read.
+func auditFiles(h *hostfs.Host) (files []string, more bool, err error) {
+ entries, err := h.FS.ReadDir(auditRulesDir)
+ if err != nil && !hostfs.IsMissing(err) {
+ return nil, false, err
+ }
+ for _, e := range entries {
+ if (e.Mode.IsRegular() || e.Mode&fs.ModeSymlink != 0) && strings.HasSuffix(e.Path, ".rules") {
+ files = append(files, path.Join(auditRulesDir, path.Base(e.Path)))
+ }
+ }
+ slices.Sort(files)
+ if len(files) > auditMaxFiles {
+ files, more = files[:auditMaxFiles], true
+ }
+ if len(files) > 0 {
+ return files, more, nil
+ }
+ if _, err := h.FS.Stat(auditRulesFile); err == nil {
+ return []string{auditRulesFile}, false, nil
+ } else if !hostfs.IsMissing(err) {
+ return nil, false, err
+ }
+ return nil, false, nil
+}
+
+// auditOptions are lines that set how the audit system runs and add no rule: the word, and at most one value.
+var auditOptions = map[string]bool{"-b": true, "-f": true, "-r": true, "-e": true, "-c": true, "-i": true, "--backlog_wait_time": true, "--loginuid-immutable": true, "--reset-lost": true}
+
+// parse reads the rules of one file, and returns what it could not read: a line that it does not understand may be the rule that a
+// check looks for, or a "-d" that removes one, so the facts are incomplete and a check cannot pass on them.
+func (st *auditState) parse(file string, data []byte) []string {
+ var skipped []string
+ sc := bufio.NewScanner(bytes.NewReader(data))
+ sc.Buffer(make([]byte, 0, 64<<10), auditMaxLine*4)
+ for n := 1; sc.Scan(); n++ {
+ line := strings.TrimSpace(sc.Text())
+ if line == "" || line[0] == '#' {
+ continue
+ }
+ source := fmt.Sprintf("%s:%d", file, n)
+ if len(line) > auditMaxLine {
+ skipped = append(skipped, source+": line too long")
+ continue
+ }
+ words := strings.Fields(line)
+ switch {
+ case words[0] == "-D" && len(words) == 1:
+ // what comes before it is deleted
+ st.a.Paths, st.a.UserPaths, st.never, st.rules = map[string]AuditPath{}, map[string]AuditPath{}, map[string]bool{}, 0
+ continue
+ case (auditOptions[words[0]] && len(words) <= 2) || (strings.HasPrefix(words[0], "--") && strings.Contains(words[0], "=") && len(words) == 1):
+ continue
+ case words[0] != "-w" && words[0] != "-a" && words[0] != "-A":
+ skipped = append(skipped, source+": "+words[0]+" is not read")
+ continue
+ }
+ if st.rules >= auditMaxRules {
+ skipped = append(skipped, file+": more rules than are read")
+ return skipped
+ }
+ r, ok := parseAuditRule(words, source)
+ if !ok {
+ skipped = append(skipped, source+": the rule is not read")
+ continue
+ }
+ st.rules++
+ if why := st.add(r); why != "" {
+ skipped = append(skipped, source+": "+why)
+ }
+ }
+ if err := sc.Err(); err != nil {
+ skipped = append(skipped, fmt.Sprintf("%s: %v", file, err))
+ }
+ return skipped
+}
+
+// auditRule is one rule of the files that audits (or, with never, spares) something.
+type auditRule struct {
+ // kind is "watch" (-w) or "syscall" (-a).
+ kind string
+ // action and list are those of an -a rule ("always", "exit"); empty for a watch.
+ action, list string
+ // path is the path of a watch, or the path= or dir= of an -a rule, without a trailing "/".
+ path string
+ // perms are the audited permissions in the order r, w, a, x; of a watch without -p, all of them.
+ perms string
+ // fields are the other filters ("arch=b64", "auid>=1000"), and "S" when the rule names system calls.
+ fields []string
+ source string
+}
+
+func parseAuditRule(words []string, source string) (auditRule, bool) {
+ r := auditRule{source: source}
+ perm, hasPerm := "", false
+ for i := 0; i < len(words); i++ {
+ w := words[i]
+ next := func() (string, bool) {
+ if i+1 >= len(words) {
+ return "", false
+ }
+ i++
+ return words[i], true
+ }
+ switch w {
+ case "-w":
+ p, ok := next()
+ if !ok || r.kind != "" {
+ return r, false
+ }
+ r.kind, r.path = "watch", cleanAuditPath(p)
+ case "-a", "-A":
+ v, ok := next()
+ if !ok || r.kind != "" {
+ return r, false
+ }
+ r.kind = "syscall"
+ for _, part := range strings.Split(v, ",") {
+ switch part {
+ case "always", "never":
+ r.action = part
+ case "exit", "entry", "task", "user", "exclude", "filesystem":
+ r.list = part
+ default:
+ return r, false
+ }
+ }
+ case "-p":
+ p, ok := next()
+ if !ok {
+ return r, false
+ }
+ perm, hasPerm = p, true
+ case "-k":
+ if _, ok := next(); !ok {
+ return r, false
+ }
+ case "-S":
+ v, ok := next()
+ if !ok {
+ return r, false
+ }
+ if v != "all" {
+ r.fields = append(r.fields, "S") // a rule for some system calls only: not a rule for a path
+ }
+ case "-F", "-C":
+ v, ok := next()
+ if !ok {
+ return r, false
+ }
+ v = strings.ReplaceAll(v, " ", "")
+ if w == "-C" {
+ r.fields = append(r.fields, "C:"+v)
+ continue
+ }
+ switch {
+ case strings.HasPrefix(v, "path="), strings.HasPrefix(v, "dir="):
+ r.path = cleanAuditPath(v[strings.Index(v, "=")+1:])
+ case strings.HasPrefix(v, "perm="):
+ perm, hasPerm = v[len("perm="):], true
+ default:
+ r.fields = append(r.fields, v)
+ }
+ default:
+ return r, false // -R, -d, -l or something this does not know: not read
+ }
+ }
+ if r.kind == "" {
+ return r, false
+ }
+ if hasPerm {
+ // auditctl refuses anything but r, w, x and a, each once: such a line loads nothing
+ for i, c := range []byte(perm) {
+ if !strings.ContainsRune("rwxa", rune(c)) || strings.IndexByte(perm[:i], c) >= 0 {
+ return r, false
+ }
+ }
+ } else if r.kind == "watch" {
+ perm = "rwax" // a watch without -p audits every kind of access
+ }
+ r.perms = canonicalAuditPerms(perm)
+ return r, true
+}
+
+// harmlessAuditField is a filter that does not narrow what a rule for a path audits for logged-in users: the architecture, and the two
+// auid filters of the STIG (the user ID that logged in is at least 1000, and is not the unset value 4294967295).
+func harmlessAuditField(f string) bool {
+ return strings.HasPrefix(f, "arch=") || f == "auid>=1000" || f == "auid!=unset" || f == "auid!=-1" || f == "auid!=4294967295"
+}
+
+// add records what r audits, and returns why it could not tell (for a rule that may keep events out of the log).
+func (st *auditState) add(r auditRule) string {
+ a := st.a
+ if r.kind == "syscall" && r.action == "never" && r.list == "exit" {
+ if r.path == "" {
+ // a never rule that is about no path can keep any event out
+ return "a never rule that names no path is not judged"
+ }
+ st.never[r.path] = true
+ return ""
+ }
+ if r.path == "" || r.perms == "" {
+ return ""
+ }
+ if r.kind == "syscall" && (r.action != "always" || r.list != "exit") {
+ return ""
+ }
+ for _, f := range r.fields {
+ if !harmlessAuditField(f) {
+ return "" // narrowed by another filter: it does not audit every event of the path
+ }
+ }
+ merge := func(m map[string]AuditPath) {
+ cur := m[r.path]
+ cur.Perms = canonicalAuditPerms(cur.Perms + r.perms)
+ if cur.Source == "" {
+ cur.Source = r.source
+ }
+ m[r.path] = cur
+ }
+ merge(a.Paths)
+ if r.kind == "syscall" && slices.Contains(r.fields, "auid>=1000") &&
+ (slices.Contains(r.fields, "auid!=unset") || slices.Contains(r.fields, "auid!=-1") || slices.Contains(r.fields, "auid!=4294967295")) {
+ merge(a.UserPaths)
+ }
+ return ""
+}
+
+// cleanAuditPath drops the trailing "/" of a directory, so a watch of /etc/sudoers.d/ and of /etc/sudoers.d are the same.
+func cleanAuditPath(p string) string {
+ if len(p) > 1 {
+ p = strings.TrimRight(p, "/")
+ if p == "" {
+ p = "/"
+ }
+ }
+ return p
+}
+
+// canonicalAuditPerms keeps the letters r, w, a and x of s, once each, in that order.
+func canonicalAuditPerms(s string) string {
+ var out []byte
+ for _, c := range []byte("rwax") {
+ if strings.IndexByte(s, c) >= 0 {
+ out = append(out, c)
+ }
+ }
+ return string(out)
+}
diff --git a/internal/collect/audit_test.go b/internal/collect/audit_test.go
new file mode 100644
index 0000000..dc31e86
--- /dev/null
+++ b/internal/collect/audit_test.go
@@ -0,0 +1,198 @@
+package collect
+
+import (
+ "context"
+ "fmt"
+ "strings"
+ "testing"
+
+ "github.com/with-developer/vmsctl/internal/hostfs"
+)
+
+func auditOf(t *testing.T, m *hostfs.MemFS) (*Audit, bool, []string) {
+ t.Helper()
+ got, err := auditCollector{}.Collect(context.Background(), hostfs.NewTestHost(m, nil, false))
+ if err != nil {
+ t.Fatal(err)
+ }
+ return got.Value.(*Audit), got.Complete, got.Skipped
+}
+
+func rulesFS(files map[string]string) *hostfs.MemFS {
+ m := hostfs.NewMemFS().AddDir("/etc", 0o755, 0, 0).AddDir("/etc/audit", 0o750, 0, 0).AddDir("/etc/audit/rules.d", 0o750, 0, 0)
+ for name, content := range files {
+ m.AddFile(name, content, 0o640, 0, 0)
+ }
+ return m
+}
+
+// The rules file that the auditd package of Ubuntu 22.04 installs sets how the audit system runs and audits nothing.
+func TestAuditDefaultRulesOfUbuntu(t *testing.T) {
+ a, complete, skipped := auditOf(t, fixtureFS(t, "audit/ubuntu-22.04"))
+ if !complete || !a.Present || len(a.Paths) != 0 {
+ t.Errorf("complete %v %v, %+v", complete, skipped, a)
+ }
+}
+
+// What the fix text of the STIG asks for is read as the STIG's check reads it: the commands as rules for logged-in users, the files
+// and the modules as watches.
+func TestAuditStigRules(t *testing.T) {
+ a, complete, skipped := auditOf(t, fixtureFS(t, "audit/stig-ubuntu-22.04"))
+ if !complete {
+ t.Fatalf("incomplete: %v", skipped)
+ }
+ for _, p := range []string{"/usr/bin/chage", "/usr/bin/sudo", "/bin/su", "/sbin/unix_update", "/usr/lib/openssh/ssh-keysign", "/usr/sbin/usermod"} {
+ if got := a.UserPaths[p]; got.Perms != "x" || !strings.HasPrefix(got.Source, "/etc/audit/rules.d/stig.rules:") {
+ t.Errorf("%s as a command rule: %+v", p, got)
+ }
+ }
+ for p, want := range map[string]string{"/etc/passwd": "wa", "/etc/shadow": "wa", "/etc/sudoers.d": "wa", "/var/log/journal": "wa", "/var/run/utmp": "wa", "/usr/sbin/fdisk": "x", "/sbin/modprobe": "x", "/bin/kmod": "x", "/usr/bin/chage": "x"} {
+ if got := a.Paths[p].Perms; got != want {
+ t.Errorf("%s audits %q, want %q", p, got, want)
+ }
+ }
+ if _, ok := a.UserPaths["/etc/passwd"]; ok || a.UserPaths["/usr/sbin/fdisk"].Perms != "" {
+ t.Error("a watch counted as a rule for logged-in users")
+ }
+}
+
+func TestAuditRuleForms(t *testing.T) {
+ for _, tc := range []struct {
+ name, rules string
+ path string
+ perms string // in Paths
+ user bool // in UserPaths
+ }{
+ {"a watch without -p audits everything", "-w /etc/x\n", "/etc/x", "rwax", false},
+ {"a watch with -p", "-w /etc/x -p wa -k k\n", "/etc/x", "wa", false},
+ {"a trailing slash does not matter", "-w /etc/sudoers.d/ -p wa\n", "/etc/sudoers.d", "wa", false},
+ {"permissions of several rules add up", "-w /etc/x -p w\n-w /etc/x -p x\n", "/etc/x", "wx", false},
+ {"dir= is a path", "-a always,exit -F dir=/etc/y -F perm=wa -k k\n", "/etc/y", "wa", false},
+ {"the order of action and list does not matter", "-a exit,always -F path=/usr/bin/z -F perm=x -F auid>=1000 -F auid!=-1\n", "/usr/bin/z", "x", true},
+ {"auid!=4294967295 is auid!=unset", "-a always,exit -F path=/usr/bin/z -F perm=x -F auid>=1000 -F auid!=4294967295\n", "/usr/bin/z", "x", true},
+ {"without the auid filters it is not for logged-in users", "-a always,exit -F path=/usr/bin/z -F perm=x\n", "/usr/bin/z", "x", false},
+ {"auid>=1000 alone is not enough", "-a always,exit -F path=/usr/bin/z -F perm=x -F auid>=1000\n", "/usr/bin/z", "x", false},
+ {"a never rule audits nothing", "-a never,exit -F path=/usr/bin/z -F perm=x\n", "/usr/bin/z", "", false},
+ {"a rule on another list audits nothing here", "-a always,user -F path=/usr/bin/z -F perm=x\n", "/usr/bin/z", "", false},
+ {"-S all is the STIG's own form", "-a always,exit -S all -F path=/usr/bin/z -F perm=x -F auid>=1000 -F auid!=-1\n", "/usr/bin/z", "x", true},
+ {"a rule for some system calls is not a rule for a path", "-a always,exit -F arch=b64 -S open -F path=/etc/x -F perm=wa\n", "/etc/x", "", false},
+ {"narrowed to one user", "-a always,exit -F path=/etc/x -F perm=wa -F auid=1000\n", "/etc/x", "", false},
+ {"narrowed to a uid", "-a always,exit -F path=/usr/bin/z -F perm=x -F auid>=1000 -F auid!=unset -F uid=0\n", "/usr/bin/z", "", false},
+ {"narrowed to a failure", "-a always,exit -F path=/etc/x -F perm=wa -F success=0\n", "/etc/x", "", false},
+ {"an architecture does not narrow", "-a always,exit -F arch=b64 -F path=/etc/x -F perm=wa\n", "/etc/x", "wa", false},
+ {"a never rule for the path after it removes it", "-w /etc/x -p wa\n-a never,exit -F path=/etc/x\n", "/etc/x", "", false},
+ {"a never rule for the path before it removes it too", "-a never,exit -F path=/etc/x\n-w /etc/x -p wa\n", "/etc/x", "", false},
+ {"a never rule for another path leaves it", "-w /etc/x -p wa\n-a never,exit -F path=/etc/y\n", "/etc/x", "wa", false},
+ {"a comment is not a rule", "# -w /etc/x -p wa\n", "/etc/x", "", false},
+ {"-D deletes what came before", "-w /etc/x -p wa\n-D\n", "/etc/x", "", false},
+ {"what follows -D counts", "-D\n-w /etc/x -p wa\n", "/etc/x", "wa", false},
+ } {
+ a, complete, skipped := auditOf(t, rulesFS(map[string]string{"/etc/audit/rules.d/a.rules": tc.rules}))
+ if !complete {
+ t.Errorf("%s: incomplete: %v", tc.name, skipped)
+ }
+ if got := a.Paths[tc.path].Perms; got != tc.perms {
+ t.Errorf("%s: Paths = %q, want %q", tc.name, got, tc.perms)
+ }
+ if _, ok := a.UserPaths[tc.path]; ok != tc.user {
+ t.Errorf("%s: in UserPaths = %v, want %v", tc.name, ok, tc.user)
+ }
+ }
+}
+
+// Rules files are read in name order, and audit.rules only when there is no .rules file in rules.d; -D of a later file deletes
+// the rules of an earlier one, as the loader does.
+func TestAuditFilesAndOrder(t *testing.T) {
+ a, _, _ := auditOf(t, rulesFS(map[string]string{
+ "/etc/audit/rules.d/10-a.rules": "-w /etc/a -p wa\n",
+ "/etc/audit/rules.d/99-b.rules": "-D\n-w /etc/b -p wa\n",
+ "/etc/audit/rules.d/notes.txt": "-w /etc/c -p wa\n",
+ "/etc/audit/audit.rules": "-w /etc/d -p wa\n",
+ }))
+ if _, ok := a.Paths["/etc/a"]; ok || a.Paths["/etc/b"].Perms != "wa" || len(a.Paths) != 1 {
+ t.Errorf("paths = %+v", a.Paths)
+ }
+ a, _, _ = auditOf(t, rulesFS(map[string]string{"/etc/audit/audit.rules": "-w /etc/d -p wa\n"}))
+ if a.Paths["/etc/d"].Perms != "wa" || !a.Present {
+ t.Errorf("audit.rules alone: %+v", a)
+ }
+ a, complete, _ := auditOf(t, hostfs.NewMemFS().AddDir("/etc", 0o755, 0, 0))
+ if a.Present || len(a.Paths) != 0 || !complete {
+ t.Errorf("no audit: %+v, complete %v", a, complete)
+ }
+}
+
+// A line that cannot be read may be the rule a check looks for, or a "-d" that removes it: the facts are incomplete, never a pass.
+func TestAuditUnreadableLinesMakeTheFactsIncomplete(t *testing.T) {
+ for name, rules := range map[string]string{
+ "a delete rule": "-w /etc/x -p wa\n-d always,exit -F path=/etc/x\n",
+ "an include": "-R /etc/other.rules\n",
+ "an unknown word": "-w /etc/x -p wa -Z\n",
+ "a missing value": "-w\n",
+ "a bad list": "-a always,bogus -F path=/x\n",
+ "an unknown line": "something odd\n",
+ "a never rule that names no path": "-w /etc/x -p wa\n-a never,exit -F auid=1000\n",
+ "an option and a rule on one line": "-e 1 -w /etc/x -p wa\n",
+ "a delete after an option": "-b 8192 -D\n",
+ "a permission that auditctl refuses": "-w /etc/x -p wq\n",
+ "a permission twice": "-w /etc/x -p ww\n",
+ "a bad perm=": "-a always,exit -F path=/etc/x -F perm=z\n",
+ "a rule inside a rule": "-w /etc/x -a always,exit\n",
+ "spaces inside a field": "-a always,exit -F path=/usr/bin/z -F perm=x -F auid >= 1000\n",
+ } {
+ a, complete, skipped := auditOf(t, rulesFS(map[string]string{"/etc/audit/rules.d/a.rules": rules}))
+ if complete || len(skipped) == 0 {
+ t.Errorf("%s: complete %v, skipped %v, %+v", name, complete, skipped, a)
+ }
+ }
+}
+
+// A rules file that is a symbolic link is read (augenrules follows it), and a link to nowhere makes the facts incomplete.
+func TestAuditSymlinkedRulesFile(t *testing.T) {
+ m := rulesFS(map[string]string{"/opt/hardening/stig.rules": "-w /etc/passwd -p wa\n"})
+ m.AddSymlink("/etc/audit/rules.d/50-stig.rules", "/opt/hardening/stig.rules")
+ a, complete, skipped := auditOf(t, m)
+ if !complete || a.Paths["/etc/passwd"].Perms != "wa" {
+ t.Errorf("a link to a rules file: complete %v %v, %+v", complete, skipped, a.Paths)
+ }
+ m = rulesFS(nil)
+ m.AddSymlink("/etc/audit/rules.d/50-stig.rules", "/opt/missing.rules")
+ if _, complete, _ = auditOf(t, m); complete {
+ t.Error("a link to nowhere was taken as no rules")
+ }
+}
+
+// More rules files than are read make the facts incomplete: the one that is left out may hold the rule, or a -D.
+func TestAuditTooManyFiles(t *testing.T) {
+ files := map[string]string{}
+ for i := 0; i < auditMaxFiles+5; i++ {
+ files[fmt.Sprintf("/etc/audit/rules.d/%03d.rules", i)] = "-w /etc/x -p wa\n"
+ }
+ if _, complete, skipped := auditOf(t, rulesFS(files)); complete || len(skipped) == 0 {
+ t.Errorf("complete %v, %v", complete, skipped)
+ }
+}
+
+// A file over the limit is not read.
+func TestAuditBigFileIsNotRead(t *testing.T) {
+ m := rulesFS(map[string]string{"/etc/audit/rules.d/a.rules": strings.Repeat("# padding\n", auditMaxFileBytes/9) + "-w /etc/x -p wa\n"})
+ a, complete, _ := auditOf(t, m)
+ if complete || len(a.Paths) != 0 {
+ t.Errorf("complete %v, %+v", complete, a.Paths)
+ }
+}
+
+func TestAuditLimits(t *testing.T) {
+ var b strings.Builder
+ for i := 0; i < auditMaxRules+10; i++ {
+ fmt.Fprintf(&b, "-w /etc/f%d -p wa\n", i)
+ }
+ a, complete, skipped := auditOf(t, rulesFS(map[string]string{"/etc/audit/rules.d/a.rules": b.String()}))
+ if complete || len(a.Paths) != auditMaxRules || len(skipped) == 0 {
+ t.Errorf("complete %v, %d paths, %v", complete, len(a.Paths), skipped)
+ }
+ _, complete, _ = auditOf(t, rulesFS(map[string]string{"/etc/audit/rules.d/a.rules": "-w /etc/" + strings.Repeat("x", auditMaxLine) + " -p wa\n"}))
+ if complete {
+ t.Error("a line over the limit was read")
+ }
+}
diff --git a/internal/collect/fuzz_test.go b/internal/collect/fuzz_test.go
index 6546f6d..9e24bf3 100644
--- a/internal/collect/fuzz_test.go
+++ b/internal/collect/fuzz_test.go
@@ -157,6 +157,10 @@ func FuzzSysctl(f *testing.F) {
fuzzCollector(f, sysctlCollector{}, "/etc/sysctl.d/10-kernel-hardening.conf", "sysctl-ubuntu-24.04", "sysctl-rocky-9")
}
+func FuzzAuditRules(f *testing.F) {
+ fuzzCollector(f, auditCollector{}, "/etc/audit/rules.d/stig.rules", "audit/stig-ubuntu-22.04")
+}
+
func FuzzSelinuxConfig(f *testing.F) {
fuzzCollector(f, macCollector{}, "/etc/selinux/config", "mac/rocky-9", "mac/amazonlinux-2023", "mac/centos-7")
}
diff --git a/internal/collect/testdata/audit/stig-ubuntu-22.04/etc/audit/rules.d/stig.rules b/internal/collect/testdata/audit/stig-ubuntu-22.04/etc/audit/rules.d/stig.rules
new file mode 100644
index 0000000..b0db87b
--- /dev/null
+++ b/internal/collect/testdata/audit/stig-ubuntu-22.04/etc/audit/rules.d/stig.rules
@@ -0,0 +1,66 @@
+## The rules that the fix text of the Ubuntu 22.04 STIG (V2R8, UBTU-22-654xxx) asks for, as the STIG gives them.
+-D
+-b 8192
+-f 1
+-a always,exit -F path=/sbin/apparmor_parser -F perm=x -F auid>=1000 -F auid!=unset -k perm_chng
+-a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_chng
+-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage
+-a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -k perm_chng
+-a always,exit -F path=/usr/bin/chfn -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chfn
+-a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -k priv_cmd
+-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -k privileged-crontab
+-w /etc/cron.d/ -p wa -k cronjobs
+-w /var/spool/cron/ -p wa -k cronjobs
+-w /usr/sbin/fdisk -p x -k fdisk
+-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-gpasswd
+-w /bin/kmod -p x -k modules
+-w /sbin/modprobe -p x -k modules
+-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-mount
+-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -k priv_cmd
+-a always,exit -F path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset -k privileged-pam_timestamp_check
+-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-passwd
+-a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_chng
+-a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh
+-a always,exit -F path=/usr/lib/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh
+-a always,exit -F path=/bin/su -F perm=x -F auid>=1000 -F auid!=unset -k privileged-priv_change
+-a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -k priv_cmd
+-a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -k priv_cmd
+-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-umount
+-a always,exit -F path=/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix-update
+-a always,exit -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset -k privileged-usermod
+-w /etc/group -p wa -k usergroup_modification
+-w /etc/gshadow -p wa -k usergroup_modification
+-w /etc/security/opasswd -p wa -k usergroup_modification
+-w /etc/passwd -p wa -k usergroup_modification
+-w /etc/shadow -p wa -k usergroup_modification
+-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=unset -k perm_chng
+-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=unset -k perm_chng
+-a always,exit -F arch=b32 -S chown,fchown,fchownat,lchown -F auid>=1000 -F auid!=unset -k perm_chng
+-a always,exit -F arch=b64 -S chown,fchown,fchownat,lchown -F auid>=1000 -F auid!=unset -k perm_chng
+-a always,exit -F arch=b32 -S creat,open,openat,open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k perm_access
+-a always,exit -F arch=b32 -S creat,open,openat,open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k perm_access
+-a always,exit -F arch=b64 -S creat,open,openat,open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k perm_access
+-a always,exit -F arch=b64 -S creat,open,openat,open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k perm_access
+-a always,exit -F arch=b32 -S delete_module -F auid>=1000 -F auid!=unset -k module_chng
+-a always,exit -F arch=b64 -S delete_module -F auid>=1000 -F auid!=unset -k module_chng
+-a always,exit -F arch=b32 -S init_module,finit_module -F auid>=1000 -F auid!=unset -k module_chng
+-a always,exit -F arch=b64 -S init_module,finit_module -F auid>=1000 -F auid!=unset -k module_chng
+-a always,exit -F arch=b32 -S setxattr,fsetxattr,lsetxattr,removexattr,fremovexattr,lremovexattr -F auid=0 -k perm_mod
+-a always,exit -F arch=b32 -S setxattr,fsetxattr,lsetxattr,removexattr,fremovexattr,lremovexattr -F auid>=1000 -F auid!=unset -k perm_mod
+-a always,exit -F arch=b64 -S setxattr,fsetxattr,lsetxattr,removexattr,fremovexattr,lremovexattr -F auid=0 -k perm_mod
+-a always,exit -F arch=b64 -S setxattr,fsetxattr,lsetxattr,removexattr,fremovexattr,lremovexattr -F auid>=1000 -F auid!=unset -k perm_mod
+-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat,rmdir -F auid>=1000 -F auid!=unset -k delete
+-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat,rmdir -F auid>=1000 -F auid!=unset -k delete
+-w /var/log/journal -p wa -k systemd_journal
+-w /var/log/btmp -p wa -k logins
+-w /var/log/wtmp -p wa -k logins
+-w /var/run/utmp -p wa -k logins
+-w /var/log/faillog -p wa -k logins
+-w /var/log/lastlog -p wa -k logins
+-w /etc/sudoers -p wa -k privilege_modification
+-w /etc/sudoers.d -p wa -k privilege_modification
+-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k execpriv
+-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k execpriv
+-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k execpriv
+-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k execpriv
+-w /var/log/sudo.log -p wa -k maintenance
diff --git a/internal/collect/testdata/audit/ubuntu-22.04/etc/audit/rules.d/audit.rules b/internal/collect/testdata/audit/ubuntu-22.04/etc/audit/rules.d/audit.rules
new file mode 100644
index 0000000..faf0121
--- /dev/null
+++ b/internal/collect/testdata/audit/ubuntu-22.04/etc/audit/rules.d/audit.rules
@@ -0,0 +1,12 @@
+## First rule - delete all
+-D
+
+## Increase the buffers to survive stress events.
+## Make this bigger for busy systems
+-b 8192
+
+## This determine how long to wait in burst of events
+--backlog_wait_time 60000
+
+## Set failure mode to syslog
+-f 1
diff --git a/internal/rulesdoc/site.go b/internal/rulesdoc/site.go
index 4190829..7f86728 100644
--- a/internal/rulesdoc/site.go
+++ b/internal/rulesdoc/site.go
@@ -66,7 +66,7 @@ func RenderStigSiteEn(content *engine.Content, profileID string) (string, error)
title: fmt.Sprintf("Ubuntu 22.04 STIG: the %d controls vmsctl checks, and how to fix them — vmsctl", len(p.Controls)),
desc: fmt.Sprintf("The %d controls of the DISA STIG for Canonical Ubuntu 22.04 LTS (%s) that vmsctl checks on a server: what each one looks at, why it matters and how to fix it. Not a complete STIG assessment.", len(p.Controls), stigVersion),
h1: fmt.Sprintf("Ubuntu 22.04 STIG: the %d controls vmsctl checks", len(p.Controls)),
- lead: fmt.Sprintf("These are %d of the %d controls of the DISA Security Technical Implementation Guide for Canonical Ubuntu 22.04 LTS (%s) that vmsctl can decide by reading the host, each with what it looks at, why it matters and how to fix it. This is not a complete STIG assessment: the other controls (audit rules, file ownership of system commands, smart cards, FIPS, the boot loader password, ...) are not checked yet. The control IDs and importance are the STIG's, a US government work; the titles and texts are vmsctl's own. A check is mapped only when it decides exactly what the STIG requires. On a host that is not Ubuntu 22.04 every control is not applicable.", len(p.Controls), stigControls, stigVersion),
+ lead: fmt.Sprintf("These are %d of the %d controls of the DISA Security Technical Implementation Guide for Canonical Ubuntu 22.04 LTS (%s) that vmsctl can decide by reading the host, each with what it looks at, why it matters and how to fix it. This is not a complete STIG assessment: the other controls (the audit rules for system calls, file ownership of system commands, smart cards, FIPS, the boot loader password, ...) are not checked yet. The control IDs and importance are the STIG's, a US government work; the titles and texts are vmsctl's own. A check is mapped only when it decides exactly what the STIG requires. On a host that is not Ubuntu 22.04 every control is not applicable.", len(p.Controls), stigControls, stigVersion),
cmd: "curl -fsSL https://raw.githubusercontent.com/with-developer/vmsctl/main/install.sh | sh\nsudo vmsctl scan --profile stig-ubuntu2204",
hint: "Every result carries its evidence (the value, the file and the line); vmsctl explain UBTU-22-255040 prints a control in the terminal. What the profile covers: docs/stig.md. About the tool: vmsctl.",
tocLabel: "Controls", why: "Why it matters.", fix: "How to fix it.", human: "A person decides.", importance: "Importance", handOnly: "This control has no automatic check: a person reviews it.", params: "Values used for this control",
diff --git a/profiles/stig-ubuntu2204.yaml b/profiles/stig-ubuntu2204.yaml
index 0fb1cef..a382e5f 100644
--- a/profiles/stig-ubuntu2204.yaml
+++ b/profiles/stig-ubuntu2204.yaml
@@ -3,11 +3,11 @@
# STIG is a US government work; the titles are vmsctl's own short wording.
#
# A check is mapped to a control only when it decides exactly what the STIG requires (or, where the STIG fixes a number, with that
-# number as the parameter): a looser check would let a host pass a control it fails. The rest of the STIG (audit rules, file
-# ownership of system commands, smart cards, FIPS, a boot loader password, ...) is not checked yet, so this profile says nothing about it:
+# number as the parameter): a looser check would let a host pass a control it fails. The rest of the STIG (the audit rules for system
+# calls, file ownership of system commands, smart cards, FIPS, a boot loader password, ...) is not checked yet, so this profile says nothing about it:
# it is not a complete STIG assessment. See docs/stig.md.
id: stig-ubuntu2204
-revision: 1
+revision: 2
os: [ubuntu-22.04]
title: Canonical Ubuntu 22.04 LTS STIG (V2R8), the controls vmsctl checks
title_ko: Canonical Ubuntu 22.04 LTS STIG(V2R8) 중 vmsctl이 점검하는 항목
@@ -183,3 +183,269 @@ controls:
checks: [packages.installed]
params:
packages.installed: {package: auditd}
+ - id: UBTU-22-654010
+ title: Every use of apparmor_parser is audited
+ title_ko: apparmor_parser 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /sbin/apparmor_parser}
+ - id: UBTU-22-654015
+ title: Every use of chacl is audited
+ title_ko: chacl 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/chacl}
+ - id: UBTU-22-654020
+ title: Every use of chage is audited
+ title_ko: chage 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/chage}
+ - id: UBTU-22-654025
+ title: Every use of chcon is audited
+ title_ko: chcon 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/chcon}
+ - id: UBTU-22-654030
+ title: Every use of chfn is audited
+ title_ko: chfn 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/chfn}
+ - id: UBTU-22-654035
+ title: Every use of chsh is audited
+ title_ko: chsh 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/chsh}
+ - id: UBTU-22-654040
+ title: Every use of crontab is audited
+ title_ko: crontab 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/crontab}
+ - id: UBTU-22-654045
+ title: Every use of fdisk is audited
+ title_ko: fdisk 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /usr/sbin/fdisk, perms: x}
+ - id: UBTU-22-654050
+ title: Every use of gpasswd is audited
+ title_ko: gpasswd 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/gpasswd}
+ - id: UBTU-22-654055
+ title: Every use of kmod is audited
+ title_ko: kmod 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /bin/kmod, perms: x}
+ - id: UBTU-22-654060
+ title: Every use of modprobe is audited
+ title_ko: modprobe 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /sbin/modprobe, perms: x}
+ - id: UBTU-22-654065
+ title: Every use of mount is audited
+ title_ko: mount 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/mount}
+ - id: UBTU-22-654070
+ title: Every use of newgrp is audited
+ title_ko: newgrp 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/newgrp}
+ - id: UBTU-22-654075
+ title: Every use of pam_timestamp_check is audited
+ title_ko: pam_timestamp_check 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/sbin/pam_timestamp_check}
+ - id: UBTU-22-654080
+ title: Every use of passwd is audited
+ title_ko: passwd 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/passwd}
+ - id: UBTU-22-654085
+ title: Every use of setfacl is audited
+ title_ko: setfacl 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/setfacl}
+ - id: UBTU-22-654090
+ title: Every use of ssh-agent is audited
+ title_ko: ssh-agent 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/ssh-agent}
+ - id: UBTU-22-654095
+ title: Every use of ssh-keysign is audited
+ title_ko: ssh-keysign 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/lib/openssh/ssh-keysign}
+ - id: UBTU-22-654100
+ title: Every use of su is audited
+ title_ko: su 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /bin/su}
+ - id: UBTU-22-654105
+ title: Every use of sudo is audited
+ title_ko: sudo 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/sudo}
+ - id: UBTU-22-654110
+ title: Every use of sudoedit is audited
+ title_ko: sudoedit 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/sudoedit}
+ - id: UBTU-22-654115
+ title: Every use of umount is audited
+ title_ko: umount 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/bin/umount}
+ - id: UBTU-22-654120
+ title: Every use of unix_update is audited
+ title_ko: unix_update 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /sbin/unix_update}
+ - id: UBTU-22-654125
+ title: Every use of usermod is audited
+ title_ko: usermod 명령을 쓸 때마다 감사 기록을 남김
+ severity: medium
+ checks: [audit.command-audited]
+ params:
+ audit.command-audited: {path: /usr/sbin/usermod}
+ - id: UBTU-22-654130
+ title: Changes to /etc/group are audited
+ title_ko: /etc/group의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /etc/group, perms: wa}
+ - id: UBTU-22-654135
+ title: Changes to /etc/gshadow are audited
+ title_ko: /etc/gshadow의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /etc/gshadow, perms: wa}
+ - id: UBTU-22-654140
+ title: Changes to /etc/security/opasswd are audited
+ title_ko: /etc/security/opasswd의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /etc/security/opasswd, perms: wa}
+ - id: UBTU-22-654145
+ title: Changes to /etc/passwd are audited
+ title_ko: /etc/passwd의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /etc/passwd, perms: wa}
+ - id: UBTU-22-654150
+ title: Changes to /etc/shadow are audited
+ title_ko: /etc/shadow의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /etc/shadow, perms: wa}
+ - id: UBTU-22-654190
+ title: Changes to the systemd journal files are audited
+ title_ko: systemd 저널 파일의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /var/log/journal, perms: wa}
+ - id: UBTU-22-654195
+ title: Changes to /var/log/btmp are audited
+ title_ko: /var/log/btmp의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /var/log/btmp, perms: wa}
+ - id: UBTU-22-654200
+ title: Changes to /var/log/wtmp are audited
+ title_ko: /var/log/wtmp의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /var/log/wtmp, perms: wa}
+ - id: UBTU-22-654205
+ title: Changes to /var/run/utmp are audited
+ title_ko: /var/run/utmp의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /var/run/utmp, perms: wa}
+ - id: UBTU-22-654210
+ title: Changes to /var/log/faillog are audited
+ title_ko: /var/log/faillog의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /var/log/faillog, perms: wa}
+ - id: UBTU-22-654215
+ title: Changes to /var/log/lastlog are audited
+ title_ko: /var/log/lastlog의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /var/log/lastlog, perms: wa}
+ - id: UBTU-22-654220
+ title: Changes to /etc/sudoers are audited
+ title_ko: /etc/sudoers의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /etc/sudoers, perms: wa}
+ - id: UBTU-22-654225
+ title: Changes to /etc/sudoers.d are audited
+ title_ko: /etc/sudoers.d의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /etc/sudoers.d, perms: wa}
+ - id: UBTU-22-654235
+ title: Changes to /var/log/sudo.log are audited
+ title_ko: /var/log/sudo.log의 변경을 감사 기록에 남김
+ severity: medium
+ checks: [audit.path-audited]
+ params:
+ audit.path-audited: {path: /var/log/sudo.log, perms: wa}
diff --git a/rules/audit/command-audited.yaml b/rules/audit/command-audited.yaml
new file mode 100644
index 0000000..c31090f
--- /dev/null
+++ b/rules/audit/command-audited.yaml
@@ -0,0 +1,70 @@
+id: audit.command-audited
+version: 1
+title: The audit rules record every use of a command that the control names
+title_ko: 감사 규칙이 점검 항목이 지정한 명령의 모든 사용을 기록함
+severity: medium
+description: >-
+ Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule
+ for the program named by the parameter `path`, in the form that the STIG gives for commands:
+ `-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset` (also written `-1`), so that what a logged-in user runs is
+ recorded. A watch (`-w`) or a rule without the two `auid` filters does not count. It reads the files, not the running kernel. Only a
+ profile sets the parameter. Not applicable to a container image.
+description_ko: >-
+ 호스트가 부팅할 때 불러오는 감사 규칙(/etc/audit/rules.d/*.rules, 없으면 /etc/audit/audit.rules)에 매개변수 `path`의 프로그램에 대한
+ 규칙이 STIG가 명령에 대해 정한 형태로 있는지 확인합니다. 형태는
+ `-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset`(`-1`로 써도 됩니다)이고, 로그인한 사용자가 실행한 것이
+ 기록되게 하려는 것입니다. 감시 규칙(`-w`)이나 `auid` 필터 두 개가 없는 규칙은 인정하지 않습니다. 실행 중인 커널이 아니라 파일을
+ 읽습니다. 매개변수는 프로파일만 정합니다. 컨테이너 이미지에는 해당하지 않습니다.
+rationale: >-
+ A privileged program that is not audited can be run without a record of who ran it.
+rationale_ko: >-
+ 감사하지 않는 권한 있는 프로그램은 누가 실행했는지 기록 없이 실행할 수 있습니다.
+remediation: >-
+ Add the rule for the program to a file in /etc/audit/rules.d (for example
+ `-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage`) and load it with
+ `augenrules --load`.
+remediation_ko: >-
+ /etc/audit/rules.d의 파일에 그 프로그램의 규칙을 추가하고(예:
+ `-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage`) `augenrules --load`로 불러오세요.
+applies: >-
+ params.path != "" && !target.image
+params:
+ path: {type: string, default: "", description: "The program to audit, as the STIG gives its path"}
+failure: >-
+ No audit rule records the use of the program that the profile names, with the auid filters that the STIG asks for.
+expect: >-
+ params.path in audit.user_paths && audit.user_paths[params.path].perms.contains("x")
+tests:
+ - name: the rule the STIG gives
+ params: {path: /usr/bin/chage}
+ facts:
+ audit: {present: true, paths: {/usr/bin/chage: {perms: x, source: "x:1"}}, user_paths: {/usr/bin/chage: {perms: x, source: "/etc/audit/rules.d/stig.rules:7"}}}
+ want: PASS
+ - name: a watch or a rule without the auid filters
+ params: {path: /usr/bin/chage}
+ facts:
+ audit: {present: true, paths: {/usr/bin/chage: {perms: x, source: "x:1"}}, user_paths: {}}
+ want: FAIL
+ - name: another program
+ params: {path: /usr/bin/chage}
+ facts:
+ audit: {present: true, paths: {}, user_paths: {/usr/bin/passwd: {perms: x, source: "x:1"}}}
+ want: FAIL
+ - name: no audit rules at all
+ params: {path: /usr/bin/chage}
+ facts:
+ audit: {present: false, paths: {}, user_paths: {}}
+ want: FAIL
+ - name: a rules file that cannot be read
+ params: {path: /usr/bin/chage}
+ input: incomplete
+ incomplete: [audit]
+ facts:
+ audit: {present: true, paths: {}, user_paths: {}}
+ want: ERROR
+ - name: a container image
+ params: {path: /usr/bin/chage}
+ facts:
+ target: {image: true}
+ audit: {present: false, paths: {}, user_paths: {}}
+ want: NOT_APPLICABLE
diff --git a/rules/audit/path-audited.yaml b/rules/audit/path-audited.yaml
new file mode 100644
index 0000000..098d4f7
--- /dev/null
+++ b/rules/audit/path-audited.yaml
@@ -0,0 +1,84 @@
+id: audit.path-audited
+version: 1
+title: The audit rules watch a path that the control names
+title_ko: 감사 규칙이 점검 항목이 지정한 경로를 감시함
+severity: medium
+description: >-
+ Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the
+ path named by the parameter `path` for the permissions named by `perms` (r, w, a, x, in that order, such as `wa` or `x`): a watch
+ (`-w /etc/passwd -p wa`) or an always,exit rule with `path=` and `perm=`, for any user. The profile that uses this check says which
+ path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a `never` rule, do not count; a rule on a directory (`dir=`) counts for the directory only, so name the path the rule names. Only a
+ profile sets the parameters. Not applicable to a container image.
+description_ko: >-
+ 호스트가 부팅할 때 불러오는 감사 규칙(/etc/audit/rules.d/*.rules, 없으면 /etc/audit/audit.rules)이 매개변수 `path`의 경로를
+ `perms`의 권한(r, w, a, x 순서, 예: `wa`나 `x`)으로 감사하는지 확인합니다. 감시 규칙(`-w /etc/passwd -p wa`)이나 `path=`와
+ `perm=`이 있는 always,exit 규칙이면 되고, 사용자는 가리지 않습니다. 어느 경로와 권한인지는 이 점검을 쓰는 프로파일이 정합니다.
+ 실행 중인 커널이 아니라 파일을 읽으므로, 부팅한 뒤 auditctl로 추가한 규칙은 보이지 않습니다. 사용자나 종료 코드 같은 다른 필터로 범위가 좁아진 규칙과 `never` 규칙이 있는 경로는 인정하지 않고, `dir=` 규칙은 그 디렉터리에만 해당하므로 규칙에 적은 경로 그대로 지정해야 합니다. 매개변수는 프로파일만 정합니다.
+ 컨테이너 이미지에는 해당하지 않습니다.
+rationale: >-
+ Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+rationale_ko: >-
+ 보안 파일을 누가 바꿨는지, 권한 있는 프로그램을 누가 실행했는지 기록이 없으면 사고를 조사하거나 책임을 가릴 수 없습니다.
+remediation: >-
+ Add a rule for the path to a file in /etc/audit/rules.d (for example `-w /etc/passwd -p wa -k usergroup_modification`) and load
+ it with `augenrules --load`.
+remediation_ko: >-
+ /etc/audit/rules.d의 파일에 그 경로의 규칙을 추가하고(예: `-w /etc/passwd -p wa -k usergroup_modification`) `augenrules --load`로
+ 불러오세요.
+applies: >-
+ params.path != "" && !target.image
+params:
+ path: {type: string, default: "", description: "The path to audit, without a trailing slash"}
+ perms: {type: string, default: "x", description: "The permissions to audit: any of r, w, a, x, in that order"}
+failure: >-
+ No audit rule watches the path that the profile names for the permissions it names.
+expect: >-
+ params.path in audit.paths &&
+ (!params.perms.contains("r") || audit.paths[params.path].perms.contains("r")) &&
+ (!params.perms.contains("w") || audit.paths[params.path].perms.contains("w")) &&
+ (!params.perms.contains("a") || audit.paths[params.path].perms.contains("a")) &&
+ (!params.perms.contains("x") || audit.paths[params.path].perms.contains("x"))
+tests:
+ - name: a watch with the permissions
+ params: {path: /etc/passwd, perms: wa}
+ facts:
+ audit: {present: true, paths: {/etc/passwd: {perms: wa, source: "/etc/audit/rules.d/stig.rules:9"}}, user_paths: {}}
+ want: PASS
+ - name: more permissions than asked for
+ params: {path: /etc/passwd, perms: wa}
+ facts:
+ audit: {present: true, paths: {/etc/passwd: {perms: rwax, source: "x:1"}}, user_paths: {}}
+ want: PASS
+ - name: permissions that are not next to each other
+ params: {path: /etc/passwd, perms: wx}
+ facts:
+ audit: {present: true, paths: {/etc/passwd: {perms: wax, source: "x:1"}}, user_paths: {}}
+ want: PASS
+ - name: only one of the permissions
+ params: {path: /etc/passwd, perms: wa}
+ facts:
+ audit: {present: true, paths: {/etc/passwd: {perms: w, source: "x:1"}}, user_paths: {}}
+ want: FAIL
+ - name: another path
+ params: {path: /etc/passwd, perms: wa}
+ facts:
+ audit: {present: true, paths: {/etc/shadow: {perms: wa, source: "x:1"}}, user_paths: {}}
+ want: FAIL
+ - name: no audit rules at all
+ params: {path: /etc/passwd, perms: wa}
+ facts:
+ audit: {present: false, paths: {}, user_paths: {}}
+ want: FAIL
+ - name: a rules file that cannot be read
+ params: {path: /etc/passwd, perms: wa}
+ input: incomplete
+ incomplete: [audit]
+ facts:
+ audit: {present: true, paths: {}, user_paths: {}}
+ want: ERROR
+ - name: a container image
+ params: {path: /etc/passwd, perms: wa}
+ facts:
+ target: {image: true}
+ audit: {present: false, paths: {}, user_paths: {}}
+ want: NOT_APPLICABLE
diff --git a/site/stig/ubuntu2204/index.html b/site/stig/ubuntu2204/index.html
index d0e1f9a..603acfe 100644
--- a/site/stig/ubuntu2204/index.html
+++ b/site/stig/ubuntu2204/index.html
@@ -4,15 +4,15 @@
-Ubuntu 22.04 STIG: the 27 controls vmsctl checks, and how to fix them — vmsctl
-
+Ubuntu 22.04 STIG: the 65 controls vmsctl checks, and how to fix them — vmsctl
+
-
-
+
+
@@ -28,8 +28,8 @@
-
Ubuntu 22.04 STIG: the 27 controls vmsctl checks
-
These are 27 of the 188 controls of the DISA Security Technical Implementation Guide for Canonical Ubuntu 22.04 LTS (V2R8) that vmsctl can decide by reading the host, each with what it looks at, why it matters and how to fix it. This is not a complete STIG assessment: the other controls (audit rules, file ownership of system commands, smart cards, FIPS, the boot loader password, ...) are not checked yet. The control IDs and importance are the STIG's, a US government work; the titles and texts are vmsctl's own. A check is mapped only when it decides exactly what the STIG requires. On a host that is not Ubuntu 22.04 every control is not applicable.
+
Ubuntu 22.04 STIG: the 65 controls vmsctl checks
+
These are 65 of the 188 controls of the DISA Security Technical Implementation Guide for Canonical Ubuntu 22.04 LTS (V2R8) that vmsctl can decide by reading the host, each with what it looks at, why it matters and how to fix it. This is not a complete STIG assessment: the other controls (the audit rules for system calls, file ownership of system commands, smart cards, FIPS, the boot loader password, ...) are not checked yet. The control IDs and importance are the STIG's, a US government work; the titles and texts are vmsctl's own. A check is mapped only when it decides exactly what the STIG requires. On a host that is not Ubuntu 22.04 every control is not applicable.
curl -fsSL https://raw.githubusercontent.com/with-developer/vmsctl/main/install.sh | sh
sudo vmsctl scan --profile stig-ubuntu2204
Every result carries its evidence (the value, the file and the line); vmsctl explain UBTU-22-255040 prints a control in the terminal. What the profile covers: docs/stig.md. About the tool: vmsctl.
packages.installed A package that the control requires is insta
Values used for this control: package = auditd
+
+
UBTU-22-654010 Every use of apparmor_parser is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /sbin/apparmor_parser
+
+
+
+
UBTU-22-654015 Every use of chacl is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/chacl
+
+
+
+
UBTU-22-654020 Every use of chage is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/chage
+
+
+
+
UBTU-22-654025 Every use of chcon is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/chcon
+
+
+
+
UBTU-22-654030 Every use of chfn is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/chfn
+
+
+
+
UBTU-22-654035 Every use of chsh is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/chsh
+
+
+
+
UBTU-22-654040 Every use of crontab is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/crontab
+
+
+
+
UBTU-22-654045 Every use of fdisk is audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /usr/sbin/fdisk, perms = x
+
+
+
+
UBTU-22-654050 Every use of gpasswd is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/gpasswd
+
+
+
+
UBTU-22-654055 Every use of kmod is audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /bin/kmod, perms = x
+
+
+
+
UBTU-22-654060 Every use of modprobe is audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /sbin/modprobe, perms = x
+
+
+
+
UBTU-22-654065 Every use of mount is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/mount
+
+
+
+
UBTU-22-654070 Every use of newgrp is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/newgrp
+
+
+
+
UBTU-22-654075 Every use of pam_timestamp_check is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/sbin/pam_timestamp_check
+
+
+
+
UBTU-22-654080 Every use of passwd is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/passwd
+
+
+
+
UBTU-22-654085 Every use of setfacl is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/setfacl
+
+
+
+
UBTU-22-654090 Every use of ssh-agent is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/ssh-agent
+
+
+
+
UBTU-22-654095 Every use of ssh-keysign is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/lib/openssh/ssh-keysign
+
+
+
+
UBTU-22-654100 Every use of su is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /bin/su
+
+
+
+
UBTU-22-654105 Every use of sudo is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/sudo
+
+
+
+
UBTU-22-654110 Every use of sudoedit is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/sudoedit
+
+
+
+
UBTU-22-654115 Every use of umount is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/bin/umount
+
+
+
+
UBTU-22-654120 Every use of unix_update is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /sbin/unix_update
+
+
+
+
UBTU-22-654125 Every use of usermod is audited
+
Importance medium (CAT II)
+
+
audit.command-audited The audit rules record every use of a command that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) have a rule for the program named by the parameter path, in the form that the STIG gives for commands: -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (also written -1), so that what a logged-in user runs is recorded. A watch (-w) or a rule without the two auid filters does not count. It reads the files, not the running kernel. Only a profile sets the parameter. Not applicable to a container image.
+
Why it matters. A privileged program that is not audited can be run without a record of who ran it.
+
How to fix it. Add the rule for the program to a file in /etc/audit/rules.d (for example -a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage) and load it with augenrules --load.
+
Values used for this control: path = /usr/sbin/usermod
+
+
+
+
UBTU-22-654130 Changes to /etc/group are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /etc/group, perms = wa
+
+
+
+
UBTU-22-654135 Changes to /etc/gshadow are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /etc/gshadow, perms = wa
+
+
+
+
UBTU-22-654140 Changes to /etc/security/opasswd are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /etc/security/opasswd, perms = wa
+
+
+
+
UBTU-22-654145 Changes to /etc/passwd are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /etc/passwd, perms = wa
+
+
+
+
UBTU-22-654150 Changes to /etc/shadow are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /etc/shadow, perms = wa
+
+
+
+
UBTU-22-654190 Changes to the systemd journal files are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /var/log/journal, perms = wa
+
+
+
+
UBTU-22-654195 Changes to /var/log/btmp are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /var/log/btmp, perms = wa
+
+
+
+
UBTU-22-654200 Changes to /var/log/wtmp are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /var/log/wtmp, perms = wa
+
+
+
+
UBTU-22-654205 Changes to /var/run/utmp are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /var/run/utmp, perms = wa
+
+
+
+
UBTU-22-654210 Changes to /var/log/faillog are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /var/log/faillog, perms = wa
+
+
+
+
UBTU-22-654215 Changes to /var/log/lastlog are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /var/log/lastlog, perms = wa
+
+
+
+
UBTU-22-654220 Changes to /etc/sudoers are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /etc/sudoers, perms = wa
+
+
+
+
UBTU-22-654225 Changes to /etc/sudoers.d are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /etc/sudoers.d, perms = wa
+
+
+
+
UBTU-22-654235 Changes to /var/log/sudo.log are audited
+
Importance medium (CAT II)
+
+
audit.path-audited The audit rules watch a path that the control names
+
Checks that the audit rules the host loads at boot (/etc/audit/rules.d/*.rules, or /etc/audit/audit.rules without them) audit the path named by the parameter path for the permissions named by perms (r, w, a, x, in that order, such as wa or x): a watch (-w /etc/passwd -p wa) or an always,exit rule with path= and perm=, for any user. The profile that uses this check says which path and permissions. It reads the files, not the running kernel: a rule added with auditctl since boot is not seen. A rule that is narrowed by another filter (a user, an exit code), and a path with a never rule, do not count; a rule on a directory (dir=) counts for the directory only, so name the path the rule names. Only a profile sets the parameters. Not applicable to a container image.
+
Why it matters. Without a record of who changed a security file or ran a privileged program, an incident cannot be investigated or attributed.
+
How to fix it. Add a rule for the path to a file in /etc/audit/rules.d (for example -w /etc/passwd -p wa -k usergroup_modification) and load it with augenrules --load.
+
Values used for this control: path = /var/log/sudo.log, perms = wa