Skip to content

docs+test: sync README sysctl profile with harden_sysctl and stop the drift - #30

Merged
neohiro merged 1 commit into
mainfrom
fix/hardening-pass2-review
Oct 10, 2026
Merged

neohiro merged 1 commit into
mainfrom
fix/hardening-pass2-review

Conversation

@neohiro

@neohiro neohiro commented Oct 10, 2026

Copy link
Copy Markdown
Owner

The README documented a 24-key sysctl profile while \harden_sysctl()\ emits 62, and still documented
et.ipv4.ip_forward=0, which the script no longer writes (per-interface \ orwarding\ replaced it).

That is a real blind spot for a copy-paste hardening profile: anyone following the README by hand applied a weaker and partly incorrect set than the tool does.

  • README now mirrors the emitted profile in the same order, including the server-only \user.max_user_namespaces=0\ and its container-runtime carve-out.
  • Notes that \ cp_fin_timeout/\ cp_tw_reuse/keepalive/buffer sizes are capacity tuning rather than exploit mitigations, and that forwarding is now per-interface.
  • New 'Attack surface reduction' section documents the step added in PR fix: harden_sysctl/harden_attack_surface robustness #27/fix: pass-2 hardening polish #28: filesystem blacklist (with the squashfs/snap carve-out), SSH crypto hardening, \login.defs\ aging, core-dump limits.
  • New bidirectional README<->code consistency test: every key emitted must be documented, and every documented key must still be emitted. This is what prevents the drift from recurring.

Negative controls (in-memory, no source mutation): adding an undocumented key to the script flips the 'missing' assertion; re-adding
et.ipv4.ip_forward\ to the README flips the 'stale' assertion. Baseline reports 62 code keys / 63 doc keys (the extra being the server-only key) with zero drift in both directions.

… drift

The README documented a 24-key profile while harden_sysctl emitted 62, and
still documented net.ipv4.ip_forward=0, which the script no longer writes
(per-interface forwarding replaced it). That is exactly the blind spot a
copy-paste hardening profile creates: an operator following the README by hand
applied a weaker and partly wrong set than the tool.

- README now mirrors the emitted profile in order, including the
  server-only user.max_user_namespaces=0 and its container-runtime carve-out.
- Notes that tcp_fin_timeout/tw_reuse/keepalive/buffers are capacity tuning
  rather than mitigations, and that forwarding is now per-interface.
- Adds an Attack surface reduction section covering the new step: filesystem
  blacklist (with the squashfs/snap carve-out), SSH crypto hardening,
  login.defs aging, and core-dump limits.

- Adds a bidirectional README<->code consistency test so the two cannot
  diverge again: every key emitted must be documented, and every documented
  key must still be emitted. Negative-controlled in both directions.
@neohiro
neohiro merged commit b2f365c into main Oct 10, 2026
8 checks passed
@neohiro
neohiro deleted the fix/hardening-pass2-review branch October 10, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant