From f0cc238f6552c7333be305e23267aa3924994264 Mon Sep 17 00:00:00 2001 From: harry Date: Sat, 14 Nov 2026 18:51:22 +0900 Subject: [PATCH 1/3] feat: stig-ubuntu2204 revision 2: 38 controls for audit rules (an audit collector, audit.path-audited and audit.command-audited) --- README.ko.md | 2 +- README.md | 2 +- docs/facts.md | 26 + docs/rules.ko.md | 69 ++- docs/rules.md | 69 ++- docs/stig.ko.md | 12 +- docs/stig.md | 14 +- internal/collect/accounts.go | 2 +- internal/collect/audit.go | 303 ++++++++++++ internal/collect/audit_test.go | 147 ++++++ internal/collect/fuzz_test.go | 4 + .../etc/audit/rules.d/stig.rules | 66 +++ .../etc/audit/rules.d/audit.rules | 12 + internal/rulesdoc/site.go | 2 +- profiles/stig-ubuntu2204.yaml | 272 +++++++++- rules/audit/command-audited.yaml | 70 +++ rules/audit/path-audited.yaml | 75 +++ site/stig/ubuntu2204/index.html | 468 +++++++++++++++++- 18 files changed, 1591 insertions(+), 24 deletions(-) create mode 100644 internal/collect/audit.go create mode 100644 internal/collect/audit_test.go create mode 100644 internal/collect/testdata/audit/stig-ubuntu-22.04/etc/audit/rules.d/stig.rules create mode 100644 internal/collect/testdata/audit/ubuntu-22.04/etc/audit/rules.d/audit.rules create mode 100644 rules/audit/command-audited.yaml create mode 100644 rules/audit/path-audited.yaml diff --git a/README.ko.md b/README.ko.md index 542ee5c..50e8db7 100644 --- a/README.ko.md +++ b/README.ko.md @@ -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..43e8b07 100644 --- a/docs/facts.md +++ b/docs/facts.md @@ -41,6 +41,32 @@ 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: the audit rules that the host loads at boot, 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. The keys of the rules (-k) are not kept: they are arbitrary names. + +| Path | Type | | +|---|---|---| +| `audit.present` | bool | Present is true when a rules file exists. | +| `audit.rules` | list of object | Rules are the rules of the files in the order they are loaded, with those that a later "-D" deleted left out. | +| `audit.rules[].kind` | string | Kind is "watch" (-w) or "syscall" (-a). | +| `audit.rules[].action` | string | Action and List are those of an -a rule ("always", "exit"); empty for a watch. | +| `audit.rules[].list` | string | | +| `audit.rules[].path` | string | Path is the path of a watch, or the path= or dir= of an -a rule, without a trailing "/". | +| `audit.rules[].perms` | string | Perms are the audited permissions in the order r, w, a, x; of a watch without -p, all of them. | +| `audit.rules[].syscalls` | list of string | Syscalls are those of -S. | +| `audit.rules[].fields` | list of string | Fields are the other -F filters as written without spaces ("arch=b64", "auid>=1000"). | +| `audit.rules[].source` | string | | +| `audit.paths` | map of object | Paths holds, for every path that a watch (-w) or an always,exit rule with path= 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 "/". | +| `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..5224b00 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로 추가한 규칙은 보이지 않습니다. 매개변수는 프로파일만 정합니다. 컨테이너 이미지에는 해당하지 않습니다. + +**이유.** 보안 파일을 누가 바꿨는지, 권한 있는 프로그램을 누가 실행했는지 기록이 없으면 사고를 조사하거나 책임을 가릴 수 없습니다. + +**조치 방법.** /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..69fee4b 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. 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..2562345 100644 --- a/docs/stig.ko.md +++ b/docs/stig.ko.md @@ -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,7 @@ 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`)여야 합니다. 점검이 갖춰지는 대로 항목을 늘립니다(남은 가장 큰 묶음은 시스템 호출 감사 규칙입니다). diff --git a/docs/stig.md b/docs/stig.md index f484655..8314f3b 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,8 @@ 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`). 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..fec3600 --- /dev/null +++ b/internal/collect/audit.go @@ -0,0 +1,303 @@ +package collect + +import ( + "bufio" + "bytes" + "context" + "fmt" + "path" + "reflect" + "slices" + "strings" + + "github.com/with-developer/vmsctl/internal/engine" + "github.com/with-developer/vmsctl/internal/hostfs" +) + +// Audit are the `audit` facts: the audit rules that the host loads at boot, 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. The keys of the rules (-k) are not kept: they are arbitrary names. +type Audit struct { + // Present is true when a rules file exists. + Present bool `json:"present"` + // Rules are the rules of the files in the order they are loaded, with those that a later "-D" deleted left out. + Rules []AuditRule `json:"rules"` + // Paths holds, for every path that a watch (-w) or an always,exit rule with path= 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 "/". + 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"` +} + +// AuditRule is one rule of the files that adds something to audit. +type AuditRule struct { + // Kind is "watch" (-w) or "syscall" (-a). + Kind string `json:"kind"` + // Action and List are those of an -a rule ("always", "exit"); empty for a watch. + Action string `json:"action"` + List string `json:"list"` + // Path is the path of a watch, or the path= or dir= of an -a rule, without a trailing "/". + Path string `json:"path"` + // Perms are the audited permissions in the order r, w, a, x; of a watch without -p, all of them. + Perms string `json:"perms"` + // Syscalls are those of -S. + Syscalls []string `json:"syscalls"` + // Fields are the other -F filters as written without spaces ("arch=b64", "auid>=1000"). + Fields []string `json:"fields"` + 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]() } + +func (auditCollector) Collect(_ context.Context, h *hostfs.Host) (engine.Facts, error) { + a := &Audit{Rules: []AuditRule{}, Paths: map[string]AuditPath{}, UserPaths: map[string]AuditPath{}} + var skipped []string + files, err := auditFiles(h) + if err != nil { + return engine.Facts{Value: a, Complete: false, Skipped: []string{fmt.Sprintf("%s: %v", auditRulesDir, err)}}, nil + } + a.Present = len(files) > 0 + for _, file := range files { + data, err := h.FS.ReadFile(file) + if err != nil { + skipped = append(skipped, fmt.Sprintf("%s: %v", file, err)) + continue + } + if len(data) > auditMaxFileBytes { + skipped = append(skipped, file+": too large") + continue + } + skipped = append(skipped, parseAuditRules(file, data, a)...) + } + if len(skipped) > 0 { + return engine.Facts{Value: a, Complete: false, Skipped: skipped}, nil + } + return engine.Facts{Value: 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), or +// audit.rules when rules.d has none. A missing directory is not an error. +func auditFiles(h *hostfs.Host) ([]string, error) { + entries, err := h.FS.ReadDir(auditRulesDir) + if err != nil && !hostfs.IsMissing(err) { + return nil, err + } + var files []string + for _, e := range entries { + if e.Mode.IsRegular() && strings.HasSuffix(e.Path, ".rules") { + files = append(files, path.Join(auditRulesDir, path.Base(e.Path))) + } + } + slices.Sort(files) + if len(files) > auditMaxFiles { + files = files[:auditMaxFiles] + } + if len(files) > 0 { + return files, nil + } + if _, err := h.FS.Stat(auditRulesFile); err == nil { + return []string{auditRulesFile}, nil + } else if !hostfs.IsMissing(err) { + return nil, err + } + return nil, nil +} + +// auditOptions are lines that set how the audit system runs and add no rule. +var auditOptions = map[string]bool{"-b": true, "-f": true, "-r": true, "-e": true, "-c": true, "-i": true, "-s": true, "--backlog_wait_time": true, "--loginuid-immutable": true, "--reset-lost": true} + +// parseAuditRules reads the rules of one file into a, and returns what it could not read (a line that it does not understand makes the +// facts incomplete: a rule that it cannot read may be the one that a check looks for, or a "-d" that removes one). +func parseAuditRules(file string, data []byte, a *Audit) []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": + a.Rules, a.Paths, a.UserPaths = []AuditRule{}, map[string]AuditPath{}, map[string]AuditPath{} // what comes before it is deleted + continue + case auditOptions[words[0]] || strings.HasPrefix(words[0], "--backlog_wait_time=") || strings.HasPrefix(words[0], "--rate="): + continue + case words[0] != "-w" && words[0] != "-a" && words[0] != "-A": + skipped = append(skipped, source+": "+words[0]+" is not read") + continue + } + if len(a.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 + } + a.Rules = append(a.Rules, r) + a.add(r) + } + if err := sc.Err(); err != nil { + skipped = append(skipped, fmt.Sprintf("%s: %v", file, err)) + } + return skipped +} + +func parseAuditRule(words []string, source string) (AuditRule, bool) { + r := AuditRule{Syscalls: []string{}, Fields: []string{}, Source: source} + perm := "" + 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 { + return r, false + } + r.Kind, r.Path = "watch", cleanAuditPath(p) + case "-a", "-A": + v, ok := next() + if !ok { + 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 = p + case "-k": + if _, ok := next(); !ok { + return r, false + } + case "-S": + v, ok := next() + if !ok { + return r, false + } + r.Syscalls = append(r.Syscalls, strings.Split(v, ",")...) + 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 = v[len("perm="):] + 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 r.Kind == "watch" && perm == "" { + perm = "rwax" // a watch without -p audits every kind of access + } + r.Perms = canonicalAuditPerms(perm) + return r, true +} + +// add records what r audits in Paths and UserPaths. +func (a *Audit) add(r AuditRule) { + if r.Path == "" || r.Perms == "" { + return + } + if r.Kind == "syscall" && (r.Action != "always" || r.List != "exit") { + return + } + 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) + } +} + +// 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..2494bed --- /dev/null +++ b/internal/collect/audit_test.go @@ -0,0 +1,147 @@ +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.Rules) != 0 || 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}, + {"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", + "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) + } + } +} + +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.Rules) != auditMaxRules || len(skipped) == 0 { + t.Errorf("complete %v, %d rules, %v", complete, len(a.Rules), 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..f6ac36c --- /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, rules: [], 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, rules: [], 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, rules: [], 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, rules: [], 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, rules: [], paths: {}, user_paths: {}} + want: ERROR + - name: a container image + params: {path: /usr/bin/chage} + facts: + target: {image: true} + audit: {present: false, rules: [], 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..6e4ed3d --- /dev/null +++ b/rules/audit/path-audited.yaml @@ -0,0 +1,75 @@ +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. 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로 추가한 규칙은 보이지 않습니다. 매개변수는 프로파일만 정합니다. + 컨테이너 이미지에는 해당하지 않습니다. +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 && audit.paths[params.path].perms.contains(params.perms) +tests: + - name: a watch with the permissions + params: {path: /etc/passwd, perms: wa} + facts: + audit: {present: true, rules: [], 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, rules: [], paths: {/etc/passwd: {perms: rwax, source: "x:1"}}, user_paths: {}} + want: PASS + - name: only one of the permissions + params: {path: /etc/passwd, perms: wa} + facts: + audit: {present: true, rules: [], 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, rules: [], 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, rules: [], 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, rules: [], paths: {}, user_paths: {}} + want: ERROR + - name: a container image + params: {path: /etc/passwd, perms: wa} + facts: + target: {image: true} + audit: {present: false, rules: [], paths: {}, user_paths: {}} + want: NOT_APPLICABLE diff --git a/site/stig/ubuntu2204/index.html b/site/stig/ubuntu2204/index.html index d0e1f9a..549ed10 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.

@@ -62,6 +62,44 @@

Ubuntu 22.04 STIG: the 27 controls vmsctl checks

  • UBTU-22-611035 A password has at least 15 characters
  • UBTU-22-611065 No account has an empty password
  • UBTU-22-653010 The audit daemon is installed
  • +
  • UBTU-22-654010 Every use of apparmor_parser is audited
  • +
  • UBTU-22-654015 Every use of chacl is audited
  • +
  • UBTU-22-654020 Every use of chage is audited
  • +
  • UBTU-22-654025 Every use of chcon is audited
  • +
  • UBTU-22-654030 Every use of chfn is audited
  • +
  • UBTU-22-654035 Every use of chsh is audited
  • +
  • UBTU-22-654040 Every use of crontab is audited
  • +
  • UBTU-22-654045 Every use of fdisk is audited
  • +
  • UBTU-22-654050 Every use of gpasswd is audited
  • +
  • UBTU-22-654055 Every use of kmod is audited
  • +
  • UBTU-22-654060 Every use of modprobe is audited
  • +
  • UBTU-22-654065 Every use of mount is audited
  • +
  • UBTU-22-654070 Every use of newgrp is audited
  • +
  • UBTU-22-654075 Every use of pam_timestamp_check is audited
  • +
  • UBTU-22-654080 Every use of passwd is audited
  • +
  • UBTU-22-654085 Every use of setfacl is audited
  • +
  • UBTU-22-654090 Every use of ssh-agent is audited
  • +
  • UBTU-22-654095 Every use of ssh-keysign is audited
  • +
  • UBTU-22-654100 Every use of su is audited
  • +
  • UBTU-22-654105 Every use of sudo is audited
  • +
  • UBTU-22-654110 Every use of sudoedit is audited
  • +
  • UBTU-22-654115 Every use of umount is audited
  • +
  • UBTU-22-654120 Every use of unix_update is audited
  • +
  • UBTU-22-654125 Every use of usermod is audited
  • +
  • UBTU-22-654130 Changes to /etc/group are audited
  • +
  • UBTU-22-654135 Changes to /etc/gshadow are audited
  • +
  • UBTU-22-654140 Changes to /etc/security/opasswd are audited
  • +
  • UBTU-22-654145 Changes to /etc/passwd are audited
  • +
  • UBTU-22-654150 Changes to /etc/shadow are audited
  • +
  • UBTU-22-654190 Changes to the systemd journal files are audited
  • +
  • UBTU-22-654195 Changes to /var/log/btmp are audited
  • +
  • UBTU-22-654200 Changes to /var/log/wtmp are audited
  • +
  • UBTU-22-654205 Changes to /var/run/utmp are audited
  • +
  • UBTU-22-654210 Changes to /var/log/faillog are audited
  • +
  • UBTU-22-654215 Changes to /var/log/lastlog are audited
  • +
  • UBTU-22-654220 Changes to /etc/sudoers are audited
  • +
  • UBTU-22-654225 Changes to /etc/sudoers.d are audited
  • +
  • UBTU-22-654235 Changes to /var/log/sudo.log are audited
  • @@ -364,6 +402,424 @@

    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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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

    +
    +