feat(hardening): how a Linux host is hardened, as one read-only reading (NetOrk/netork#2706)
HardeningMixin.get_hardening() reads, with one fixed command: the active security modules, SELinux's mode and its configured mode, AppArmor's switch and (as root) its profiles per mode, the crypto policy and FIPS mode, the kernel's text for each CPU vulnerability, mitigations= and nosmt from the command line, and the distribution's IDs. Read as root first, as the login user where root is refused. What was not read is None, never off.
This commit is contained in:
1 parent
5985c87cc8
commit
3cd0e3621a
5 files changed
+713
No files matched your search
@@ -7,6 +7,22 @@ recorded here; their history is the git log.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- `HardeningMixin.get_hardening()`: how a Linux host is hardened, read with one fixed,
|
||||
read-only command (NetOrk/netork#2706). The active security modules
|
||||
(`/sys/kernel/security/lsm`), SELinux's mode (`getenforce`, else
|
||||
`/sys/fs/selinux/enforce`) and its configured mode (`SELINUX=` in `/etc/selinux/config`),
|
||||
AppArmor's switch and, as root, its profiles per mode (`aa-status --json`), the crypto
|
||||
policy (`update-crypto-policies --show`) and FIPS mode (`/proc/sys/crypto/fips_enabled`),
|
||||
the kernel's text for each file under `/sys/devices/system/cpu/vulnerabilities`, the
|
||||
kernel command line with `mitigations=` (`auto` when not given) and `nosmt`, and
|
||||
`ID`/`ID_LIKE` from `/etc/os-release`. Read as root first; where root is refused, as the
|
||||
login user, without the profile counts. Anything not read is `None`, never "off". A
|
||||
driver supplies `_run_hardening_command(command, *, privileged)`.
|
||||
- `parse_hardening`, `HARDENING_COMMAND`, `cpu_vulnerability_state` (`not_affected`,
|
||||
`mitigated`, `vulnerable` or `unknown`, from the kernel's words), and the
|
||||
`HardeningDict`, `SelinuxDict` and `AppArmorDict` shapes (in `hardening`).
|
||||
|
||||
## [4.46.0] - 2026-11-26
|
||||
|
||||
### Fixed
|
||||
|
||||
Reference in new issue
Block a user