fix(system_baseline): refuse ICMP redirects on every interface #514

Open
Claude wants to merge 2 commits from fix/511-icmp-redirects into main
pull from: fix/511-icmp-redirects
Owner

Merge #513 first. This branch is stacked on it, so the diff shows both commits until then.

What and why

The profiles set net.ipv4.conf.all.accept_redirects=0 only. With forwarding off, an interface whose own value is 1 still accepts ICMP redirects.

  • Every profile now sets accept_redirects=0 for all, default and every interface (*), over IPv4 and IPv6, and secure_redirects=0 for all and default over IPv4.
  • The sysctl list accepts * in key names. The role applies it live to the interfaces that exist, and systemd-sysctl applies it at boot.
  • IPv6 keys are skipped live when the kernel has no IPv6.

A consumer who overrides the list must add the new keys to it.

Closes #511

Verified

  • The pre-commit hooks passed on the commit.
  • Local --check runs of the task file in a throwaway network namespace: a differing value, a second run without changes, a mistyped key, IPv6 missing.
  • Writes by hand in such a namespace, in the form the role uses, including a VLAN interface and a missing one.
  • Molecule: see the CI run of this pull request.

Not verified

  • A real write by the role itself: the molecule containers have a read-only /proc/sys.
  • A reboot that loads the drop-in.
  • The role on Debian 13.
  • An interface that disappears in the middle of a write.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.

Assisted-by: Claude Code:claude-opus-5-5

**Merge #513 first.** This branch is stacked on it, so the diff shows both commits until then. ## What and why The profiles set `net.ipv4.conf.all.accept_redirects=0` only. With forwarding off, an interface whose own value is 1 still accepts ICMP redirects. - Every profile now sets `accept_redirects=0` for `all`, `default` and every interface (`*`), over IPv4 and IPv6, and `secure_redirects=0` for `all` and `default` over IPv4. - The sysctl list accepts `*` in key names. The role applies it live to the interfaces that exist, and `systemd-sysctl` applies it at boot. - IPv6 keys are skipped live when the kernel has no IPv6. A consumer who overrides the list must add the new keys to it. Closes #511 ## Verified - The pre-commit hooks passed on the commit. - Local `--check` runs of the task file in a throwaway network namespace: a differing value, a second run without changes, a mistyped key, IPv6 missing. - Writes by hand in such a namespace, in the form the role uses, including a VLAN interface and a missing one. - Molecule: see the CI run of this pull request. ## Not verified - A real write by the role itself: the molecule containers have a read-only `/proc/sys`. - A reboot that loads the drop-in. - The role on Debian 13. - An interface that disappears in the middle of a write. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code:claude-opus-5-5
Claude added 2 commits 2026-12-03 17:52:17 +00:00
fix(system_baseline): persist sysctls in an own sysctl.d drop-in
Build / build (pull_request) Successful in 1m5s
Lint / lint (pull_request) Successful in 4m54s
Molecule / select (pull_request) Successful in 3s
Molecule / scenarios (pull_request) Successful in 18m54s
Molecule / Result (pull_request) Successful in 0s
d88e5d237a
systemd-sysctl on Debian 13 does not read /etc/sysctl.conf, so the
hardened values were lost on reboot. The role now applies the live values
on their own, writes them to a drop-in under /etc/sysctl.d and removes its
keys from /etc/sysctl.conf.

Refs #510

Assisted-by: Claude Code:claude-opus-5-5
fix(system_baseline): refuse ICMP redirects on every interface
Build / build (pull_request) Successful in 28s
Molecule / select (pull_request) Successful in 8s
Lint / lint (pull_request) Successful in 2m23s
Molecule / scenarios (pull_request) Successful in 10m38s
Molecule / Result (pull_request) Successful in 1s
74e574ee80
With forwarding off the kernel accepts redirects when either `all` or the
interface's own value is 1, and over IPv6 only the interface's value counts.
The profiles now also set `default` and, with a wildcard, every existing
interface, over IPv4 and IPv6.

Refs #511

Assisted-by: Claude Code:claude-opus-5-5
All checks were successful
Build / build (pull_request) Successful in 28s
Required
Details
Molecule / select (pull_request) Successful in 8s
Lint / lint (pull_request) Successful in 2m23s
Required
Details
Molecule / scenarios (pull_request) Successful in 10m38s
Molecule / Result (pull_request) Successful in 1s
Required
Details
This pull request is blocked because it's outdated.
You are not authorized to merge this pull request.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/511-icmp-redirects:fix/511-icmp-redirects
git checkout fix/511-icmp-redirects
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#514