nix-mineral Options
nix-mineral.enable Link copied!
booleanWhether to enable the nix-mineral module.
falsetrue<nix-mineral/nix-mineral.nix>nix-mineral.extras Link copied!
submoduleExtra options that are not part of the main configuration.
{ }<nix-mineral/nix-mineral.nix>nix-mineral.extras.entropy Link copied!
submoduleModify entropy settings for improved security
{ }<nix-mineral/extras/entropy/default.nix>nix-mineral.extras.entropy.extra-latent-entropy Link copied!
booleanGather more entropy on boot.
Note
Only works with the linux_hardened patchset, which is currently ill advised due to inconsistent updates in nixpkgs. This does nothing if using another kernel. Also slows down boot time by a bit.
falsetruenix-mineral.extras.kernel Link copied!
submoduleExtra settings to harden the linux kernel.
{ }<nix-mineral/extras/kernel/default.nix>nix-mineral.extras.kernel.intelme-kmodules Link copied!
booleanIntel ME related kernel modules.
Disable this to avoid putting trust in the highly privilege ME system, but there are potentially other consequences.
Tip
If you use an AMD system, you can disable this without negative consequence and reduce attack surface.
Note
Intel users should read more about the issue at the below links:
- https://www.kernel.org/doc/html/latest/driver-api/mei/mei.html
- https://en.wikipedia.org/wiki/Intel_Management_Engine#Security_vulnerabilities
- https://www.kicksecure.com/wiki/Out-of-band_Management_Technology#Intel_ME_Disabling_Disadvantages
- https://github.com/Kicksecure/security-misc/pull/236#issuecomment-2229092813
- https://github.com/Kicksecure/security-misc/issues/239
truefalse<nix-mineral/extras/kernel/intelme-kmodules.nix>nix-mineral.extras.kernel.load-kernel-modules Link copied!
booleanAllow loading of kernel modules not only at boot via kernel commandline.
Warning
If false, very likely to cause breakage unless you can compile a list of every module
you need and add that to your boot parameters manually.
truefalse<nix-mineral/extras/kernel/load-kernel-modules.nix>nix-mineral.extras.kernel.warn-panic Link copied!
booleanBe extra paranoid of potential kernel exploitation by inducing kernel panics on kernel warns and above.
Warning
This will cause massive instability in the event of any bugs in the kernel.
falsetrue<nix-mineral/extras/kernel/warn-panic.nix>nix-mineral.extras.misc Link copied!
submoduleExtra misc settings.
Most of those are relatively opinionated additional software.
{ }<nix-mineral/extras/misc/default.nix>nix-mineral.extras.misc.apparmor Link copied!
booleanUse an opinionated AppArmor configuration.
Note
This is currently absolutely useless except for compliance, because there are no currently functioning AppArmor profiles! This option exists only for reference sake, once AppArmor is properly fixed to work on NixOS.
falsetrue<nix-mineral/extras/misc/apparmor.nix>nix-mineral.extras.misc.doas-sudo-wrapper Link copied!
booleanCreates a wrapper for doas to simulate sudo, with nano to utilize rnano as editor for editing as root.
falsetrue<nix-mineral/extras/misc/doas-sudo-wrapper.nix>nix-mineral.extras.misc.replace-sudo-with-doas Link copied!
booleanReplace sudo with doas.
doas has a lower attack surface, but is less audited.
falsetrue<nix-mineral/extras/misc/replace-sudo-with-doas.nix>nix-mineral.extras.misc.ssh-hardening Link copied!
booleanUse an opinionated SSH hardening config. Complies with ssh-audit.
Read what everything does first, or else you might get locked out.
This, for example, prevents root login AND password based login.
falsetrue<nix-mineral/extras/misc/ssh-hardening.nix>nix-mineral.extras.misc.usbguard.enable Link copied!
booleanEnable USBGuard, a tool to restrict USB devices.
disable to avoid hassle with handling USB devices at all.
falsetrue<nix-mineral/extras/misc/usbguard.nix>nix-mineral.extras.misc.usbguard.gnome-integration Link copied!
booleanEnable USBGuard dbus daemon and add polkit rules to integrate USBGuard with GNOME Shell.
If you use GNOME, this means that USBGuard automatically allows all newly connected devices while unlocked, and blacklists all newly connected devices while locked. This is obviously very convenient, and is similar behavior to handling USB as ChromeOS and GrapheneOS.
falsetrue<nix-mineral/extras/misc/usbguard.nix>nix-mineral.extras.misc.usbguard.whitelist-at-boot Link copied!
booleanAutomatically allow all connected devices at boot in USBGuard.
If false, USB devices will be blocked until USBGuard is configured.
Note
For laptop users, inbuilt speakers and bluetooth cards may be disabled by USBGuard by default, so whitelisting them manually or enabling this may solve that.
falsetrue<nix-mineral/extras/misc/usbguard.nix>nix-mineral.extras.network Link copied!
submoduleExtra settings for the network.
{ }<nix-mineral/extras/network/default.nix>nix-mineral.extras.network.bluetooth-kmodules Link copied!
booleanEnable bluetooth related kernel modules.
truefalse<nix-mineral/extras/network/bluetooth-kmodules.nix>nix-mineral.extras.network.tcp-window-scaling Link copied!
booleanDisable TCP window scaling.
Warning
If false, may help mitigate TCP reset DoS attacks, but
may also harm network performance when at high latencies.
truefalse<nix-mineral/extras/network/tcp-window-scaling.nix>nix-mineral.extras.system Link copied!
submoduleExtra settings for the system.
{ }<nix-mineral/extras/system/default.nix>nix-mineral.extras.system.hardened-malloc Link copied!
booleanUse hardened-malloc as default memory allocator for all processes.
Warning
DO NOT USE THIS OPTION ON ANY PRODUCTION SYSTEM! FOR TESTING PURPOSES ONLY!
falsetrue<nix-mineral/extras/system/hardened-malloc.nix>nix-mineral.extras.system.lock-root Link copied!
booleanLock the root account.
Note
Requires another method of privilege escalation, i.e sudo or doas, and declarative accounts to work properly.
falsetrue<nix-mineral/extras/system/lock-root.nix>nix-mineral.extras.system.minimize-swapping Link copied!
booleanReduce swappiness to bare minimum.
May reduce risk of writing sensitive information to disk, but hampers zram performance. Also useless if you do not even use a swap file/partition, i.e zram only setup.
falsetrue<nix-mineral/extras/system/minimize-swapping.nix>nix-mineral.extras.system.secure-chrony Link copied!
booleanReplace systemd-timesyncd with chrony for NTP, and configure chrony for NTS and to use the seccomp filter for security.
falsetrue<nix-mineral/extras/system/secure-chrony.nix>nix-mineral.extras.system.unprivileged-userns Link copied!
booleanEnable or disable unprivileged user namespaces.
It has been the cause of many privilege escalation vulnerabilities,
but can cause breakage. If false, this may break some applications
that rely on user namespaces.
Note
It is left enabled by default now because the benefits of rootless sandboxing in Chromium, unprivileged containers, and bubblewrap among many other applications, combined with the increased maturity of unprivileged namespaces as of Oct 2025.
truefalse<nix-mineral/extras/system/unprivileged-userns.nix>nix-mineral.extras.system.zram Link copied!
booleanEnable zram so that memory is more likely to be compressed instead of written to disk, which may include sensitive information.
Improves storage lifespan and overall performance when swapping as a side effect.
Note
Not enabled by default due to interfering with zswap. Additionally, the task of limiting swapping of sensitive data depends highly on the user's individual swapping setup which can't be reliably inferred.
truefalse<nix-mineral/extras/system/zram.nix>nix-mineral.extras.tmpfiles Link copied!
submoduleUse systemd-tmpfiles to restrict file permissions in various folders.
{ }<nix-mineral/extras/tmpfiles/default.nix>nix-mineral.extras.tmpfiles.etc-nixos Link copied!
booleanSet to true to recursively make all files in /etc/nixos owned and readable
only by root.
/etc/nixos is not owned by root by default, which can be hazardous as
files that are included in the rebuild may be editable by unprivileged
users.
Note
This may have unintended side effects if user state is intentionally
stored in /etc/nixos, and is therefore no longer enabled by default.
falsetrue<nix-mineral/extras/tmpfiles/etc-nixos.nix>nix-mineral.extras.tmpfiles.home Link copied!
booleanSet to true to recursively restrict permissions of /home/$USER so that
only the owner of the directory can access it (the user).
Note
This is not retroactively applied. The "~" option means this only applies to newly created files, not existing files. Consider setting manually if this is a priority, but this may have side effects like obliterating existing executable access mask bits.
Warning
This may also have unintended side effects, e.g, root owned files being unreadable if somehow created in a user home directory.
Warning
This may cause recursion/boot speed problems. See:
falsetrue<nix-mineral/extras/tmpfiles/home.nix>nix-mineral.filesystems Link copied!
submoduleUtility for hardening filesystems and special filesystems.
{ }<nix-mineral/nix-mineral.nix>nix-mineral.filesystems.enable Link copied!
booleanEnable the filesystem hardening utility from nix-mineral.
truefalse<nix-mineral/nix-mineral.nix>nix-mineral.filesystems.normal Link copied!
attribute set of (submodule)Filesystem hardening.
Sets the device option as <name>,
and the options: "bind", "nosuid", "noexec", "nodev" by default.
Warning
The default filesystem hardening settings make necessary assumptions
about partition layout. That is, that / is one partition, and
/boot or /boot/EFI is another partition.
If using a more exotic partition layout, you may need to account for
this and adjust nix-mineral.filesystems.normal.$/foo/bar/.options."bind"
accordingly, or face potential evaluation issues.
Bind mounts are necessary when a directory is on a shared partition.
Bind mounts must be EXPLICITLY DISABLED when a directory gets its own, dedicated partition.
{ }<nix-mineral/filesystems/normal.nix>nix-mineral.filesystems.normal.<name>.device Link copied!
null or stringLocation of the device.
"‹name›""/dev/sda"<nix-mineral/filesystems/normal.nix>nix-mineral.filesystems.normal.<name>.enable Link copied!
booleanWhether to enable the filesystem mount.
falsetrue<nix-mineral/filesystems/normal.nix>nix-mineral.filesystems.normal.<name>.options Link copied!
attribute set of (boolean or signed integer or string)Options used to mount the file system.
If the value is false, the option is disabled.
If the value is an integer or a string, it is passed as "name=value".
{
bind = true;
nodev = true;
noexec = true;
nosuid = true;
}{
bind = false;
nodev = false;
noexec = false;
nosuid = false;
}<nix-mineral/filesystems/normal.nix>nix-mineral.filesystems.special Link copied!
attribute set of (submodule)Special Filesystem hardening.
Sets the option "noexec" by default.
{ }<nix-mineral/filesystems/special.nix>nix-mineral.filesystems.special.<name>.device Link copied!
null or stringLocation of the device.
null"/dev/sda"<nix-mineral/filesystems/special.nix>nix-mineral.filesystems.special.<name>.enable Link copied!
booleanWhether to enable the filesystem mount.
falsetrue<nix-mineral/filesystems/special.nix>nix-mineral.filesystems.special.<name>.options Link copied!
attribute set of (boolean or signed integer or string)Options used to mount the file system.
If the value is false, the option is disabled.
If the value is an integer or a string, it is passed as "name=value".
{
noexec = true;
}{
hidepid = 4;
noexec = false;
}<nix-mineral/filesystems/special.nix>nix-mineral.preset Link copied!
one of "default", "compatibility", "maximum", "performance" or list of (one of "default", "compatibility", "maximum", "performance")The preset (or presets) to use for the nix-mineral module. (all presets are applied on top of the default preset)
To select multiple presets, provide a list of preset names. The order of presets matters, the top ones will have more priority.
default: only default settings.compatibility: disables or enables settings to aim at compatibility.maximum: enables every optional security setting to have maximum protection.performance: disables or enables settings to aim at performance.
"default"[
"performance"
"compatibility"
]<nix-mineral/presets/default.nix>nix-mineral.settings Link copied!
submodulenix-mineral settings.
{ }<nix-mineral/nix-mineral.nix>nix-mineral.settings.debug Link copied!
submoduleLimit various debugging information to reduce info available to potential attackers.
{ }<nix-mineral/settings/debug/default.nix>nix-mineral.settings.debug.coredump Link copied!
booleanEnable core dumps everywhere.
Core dumps contain a programs memory, usually after a crash, which could include sensitive information including encryption keys being written to the disk without any protection.
If false, this disables core dumps using a combination of sysctl, PAM, and
systemd. These are grouped together, because the disablement of
any individual one of these might otherwise make available a bypass.
Note
You might need core dumps when debugging crashing programs.
falsetrue<nix-mineral/settings/debug/coredump.nix>nix-mineral.settings.debug.debugfs Link copied!
booleanEnable/disable the Linux debugfs, which exposes a lot of possibly sensitive information.
falsetrue<nix-mineral/settings/debug/debugfs.nix>nix-mineral.settings.debug.dmesg-restrict Link copied!
booleanOnly allow users with root privileges or CAP_SYSLOG to use dmesg.
truefalse<nix-mineral/settings/debug/dmesg-restrict.nix>nix-mineral.settings.debug.efipstore Link copied!
booleanIf set to false, Disable both the EFI persistent storage feature and Error Record Serialization Table (ERST) support as a form of defense-in-depth.
This prevents the kernel from writing crash logs and other persistent data to the storage backend.
falsetrue<nix-mineral/settings/debug/efipstore.nix>nix-mineral.settings.debug.kptr-restrict Link copied!
booleanDisplay all kernel pointers as 0s regardless of user privileges when printed.
This may interfere with specific diagnostic and performance profiling tools.
truefalse<nix-mineral/settings/debug/kptr-restrict.nix>nix-mineral.settings.debug.panic-reboot Link copied!
booleanForce the system to automatically reboot upon kernel panic instead of freezing.
This helps to mitigate denial of service attacks by automatically recovering and preventing the capture of information presented by a kernel panic screen.
This may inhibit debugging kernel panics, since the immediate reboot prevents immediate analysis of error messages which may be displayed.
truefalse<nix-mineral/settings/debug/panic-reboot.nix>nix-mineral.settings.debug.quiet-boot Link copied!
booleanIf set to true, minimize information displayed during boot to reduce information available to an attacker.
truefalse<nix-mineral/settings/debug/quiet-boot.nix>nix-mineral.settings.debug.restrict-printk Link copied!
booleanSupress kernel messages via printk to only display log level 3 (error) messages or higher, e.g, more severe warnings.
This limits access to debugging information which can be used by an attacker.
truefalse<nix-mineral/settings/debug/restrict-printk.nix>nix-mineral.settings.entropy Link copied!
submoduleSettings for entropy sources.
{ }<nix-mineral/settings/entropy/default.nix>nix-mineral.settings.entropy.aslr Link copied!
booleanTurn on protection and randomize stack, vdso page and mmap + randomize brk base address.
truefalse<nix-mineral/settings/entropy/aslr.nix>nix-mineral.settings.entropy.aslr-max-bits Link copied!
booleanUse the maximum number of bits of entropy to address space layout randomization, a widely used mitigation against memory exploits.
Note
The values used here are currently only valid for x86_64.
Other CPU architectures may require different numbers here, consult upstream documentation as necessary.
truefalse<nix-mineral/settings/entropy/aslr-max-bits.nix>nix-mineral.settings.entropy.hwrng Link copied!
booleanDisable trusting both the CPU's hardware random number generator and any entropy seed passed to the bootloader. We assume the hardware random number generation could be flawed.
falsetrue<nix-mineral/settings/entropy/hwrng.nix>nix-mineral.settings.entropy.jitterentropy Link copied!
booleanEnable jitterentropy with both the daemon and the kernel module to provide additional entropy and compensate for disabled hardware entropy sources.
truefalse<nix-mineral/settings/entropy/jitterentropy.nix>nix-mineral.settings.etc Link copied!
submoduleModify files in /etc to limit attack surface.
{ }<nix-mineral/settings/etc/default.nix>nix-mineral.settings.etc.generic-machine-id Link copied!
booleanSet machine-id to the Kicksecure machine-id, for privacy reasons.
Warning
This may have unintended consequences if machine-id needs to be unique, e.g for log collection or VM management.
truefalse<nix-mineral/settings/etc/generic-machine-id.nix>nix-mineral.settings.etc.kicksecure-bluetooth Link copied!
booleanBorrow Kicksecure bluetooth configuration for better bluetooth privacy and security.
Disables bluetooth automatically when not connected to any device.
truefalse<nix-mineral/settings/etc/kicksecure-bluetooth.nix>nix-mineral.settings.etc.kicksecure-gitconfig Link copied!
booleanBorrow Kicksecure gitconfig, disabling git symlinks and enabling fsck by default for better git security.
truefalse<nix-mineral/settings/etc/kicksecure-gitconfig.nix>nix-mineral.settings.etc.kicksecure-issue Link copied!
booleanBorrow Kicksecure banner/issue.
Provides NO exploit resistance whatsoever, only serves as a deterrent to unauthorized access and to comply with Lynis.
There are no assurances that anything stated here is legally valid.
truefalse<nix-mineral/settings/etc/kicksecure-issue.nix>nix-mineral.settings.etc.kicksecure-module-blacklist Link copied!
booleanBorrow Kicksecure module blacklist.
"install "foobar" /bin/false" prevents the module from being
loaded at all. "blacklist "foobar"" prevents the module from being
loaded automatically at boot, but it can still be loaded afterwards.
Because the "install /bin/false" method does not register as a regular
blacklist, this might cause issues with kernel module auditing e.g
using Lynis. If so, you'll need to generate a whitelist.
Warning
This may have unintended consequences if you require specific drivers, and may cause breakage.
truefalsenix-mineral.settings.etc.no-root-securetty Link copied!
booleanUse an empty /etc/securetty to prevent root login on tty.
Warning
If set to true, logging in as the root user will fail and throw an error: "Login incorrect"
truefalse<nix-mineral/settings/etc/no-root-securetty.nix>nix-mineral.settings.kernel Link copied!
submoduleSettings meant to harden the linux kernel.
{ }<nix-mineral/settings/kernel/default.nix>nix-mineral.settings.kernel.amd-iommu-force-isolation Link copied!
booleanSet amd_iommu=force_isolation kernel parameter.
If you're not using an AMD CPU, this does nothing and can be safely ignored.
Warning
You may need to set this to false as a workaround for a boot hanging issue on Linux kernel 6.13.
truefalsenix-mineral.settings.kernel.bdev-write-mount Link copied!
booleanIf set to false, prevent runaway privileged processes from writing to block devices to protect against runaway privileged processes causing filesystem corruption and kernel crashes.
falsetrue<nix-mineral/settings/kernel/bdev-write-mount.nix>nix-mineral.settings.kernel.binfmt-misc Link copied!
booleanEnable binfmt_misc.
Warning
If false, breaks Roseta, among other applications.
falsetrue<nix-mineral/settings/kernel/binfmt-misc.nix>nix-mineral.settings.kernel.busmaster-bit Link copied!
booleanEnable busmaster bit at boot, which may prevent some DMA attacks.
Warning
If false, this may prevent systems with low resource OR specific
firmware configurations from booting.
May worsen performance as a side effect. https://en.wikipedia.org/wiki/Bus_mastering
falsetrue<nix-mineral/settings/kernel/busmaster-bit.nix>nix-mineral.settings.kernel.core-pid Link copied!
booleanIncluding PID in core dumps if those are reenabled, otherwise, this does nothing.
If hideproc is enabled, this prevents some substitution attacks designed obtain sensitive information by predicting PIDs and inducing core dumps.
Otherwise, this is still nice to have for forensic purposes/log analysis, so that sources of core dumps are more obvious.
truefalse<nix-mineral/settings/kernel/core-pid.nix>nix-mineral.settings.kernel.cpu-mitigations Link copied!
one of "smt-off", "smt-on", "off"Apply relevant CPU exploit mitigations, May harm performance.
smt-off: Enable CPU mitigations and disables symmetric multithreading.smt-on: Enable symmetric multithreading and just use default CPU mitigations, to potentially improve performance.off: Disables all CPU mitigations. May improve performance further, but is even more dangerous!
Warning
Turning all CPU mitigations off completely is a TERRIBLE idea. Even the most robustly sandboxed and restricted code in the world can instantly rootkit your computer. One web page is all it takes for all your keys to be someone else's: https://leaky.page/
"smt-off"<nix-mineral/settings/kernel/cpu-mitigations.nix>nix-mineral.settings.kernel.harden-bpf Link copied!
booleanHarden eBPF against JIT spraying attacks, to reduce the risk of abuse because eBPF allows executing potentially dangerous code in the kernel.
truefalse<nix-mineral/settings/kernel/harden-bpf.nix>nix-mineral.settings.kernel.intel-iommu Link copied!
booleanExplicitly enable intel IOMMU to reduce risk of DMA attacks and other memory abuse.
Note
Does nothing if you don't use an intel processor.
truefalse<nix-mineral/settings/kernel/intel-iommu.nix>nix-mineral.settings.kernel.io-uring Link copied!
booleanEnable io_uring, is the cause of many vulnerabilities, and is disabled on Android + ChromeOS.
This may be desired for specific environments concerning Proxmox.
falsetrue<nix-mineral/settings/kernel/io-uring.nix>nix-mineral.settings.kernel.iommu-passthrough Link copied!
booleanEnable or disable bypassing the IOMMU for direct memory access.
Could increase I/O performance on ARM64 systems, with risk.
If false, forces DMA to go through IOMMU to mitigate some DMA attacks.
falsetrue<nix-mineral/settings/kernel/iommu-passthrough.nix>nix-mineral.settings.kernel.kcfi Link copied!
booleanIf set to true, switch (back) to using kCFI as the default Control Flow Integrity (CFI) implementation as kCFI mandates hash validation at the source making it more difficult to bypass.
This is in contrast to FineIBT which was made the default in kernel 6.2 due to its performance benefits as it only performs hash checks at the destinations.
truefalse<nix-mineral/settings/kernel/kcfi.nix>nix-mineral.settings.kernel.kexec Link copied!
booleanPrevent replacing the running kernel with kexec for security reasons.
On other distributions, kexec is most notably used for updating the Linux kernel without rebooting, however, NixOS does not support this.
A comprehensive list of usecases is not feasible, but consider consulting the following references as well as upstream documentation where necessary:
falsetrue<nix-mineral/settings/kernel/kexec.nix>nix-mineral.settings.kernel.kfence Link copied!
booleanIf set to true, enable the kernel "Electric-Fence" sampling-based memory safety error to detect heap out-of-bounds access, use-after-free, and invalid-free errors.
truefalse<nix-mineral/settings/kernel/kfence.nix>nix-mineral.settings.kernel.lockdown Link copied!
booleanEnable linux kernel lockdown, this blocks loading of unsigned kernel modules and breaks hibernation.
Note
If false, you probably want to disable nix-mineral.settings.kernel.only-signed-modules.
truefalse<nix-mineral/settings/kernel/lockdown.nix>nix-mineral.settings.kernel.only-signed-modules Link copied!
booleanRequires all kernel modules to be signed. This prevents out-of-tree kernel modules from working unless signed.
Note
If false, nix-mineral.settings.kernel.lockdown must also be false.
truefalsenix-mineral.settings.kernel.oops-panic Link copied!
booleanIntentionally induce kernel panics on "oops" errors and above, to limit the extent of certain exploits which trigger kernel oopses.
Warning
This might cause stability issues with certain poorly written drivers that aren't malicious. If you experience random kernel panics, consider disabling this.
truefalse<nix-mineral/settings/kernel/oops-panic.nix>nix-mineral.settings.kernel.page-alloc-shuffle Link copied!
booleanMake page allocations less predicatable by randomizing freelists.
Tip
This is one of the few things which IMPROVES performance as a side effect, and there's usually no reason to disable this.
truefalse<nix-mineral/settings/kernel/page-alloc-shuffle.nix>nix-mineral.settings.kernel.perf-subsystem.restrict-access Link copied!
booleanRestrict perf subsystem access to reduce attack surface.
truefalse<nix-mineral/settings/kernel/perf-subsystem.nix>nix-mineral.settings.kernel.perf-subsystem.restrict-usage Link copied!
booleanRestrict perf subsystem usage (activity) to reduce attack surface.
Note
See https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html for more information.
truefalse<nix-mineral/settings/kernel/perf-subsystem.nix>nix-mineral.settings.kernel.pti Link copied!
booleanEnable Page Table Isolation (PTI) to mitigate some KASLR bypasses and the Meltdown CPU vulnerability. It may also tax performance.
truefalse<nix-mineral/settings/kernel/pti.nix>nix-mineral.settings.kernel.randomize-kstack-offset Link copied!
booleanRandomize the kernel's stack offset on every syscall, to make attacks relying on predicting the location of the kernel's stack more difficult.
truefalsenix-mineral.settings.kernel.restrict-bpf Link copied!
booleanRestrict eBPF to CAP_BPF in order to prevent abuse by unprivileged users.
truefalse<nix-mineral/settings/kernel/restrict-bpf.nix>nix-mineral.settings.kernel.restrict-line-disciplines Link copied!
booleanRestrict TTY line discipline loading to CAP_SYS_MODULE to prevent unprivileged users from loading insecure line disciplines.
Note
See https://a13xp0p0v.github.io/2017/03/24/CVE-2017-2636.html as an example exploit.
truefalsenix-mineral.settings.kernel.slab-debug Link copied!
booleanSet to true to modify the "slab_debug" boot parameter to enable red zoning and sanity checks to detect memory corruption.
Adds significant overhead to memory allocation.
Warning
Because this is a debugging option, it will disable kernel pointer hashing and leak kernel memory addresses to root unless the "hash_pointers=always" parameter is used, which is only supported on kernel version 6.17 and above. Otherwise, "hash_pointers" is silently ignored.
truefalse<nix-mineral/settings/kernel/slab-debug.nix>nix-mineral.settings.kernel.slab-merging Link copied!
booleanSet to false to disable slab merging to make it harder to influence the slab cache layout and compartmentalize the damage of certain memory attacks by limiting influence to individual caches.
falsetrue<nix-mineral/settings/kernel/slab-merging.nix>nix-mineral.settings.kernel.strict-iommu Link copied!
booleanEnable and force the IOMMU to be used to reduce the risk of DMA attacks, and strictly invalidate TLBs to prevent abuse of stale data.
truefalse<nix-mineral/settings/kernel/strict-iommu.nix>nix-mineral.settings.kernel.sysrq Link copied!
one of "none", "off", "sak"Control the magic SysRq key functionality of the Linux kernel.
It is a 'magical' key combo you can hit which the kernel will respond to regardless of whatever else it is doing, unless it is completely locked up.
none: Keep the default configuration of your kernel.off: Disables sysrq completely.sak: Enable SAK (Secure Attention Key).
Note
SAK prevents keylogging, if used correctly. See:
"off"<nix-mineral/settings/kernel/sysrq.nix>nix-mineral.settings.kernel.tiocsti Link copied!
booleanIf false, disable TIOCSTI because it's used to inject arbitrary
characters and potentially lead to privilege escalation.
Already disabled by default on modern (>=6.2) Linux kernel versions, but included for future reference.
May break outdated screen readers relying on legacy functionality, but because of the above reasoning, this will never be considered for the compatibility preset.
falsetrue<nix-mineral/settings/kernel/tiocsti.nix>nix-mineral.settings.kernel.unprivileged-userfaultfd Link copied!
booleanIf set to false, limit access to userfaultfd() syscall to the CAP_SYS_PTRACE capability.
userfaultfd has been used for use-after-free exploits in the past.
falsetruenix-mineral.settings.kernel.vdso32 Link copied!
booleanIf set to false, disable 32-bit Virtual Dynamic Shared Object (vDSO) mappings as these are a legacy compatibility feature for superseded glibc versions.
falsetrue<nix-mineral/settings/kernel/vdso32.nix>nix-mineral.settings.kernel.vsyscall Link copied!
booleanIf set to false, Disable vsyscalls, which are obsolete and create static memory locations that are easy to exploit.
falsetrue<nix-mineral/settings/kernel/vsyscall.nix>nix-mineral.settings.kernel.zero-alloc Link copied!
booleanZero memory during both allocation and free time to help mitigate use-after-free exploits.
truefalse<nix-mineral/settings/kernel/zero-alloc.nix>nix-mineral.settings.misc Link copied!
submoduleConfigure miscellaneous settings, usually additional software.
{ }<nix-mineral/settings/misc/default.nix>nix-mineral.settings.misc.bootloader-editor Link copied!
booleanSet to false to disable bootloader editors, to prevent access to the root shell or otherwise weakening security by tampering with boot parameters.
Note
This currently does nothing if you don't use systemd-boot.
Consider filing a PR if/when similar configuration for other bootloaders can be added unobtrusively.
falsetrue<nix-mineral/settings/misc/bootloader-editor.nix>nix-mineral.settings.misc.dnssec Link copied!
booleanMake DNS connections fail if not using a DNS server supporting DNSSEC.
Note
Currently does nothing if you don't use systemd-resolved.
Consider filing a PR if/when similar configuration for other DNS resolving software can be added unobtrusively.
truefalse<nix-mineral/settings/misc/dnssec.nix>nix-mineral.settings.misc.nix-wheel Link copied!
booleanLimit access to nix commands to users with the "wheel" group ("sudoers").
If false, may be useful for allowing a non-wheel user to, for example, use devshell.
truefalse<nix-mineral/settings/misc/nix-wheel.nix>nix-mineral.settings.network Link copied!
submoduleSettings for the network.
{ }<nix-mineral/settings/network/default.nix>nix-mineral.settings.network.arp.announce Link copied!
booleanAlways use the best local address for announcing local IP via ARP.
Seems to be most restrictive option.
truefalse<nix-mineral/settings/network/arp.nix>nix-mineral.settings.network.arp.drop-gratuitous Link copied!
booleanDrop Gratuitous ARP frames to prevent ARP poisoning.
This can cause issues when ARP proxies are used in the network.
truefalse<nix-mineral/settings/network/arp.nix>nix-mineral.settings.network.arp.filter Link copied!
booleanEnable ARP filtering in the kernel to prevent the Linux kernel from handling the ARP table globally and mitigate some ARP spoofing and ARP cache poisoning attacks.
truefalse<nix-mineral/settings/network/arp.nix>nix-mineral.settings.network.arp.ignore Link copied!
one of "none", "local", "link"Ignore/don't reply to specific ARP requests to limit scope of ARP spoofing.
This may break certain VM networking configurations if set to 'link,' which can be fixed by setting to 'local' or 'none.'
However, such a regression has been intentionally excluded from the compatibility preset unless new information or usecases are made apparent, given that this issue appears to be isolated to niche setups which NixOS is not known or advisable to be used for.
none: Keep the default configuration of your kernel.local: Reply only if the target IP address is within the local address range configured on the incoming interfacelink: Reply only if the target IP is on the same link.
Note
See:
- https://github.com/Kicksecure/security-misc/pull/279
- https://github.com/Kicksecure/security-misc/pull/290
- https://github.com/QubesOS/qubes-issues/issues/9990
- https://github.com/mullvad/mullvadvpn-app/blob/main/audits/2024-12-10-X41-D-Sec.md#mllvd-cr-24-03-virtual-ip-address-of-tunnel-device-leaks-to-network-adjacent-participant-severity-medium
- https://github.com/mullvad/mullvadvpn-app/pull/7141
"link"<nix-mineral/settings/network/arp.nix>nix-mineral.settings.network.icmp.cast Link copied!
booleanSet to false to ignore all ICMPv6 and ICMPv4 echo and timestamp requests sent to broadcast/multicast/anycast.
Makes system slightly harder to enumerate on a network.
::: .{note}
Redundant with nix-mineral.settings.network.icmp.ignore-all enabled.
:::
falsetrue<nix-mineral/settings/network/icmp.nix>nix-mineral.settings.network.icmp.ignore-all Link copied!
booleanSet to true to ignore all ICMPv6 and ICMPv4 echo and timestamp requests.
Makes system slightly harder to enumerate on a network.
You will not be able to ping this computer with ICMP packets if this is enabled.
truefalse<nix-mineral/settings/network/icmp.nix>nix-mineral.settings.network.icmp.ignore-bogus Link copied!
booleanIgnore bogus ICMP error responses to reduce potential system impact caused by spammed error responses.
truefalse<nix-mineral/settings/network/icmp.nix>nix-mineral.settings.network.icmp.redirect Link copied!
booleanSet to false to disable ICMP redirects to prevent some MITM attacks.
::: .{note} See:
falsetrue<nix-mineral/settings/network/icmp.nix>nix-mineral.settings.network.icmp.secure-redirect Link copied!
booleanUse secure ICMP redirects by default.
Note
Helpful only if nix-mineral.settings.network.icmp.redirect is enabled, otherwise this does nothing.
Not harmful to leave enabled even if unnecessary.
truefalse<nix-mineral/settings/network/icmp.nix>nix-mineral.settings.network.ip-forwarding Link copied!
booleanEnable or disable IP forwarding.
::: .{warning}
If false, this may cause issues with certain VM networking,
and must be true if the system is meant to function as a router.
:::
falsetrue<nix-mineral/settings/network/ip-forwarding.nix>nix-mineral.settings.network.ipv6-tempaddr Link copied!
booleanEnable IPv6 Privacy Extensions (RFC3041) and prefer the temporary address.
Inclusive a "kitchen sink" config to enable privacy extensions in relevant daemons. If you do not use these, nothing will happen.
If you use alternative daemons or replacements, considering looking at upstream documentation or filing a PR to add their configurations here.
::: .{note} GrapheneOS devs seem to believe it is relevant to use IPV6 privacy extensions alongside MAC randomization, so consider doing both where applicable. https://grapheneos.org/features#wifi-privacy :::
truefalse<nix-mineral/settings/network/ipv6-tempaddr.nix>nix-mineral.settings.network.log-martians Link copied!
booleanLog packets with impossible addresses to kernel log.
No active security benefit, just makes it easier to spot a DDOS/DOS by giving extra logs.
This may worsen performance due to the additional logging.
truefalse<nix-mineral/settings/network/log-martians.nix>nix-mineral.settings.network.max-addresses Link copied!
boolean or signed integerNumber of global unicast IPv6 addresses can be assigned to each interface.
Set this to false to disable this option entirely.
1false<nix-mineral/settings/network/max-addresses.nix>nix-mineral.settings.network.neighbor-solicitations Link copied!
boolean or signed integerNumber of IPv6 duplicate address detection neighbor solicitations to send out per address.
See RFC4681 for details.
Set this to false to disable this option entirely.
0falsenix-mineral.settings.network.random-mac Link copied!
booleanIf set to true, randomize mac addressees to improve privacy.
Note
This currently only works if you use networkmanager. If you don't, this does nothing and you should consult upstream documentation or file a PR to add relevant configuration.
truefalse<nix-mineral/settings/network/random-mac.nix>nix-mineral.settings.network.rfc1337 Link copied!
booleanRFC1337 protects from TIME-WAIT assassination attacks by dropping TCP RST packets when in the TIME-WAIT state.
This protects against some potention DoS attacks which could cause TCP connections to drop given specific circumstances or crafted packets.
truefalse<nix-mineral/settings/network/rfc1337.nix>nix-mineral.settings.network.router-advertisements Link copied!
one of "off", "restrict", "on"IPv6 router advertisements which are accepted.
Malicious router advertisements have the potential to create a MITM attack by modifying the default gateway, cause a DoS/DDoS attack when flooded, or initiate unauthorized IPv6 access.
off: Disable all IPv6 router advertisements.restrict: Restrict the parameters of IPv6 router advertisements which are accepted.on: Enable all IPv6 router advertisements (effectively, do nothing).
Router advertisements are never authenticated, and can be sent and received by any device on the local network.
Warning
Setting to off or restrict may cause issues with IPv6 address autoconfiguration or
host discovery.
"restrict"nix-mineral.settings.network.router-solicitations Link copied!
boolean or signed integerNumber of IPv6 Router Solicitations to send until assuming no routers are present.
Setting to 0 limits outgoing traffic on the network, and reduces the frequecy of IPv6 router advertisements received.
See RFC4681 for details.
Set this to false to disable this option entirely.
Note
There is no point to setting this number above 0 if
nix-mineral.settings.network.router-advertisements is set to off.
0falsenix-mineral.settings.network.rp-filter Link copied!
booleanValidate source IPs of packets received on the machine, protecting from IP spoofing.
truefalse<nix-mineral/settings/network/rp-filter.nix>nix-mineral.settings.network.shared-media Link copied!
booleanEnable sending and receiving of shared media redirects.
This setting overwrites net.ipv4.conf.all.secure_redirects.
Refer to RFC1620
falsetrue<nix-mineral/settings/network/shared-media.nix>nix-mineral.settings.network.source-route Link copied!
booleanDisable source routing if set to false, since it allows for redirecting network traffic and potentially creating a man in the middle attack.
falsetrue<nix-mineral/settings/network/source-route.nix>nix-mineral.settings.network.syncookies Link copied!
booleanUse syncookies to help protect against SYN flooding, a type DoS attack.
truefalse<nix-mineral/settings/network/syncookies.nix>nix-mineral.settings.network.tcp-sack Link copied!
booleanSet to false to disable TCP SACK, which has been used for DoS attacks
and been exploited in the past.
Rarely used, but can reduce networking performance if disabled in certain applications.
falsetrue<nix-mineral/settings/network/tcp-sack.nix>nix-mineral.settings.network.tcp-timestamps Link copied!
booleanEnables TCP timestamps.
Disabling prevents leaking system time, enabling protects against wrapped sequence numbers and improves performance.
Disabling implicitly disables reuse of TIME_WAIT sockets, as they depend on TCP timestamps which may lead to corruption and an inability to detect duplicate packets. It may also result in port exhaustion as ports may not be immediately reused.
There are possible information leaks when timestamps are enabled. Offset randomization used by default prevents uptime prediction, but the rate of incrementing timestamps can be used in some advanced attacks to predict the current clock speed of a running system.
Because nix-mineral has different priorities to Whonix, which influences Kicksecure's development, we choose not to disable timestamps by default since clock speed fingerprinting is not a useful threat to most people; if it is important, it is probably smarter to use another Linux distribution entirely.
Note
In favor of disabling:
- https://madaidans-insecurities.github.io/guides/linux-hardening.html#tcp-timestamps
- https://forums.whonix.org/t/do-ntp-and-tcp-timestamps-really-leak-your-local-time/7824/6
In favor of enabling:
truefalse<nix-mineral/settings/network/tcp-timestamps.nix>nix-mineral.settings.pam Link copied!
submoduleModify pluggable authentication module (PAM) settings.
{ }<nix-mineral/settings/pam/default.nix>nix-mineral.settings.pam.login-faildelay Link copied!
boolean or signed integerAdd/increase the delay to failed logins into the system.
The default for nix-mineral is 4 seconds, or 4000000 microseconds.
4000000false<nix-mineral/settings/pam/login-faildelay.nix>nix-mineral.settings.pam.shadow-hashing Link copied!
boolean or signed integerModify hashing rounds for /etc/shadow; this doesn't automatically
rehash your passwords, you'll need to set passwords for your accounts
again for this to work.
If you declaratively set passwords with a secret manager, consider
using a good number (65536) of hashing rounds or more for resilience to
password cracking.
Set this to false to disable this option entirely.
65536false<nix-mineral/settings/pam/shadow-hashing.nix>nix-mineral.settings.pam.su-wheel-only Link copied!
booleanSet to true to require wheel to use su and su-l, to reduce the risk of
privilege escalation e.g from service accounts which have been
maliciously hijacked and used for a shell.
truefalse<nix-mineral/settings/pam/su-wheel-only.nix>nix-mineral.settings.system Link copied!
submoduleSettings for the system.
{ }<nix-mineral/settings/system/default.nix>nix-mineral.settings.system.file-protection Link copied!
booleanPrevent creation of files in world writable directories under certain circumstances to limit spoofing attacks.
truefalse<nix-mineral/settings/system/file-protection.nix>nix-mineral.settings.system.link-protection Link copied!
booleanProtect hardlinks and softlinks to prevent TOCTOU attacks.
Prevent users from hardlinking to files they can't read/write to.
Allows symlinks to be followed only outside world writable directories, when the owner and follower match, or when the directory and symlink owner match.
truefalse<nix-mineral/settings/system/link-protection.nix>nix-mineral.settings.system.lower-address-mmap Link copied!
booleanAllow or disallow mmap in lower addresses.
Disallowing mmap in lower addresses reduces the risk that incorrect memory allocations could tamper with the kernel, but may also cause compatibility issues with certain legacy software.
falsetrue<nix-mineral/settings/system/lower-address-mmap.nix>nix-mineral.settings.system.multilib Link copied!
booleanEnable multilib support, allowing 32-bit libraries and applications to run.
Warning
if false, this may cause issues with certain games that still require 32-bit libraries.
falsetrue<nix-mineral/settings/system/multilib.nix>nix-mineral.settings.system.proc-mem-force Link copied!
one of "none", "ptrace", "never"Configure whether processes can modify their own memory mappings or not, which could be used for some exploits.
See: https://github.com/Kicksecure/security-misc/pull/332
none - Keep the default configuration of your kernel.
ptrace - Only allow modification of memory mappings using ptrace. Affected by the "yama" option.
never - Do not allow modifying memory mappings at all.
"ptrace"<nix-mineral/settings/system/proc-mem-force.nix>nix-mineral.settings.system.yama Link copied!
one of "none", "relaxed", "restricted"Yama restricts ptrace, which allows processes to read and modify the memory of other processes. This has obvious security implications.
ptrace may be required for specific debugging or certain video game anti cheats. Usually, the 'relaxed' option avoids most breakage.
none: Keep the default configuration of your kernel.relaxed: Only allow parent processes to ptrace child processes.restricted: No processes may be traced with ptrace.
"restricted"<nix-mineral/settings/system/yama.nix>