Repository navigation
presets: remove the no-op hardened preset - #182
Merged
Merged
Conversation
seberm
marked this pull request as ready for review
October 29, 2026 22:16
ostermayer
reviewed
Oct 30, 2026
ostermayer
left a comment
Collaborator
There was a problem hiding this comment.
Looks right to me. The stub with the failing assertion is a better landing than a missing file, and I found no other reference to presets/hardened.nix left in the tree, docs included. The hardened test scenario still imports hardened-extended.nix, so that preset stays covered.
DeepSeek V4.1 Flash 1017 (max) and GLM 5.3 (max) audited the tree at c6319c0 with Codex (GPT-6 Astra, xhigh) as the second opinion: nine findings, none in the five files this PR touches. They're all known (#87, #107, #133, #64, #127, #86) or leads I still have to file, like the WireGuard preset turning tor.enforce off for lnd and clightning.
NixOS 26.05 removed profiles/hardened.nix and the linux_hardened kernel. modules/presets/hardened.nix imported that profile, so on every bitcoinix release it only set two options to their NixOS defaults and gave no hardening at all. Replace it with a stub whose assertion tells users to drop the import and points to hardened-extended.nix and the NixOS Hardening wiki. A stub gives a clear message instead of a missing-path error and stays inert under disabledModules. hardened-extended.nix keeps its own settings and no longer imports the stub; its evaluated system is unchanged. Drop the preset from examples/configuration.nix and the qemu-vm example, and stop promising a hardened kernel in the README. Fixes bitcoinix#177 Assisted-by: Claude Code (claude-opus-5-5)
seberm
force-pushed
the
presets-remove-hardened
branch
from
November 1, 2026 14:33
c6319c0 to
93ff7e8
Compare
seberm
added a commit
that referenced
this pull request
Nov 1, 2026
The stock NixOS kernel (6.18 and 7.3, x86_64 and aarch64) is built without CONFIG_MODULE_SIG and CONFIG_SECURITY_LOCKDOWN_LSM, so it ignores the module.sig_enforce=1 and lockdown=confidentiality parameters set by hardened-extended. The preset suggested protection that wasn't there. Drop both and leave a comment saying why, so they don't get re-added from madaidan's guide. Nothing changes on the stock kernel. Users of a custom kernel with module signing or lockdown who relied on the preset need to set these parameters in boot.kernelParams themselves. NixOS doesn't sign its modules, so sig_enforce=1 would block every module on such a kernel. Follow-up to #182
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #177.
modules/presets/hardened.niximported the NixOS hardened profile, which 26.05 removed along withlinux_hardened. Every bitcoinix release (v0.1.0–v0.1.3) is on 26.05, so the preset has never hardened anything here: its two remaining lines (allowUserNamespaces = true,libcallocator) are NixOS defaults.Correction to the issue:
hardened-extended.nixis not a no-op. Its own sysctls, kernel params, module blacklist and usbguard still apply; it only lost the profile underneath.Plan / changes
hardened.nix→ stub with a failing assertion: remove the import, seehardened-extended.nixor the NixOS Hardening wiki. A stub instead of deleting gives a clear message rather than a missing-path error, and an assertion (notthrow) stays inert underdisabledModules.hardened-extended.nix: drop the import, fix the header comment.examples/configuration.nix: drop the default import and the "~50% performance" note;hardened-extendedstays commented out, so new installs are unchanged.examples/qemu-vm/vm-config.nix: drop the now-pointlessdisabledModules.README.md: link thehardened-extendedpreset instead of promising a hardened kernel.hardenedtest scenario: it still covershardened-extended.hardened-extendedusers get no change.No
versioning.nixentry, on purpose. The stub's assertion always fires, so an entry gated byconfigVersionwould never be reached and would add nothing.hardened-extendedusers need no action.Tested
hardenedscenario: VM drvPath identical to master (9dhpvi3n…), so no change forhardened-extendedusers.disabledModules, the message doesn't appear.nix flake check --all-systemspasses.examples,deploymentExamples(none of them import the preset).Follow-up (not in this PR)
hardened-extendedsetsmodule.sig_enforce=1andlockdown=confidentiality. Whether these block module loading or do nothing on the stock NixOS kernel is unchecked. Worth verifying before recommending the preset more prominently.Assisted-by: Claude Code (claude-opus-5-5)