Thanks for the answer, Chris, and for doing this at all. I went through it properly before switching, so here is what I found, what I now run, and a few things from the Atomic side that might be useful. Both of my machines are still on 44: a Fedora COSMIC Atomic laptop (my daily machine, Secure Boot on) and a small self-hosted Fedora CoreOS server on the stable stream. So this comes from reading the docs page and the f45 99-kernel-hardening.conf (systemd 262.1, which is where 45 gets it) and from checking both live systems, not from running 45 yet.
What I took from it
All five values from the kernel file, deny_ptrace, and the public zone where it applies:
| Setting |
Fedora default |
Hardening |
Laptop |
Server |
net.core.bpf_jit_harden |
0 |
2 |
2 |
2 |
kernel.yama.ptrace_scope |
0 |
2 |
2 |
2 |
kernel.kptr_restrict |
0 |
2 |
2 |
2 |
fs.protected_fifos |
1 |
2 |
2 |
2 |
fs.protected_regular |
1 |
2 |
2 |
2 |
SELinux deny_ptrace |
off |
on |
on |
planned |
| firewalld default zone |
FedoraWorkstation on most desktops |
public |
public (already) |
no firewalld |
Since 44’s systemd does not ship the file yet, I put the five values into my own sysctl file for now, marked so I can delete them once I am on 45 and switch to the symlink, which is the part I like most: the values keep themselves up to date. Before, I had ptrace_scope=1 and kptr_restrict=1 on the laptop, and nothing I use has needed more than that. I have not needed a debugger on this laptop in years, so deny_ptrace was an easy yes too.
What I run on top
For context, not as a request. Some of these clearly do not belong in a general set:
- Kernel and network:
kexec_load_disabled=1 on the server (planned on the laptop), accept_redirects=0 and secure_redirects=0 for IPv4 and IPv6 on both, send_redirects=0 and log_martians=1 on the server, and init_on_free=1 as a kernel argument on the laptop.
- Name resolution and time: LLMNR off in
systemd-resolved, chrony with NTS only on the laptop.
- Network identity: a random MAC per network in NetworkManager on the laptop.
- Boot and disk: Secure Boot with lockdown in integrity mode, and LUKS, on both. SELinux enforcing on both.
- Inbound: on the laptop, the
public zone with ssh removed and sshd disabled. CoreOS has no firewalld, so the server uses its own default-drop nftables rules instead.
Things from the Atomic side
1. The documented revert opens ports on COSMIC Atomic. COSMIC Atomic does not install firewalld-workstation-config, so its default zone is already public, not FedoraWorkstation. Enabling the hardening changes nothing there, which is fine. But the removal step, firewall-cmd --set-default-zone=FedoraWorkstation, switches it to a zone with 1025-65535/tcp and /udp open, which that variant never had. The page does say the revert may not match a variant with a different default, but it is easy to miss. Maybe: “note your zone with firewall-cmd --get-default-zone before enabling and set that one back”, or name the variants that already default to public?
2. The kernel file is shipped as documentation. On installs without docs (tsflags=nodocs, containers, some minimal images) it is not there, and the symlink points at nothing. On both my COSMIC Atomic laptop and my CoreOS server /usr/share/doc/systemd is present (225 files on each), so it works there, and on Atomic the link in /etc simply follows the image’s copy across updates, which is nice. I have not checked whether systemd-sysctl warns about a dangling link or skips it quietly. If it is quiet, someone could believe they are hardened when they are not. Would a path that is not documentation work, say /usr/share/systemd/, with the same symlink into /etc/sysctl.d? (Not /usr/lib/sysctl.d, since everything there is applied automatically.)
3. ptrace on Atomic reaches toolbox too. On Atomic most development happens in toolbox or distrobox containers. They share the host kernel, so ptrace_scope=2 also stops gdb and strace inside them. I would guess deny_ptrace does too, but toolbox runs with SELinux labelling disabled and I have not tested it. The advice on the page works the same, but an Atomic user might not expect a host setting to reach into the container. A one-line note might save some confusion.
4. Anything beyond sysctl works differently on Atomic. This is not about the current set, since it only uses sysctl, SELinux and firewalld, which behave the same on both. But if it ever grows into kernel arguments: on Atomic they go through rpm-ostree kargs, which builds a new deployment and re-runs package layering, so it inherits whatever blocks layering at the time. Right now that includes coreos/rpm-ostree#5639 for anyone whose layered package added a group to /etc/group (Wireshark, in my case). A mutable system just uses grubby. Probably one reason the current set avoids kernel arguments.
5. CoreOS. Pieces 1 and 2 seem to apply as they are, and the file is present on CoreOS too. Piece 3 does not apply, since CoreOS has no firewalld by default. Is server or CoreOS use in scope later, or deliberately left out?
Things I run that might fit the general set
More a list to consider than a request, with the cost I know of each:
accept_redirects=0 and secure_redirects=0, IPv4 and IPv6. A laptop on café Wi-Fi has no reason to let another host reroute its traffic, and nothing has broken here since I set them a month ago. Were they left out for multi-homed or router setups?
kernel.kexec_load_disabled=1. It breaks kdump, so it only fits if kdump is not on by default on the desktop variants.
- LLMNR off in
systemd-resolved. It was on in my install, and it is a common spoofing target on shared networks. Not a sysctl, so it would be a different piece.
- A random MAC per network in NetworkManager. Privacy rather than security, but it is one config file, and the only cost I have seen is one new device per network.
- NTS for chrony. Authenticated time on untrusted networks, though it needs TCP 4460, which some networks block.
I would keep log_martians (log noise) and init_on_free=1 (CPU cost, the kernel help says 3 to 5% in most cases) out of a general set myself.
Thanks again. A maintained floor that updates itself is exactly what most people need, and I will switch both machines to the symlink as soon as they are on 45.