Security modules
π darkone.security.complement
Section titled βπ darkone.security.complementβCross-cutting complementary measures β Annex A (C1βC12). (wip)
These measures have no ANSSI number but are essential to the guideβs spirit. Covers linux-hardened patches (C1), Lockdown LSM (C2), USBGuard (C3), nftables deny-by-default (C4), hardened SSH (C5), LUKS2 (C6), NTP/NTS (C7), secure DNS (C8), disabled core dumps (C9), PAM anti brute-force (C10), legal banners (C11), and cron/at restriction (C12).
- enable
boolEnable complementary ANSSI measures (C1βC12). - lockdownLevel
enum [ "none" "integrity" "confidentiality" ]Lockdown LSM level (C2) - lsmStack
listOf strLSM stack order (C2, R11, R20). Modifies boot.kernelParams lsm=β¦ - ntpServers
listOf strNTP/NTS servers (C7). - useNts
boolEnable NTS (Network Time Security) for NTP authentication (C7). - sshBanner
strSSH banner displayed before authentication (C11). - cronAllowedUsers
listOf strUsers allowed to schedule cron jobs (C12). - egressAllowlist
listOf strIP/CIDR allowed outbound for strict nftables egress filtering (C4).
darkone.security.complement = { enable = false; lockdownLevel = "integrity"; lsmStack = [ ]; ntpServers = [ ]; useNts = true; sshBanner = '' *** Access restricted to authorized personnel *** All connections are logged and may be subject to prosecution. ''; cronAllowedUsers = [ ]; egressAllowlist = [ ];};π darkone.security.filesystem
Section titled βπ darkone.security.filesystemβPartitioning, file tree, and file permissions (R28βR29, R50βR57). (wip)
Covers secure mount options (R28), restriction of /boot (R29), permissions of sensitive files (R50), passwords kept out of the store (R51), sockets (R52), orphan files (R53), sticky bit (R54), per-user temporary directories (R55), and setuid (R56, R57).
- enable
boolEnable ANSSI filesystem hardening (R28βR29, R50βR57). - allowedSetuid
listOf strAllowlist of tolerated setuid/setgid binaries (R56, R57).
darkone.security.filesystem = { enable = false; allowedSetuid = [ ];};π darkone.security.integrity
Section titled βπ darkone.security.integrityβFilesystem integrity β HIDS (R76βR77). (wip)
Covers sealing and integrity verification via AIDE (R76) and protection of the sealed database with GPG signature plus remote copy (R77).
- enable
boolEnable ANSSI HIDS integrity β AIDE (R76βR77). - aideRemoteCopy
nullOr ( submodule { options = { host = lib.mkOption { type = str; description = "Remote host for the AIDE database copy."; }; sshKeyFile = lib.mkOption { type = path; description = "Path to the private SSH key for the remote copy."; }; }; } )Remote copy of the GPG-signed AIDE database (R77). null = disabled.- host
strRemote host for the AIDE database copy. - sshKeyFile
pathPath to the private SSH key for the remote copy.
- host
darkone.security.integrity = { enable = false; aideRemoteCopy = null; aideRemoteCopy.host = null; aideRemoteCopy.sshKeyFile = null;};π darkone.security.journaling
Section titled βπ darkone.security.journalingβLogging and auditd (R71βR73). (wip)
Covers persistent logging with TLS forwarding (R71), per-service dedicated journals (R72), and auditd with ANSSI rules (R73).
- enable
boolEnable ANSSI logging and auditd (R71βR73).
darkone.security.journaling.enable = false;π darkone.security.kernel-build
Section titled βπ darkone.security.kernel-buildβStatic kernel configuration β requires recompilation (R15βR27). (wip)
These rules require a custom kernel via boot.kernelPackages.
NixOS allows this through structuredExtraConfig. All these rules carry
the kernel-recompile tag: they are skipped if that tag is in excludes.
- enable
boolEnable the ANSSI kernel recompilation module (R15βR27).
darkone.security.kernel-build.enable = false;π darkone.security.kernel-params
Section titled βπ darkone.security.kernel-paramsβDynamic kernel configuration: boot parameters and sysctls (R8βR14). (wip)
Rules applicable without recompiling the kernel. Covers memory options (R8), system sysctls (R9), disabling module loading (R10), Yama/ptrace (R11), IPv4 network sysctls (R12), IPv6 disabling (R13), and filesystem sysctls (R14).
- enable
boolEnable ANSSI dynamic kernel parameters (R8βR14).
darkone.security.kernel-params.enable = false;π darkone.security.mac
Section titled βπ darkone.security.macβMandatory Access Control β MAC (R37, R45βR49). (wip)
R37 is a meta rule: valid if at least R45 (AppArmor) or R46 (SELinux)
is active. SELinux (R46βR49) is not supported on NixOS and is excluded
by default via exceptions. AppArmor (R45) is partially supported.
- enable
boolEnable ANSSI MAC module β AppArmor/SELinux (R37, R45βR49).
darkone.security.mac.enable = false;π darkone.security.mta
Section titled βπ darkone.security.mtaβLocal mail handling (R74βR75). (wip)
Covers the local MTA hardened to loopback-only (R74) and mail aliases routed to the administratorβs address (R75). These rules only apply if an MTA service is active (Postfix or OpenSMTPD).
- enable
boolEnable ANSSI MTA hardening (R74βR75).
darkone.security.mta.enable = false;π darkone.security.network
Section titled βπ darkone.security.networkβNetwork services β isolation and supervision (R78βR80). (wip)
Covers isolation of network services (R78: server category), hardening and monitoring of exposed services (R79: fail2ban, HTTP headers, ANSSI TLS) and reduction of the network surface (R80).
- enable
boolEnable ANSSI network hardening (R78βR80). - exposedServices
listOf strPublic services for which fail2ban and supervision will be enabled (R79). - publicListeners
listOf strServices allowed to listen on 0.0.0.0 / :: (R80). - httpsHeaders
boolAdds ANSSI HTTP security headers in Nginx/Caddy (R79). - tlsCiphers
listOf strANSSI TLS cipher suite for Nginx (R79).
darkone.security.network = { enable = false; exposedServices = [ ]; publicListeners = [ ]; httpsHeaders = true; tlsCiphers = [ ];};π darkone.security.nss
Section titled βπ darkone.security.nssβNSS β Remote user databases (R69βR70). (wip)
Rules applicable only if an external NSS is active (SSSD, nslcd). Not currently relevant for DNF; see what can be done with Kanidm + PAM.
Covers hardening of remote databases (R69: TLS mandatory) and separation of system and directory accounts (R70).
- enable
boolEnable ANSSI NSS hardening (R69βR70).
darkone.security.nss.enable = false;π darkone.security.packages
Section titled βπ darkone.security.packagesβPackage management and updates (R58βR61). (wip)
Covers installing only what is strictly necessary (R58), trusted repositories (R59), hardened repositories (R60: linux_hardened), and regular updates (R61).
- enable
boolEnable ANSSI package management (R58βR61). - trustedSubstituters
listOf strAllowlist of authorized Nix binary caches (R59). - trustedPublicKeys
listOf strPublic keys for authorized binary caches (R59).
darkone.security.packages = { enable = false; trustedSubstituters = [ ]; trustedPublicKeys = [ ];};π darkone.security.pam
Section titled βπ darkone.security.pamβPAM β Authentication and password storage (R67βR68). (wip)
Covers secure remote PAM authentication (R67: SSSD, Kerberos, pam_faillock) and encrypted password storage (R68: yescrypt).
- enable
boolEnable ANSSI PAM module β authentication and passwords (R67βR68).
darkone.security.pam.enable = false;π darkone.security.preboot
Section titled βπ darkone.security.prebootβHardware configuration and secure boot (R1βR7). (wip)
Covers UEFI Secure Boot (R3), lanzaboote, bootloader password (R5), signed UKIs (R6), and IOMMU (R7). R1 and R2 (hardware/firmware) are out of NixOS scope and only produce a note in the report.
- enable
boolEnable ANSSI secure boot β Secure Boot, IOMMU (R1βR7).
darkone.security.preboot.enable = false;π darkone.security.services
Section titled βπ darkone.security.servicesβHardening of systemd services (R62βR66). (wip)
Covers disabling unnecessary services (R62), reducing functionality via systemd security options (R63), privilege restriction (R64), isolation (R65), and hardening of containerization components (R66).
- enable
boolEnable ANSSI hardening of systemd services (R62βR66). - rootServicesAllowed
listOf strsystemd services allowed to run as root without CapabilityBoundingSet (R64).
darkone.security.services = { enable = false; rootServicesAllowed = [ ];};π darkone.security.sudo
Section titled βπ darkone.security.sudoβsudo hardening (R38βR44). (wip)
Covers the dedicated sudo group (R38), hardened sudo directives (R39), restriction of non-root targets (R40), NOEXEC limitation (R41), forbidding negations (R42), explicit argument specification (R43), and use of sudoedit (R44).
- enable
boolEnable ANSSI sudo hardening (R38βR44). - allowedRootRules
listOf strsudo rules allowed to target root (R40). Others must target a service account.
darkone.security.sudo = { enable = false; allowedRootRules = [ ];};π darkone.security.users
Section titled βπ darkone.security.usersβUser accounts and authentication (R30βR36). (wip)
Covers unused accounts (R30), password policy (R31), inactivity locking (R32), admin accountability (R33), service accounts (R34), unique service accounts (R35), and umask (R36).
- enable
boolEnable ANSSI account management (R30βR36).
darkone.security.users.enable = false;