Linux Hardening
Cheat sheet · https://pcornel.dk/topic.php?topic=4578
Answer
Linux Hardening applies role-specific secure configuration across boot/kernel, packages/services, identities, sudo/PAM/SSH, filesystems, LSMs, capabilities/seccomp, firewalling, auditing, patching, secrets and recovery with continuous drift control.
Remember
- Linux hardening ≠ blindly applying one distribution-agnostic checklist.
- Compliance scan ≠ loaded runtime control or secure workload outcome.
- Configuration file present ≠ parsed, loaded and effective runtime state.
- One allow/deny result ≠ complete DAC, privilege, LSM, firewall and application outcome.
First checks
- CIS benchmark scan (OpenSCAP) — compliance
oscap xccdf eval --profile <profile> --report report.html <ds.xml>— SCAP scanlynis audit system— quick audit
Verify in this order
baseline → configuration management → scan
Where it usually breaks
First mismatch in platform/workload identity → desired configuration → management/control plane → runtime enforcement → telemetry → workload/resource outcome; preserve identity/policy/pre-state before mutation.
Linux Security → Linux Hardening proof map
| Boundary | Establish | Does not establish |
|---|---|---|
| Scope | Exact host, role, build/kernel, identity, workload and expected control | Does not prove policy receipt or effective runtime state |
| Effective state | Resultant/loaded policy, precedence, mode, labels/rules/keys and active services/kernel controls | Configuration presence does not prove enforcement |
| Runtime evidence | Correlated events/audit, process/token/credential, packet/syscall and workload result | One event, clean status or allow/deny does not prove complete security |
| Closure | Original allowed/denied workload works, unsafe state is removed and recovery/regression pass | Commit, restart, block or compliance result alone is not closure |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4578