Skip to content

Security concepts

Before configuring the hardening of a host, you need to understand what is protected by the darkone.system.security module and how it decides to enable a protection. This page gathers all the useful concepts for configuring security with confidence.

Hardening follows the ANSSI BP-028 🡕 (GNU/Linux) standard. Each recommendation bears a code (R30, C4…) and is activated automatically according to the machine’s level and category.

Security is not a switch, it’s a slider. Start from a safe foundation for everyone, then harden where the risk justifies it. Three principles guide every rule.

PrincipleIdeaExample in DNF
Defense in depthStack barriers, none aloneFirewall, service isolation, encryption
Least privilegeGive just what’s needed, nothing moreTargeted sudo, services without root rights
Reduced attack surfaceLess exposed code, fewer flawsOutdated services disabled, ports monitored
Diagram

A rule applies if, and only if, all of these conditions are met. These are the only settings you need to know.

LeverRole
enableActivates the module (enabled by default on all hosts)
levelThe targeted level: the higher it is, the more rules are activated
categoryThe machine type: adds rules specific to workstation or server
excludesLabels that disable a group of incompatible rules
exceptionsA specific rule overridden, with mandatory justification
darkone.system.security = {
enable = true;
level = "intermediary"; # minimal | intermediary | reinforced | high
category = "server"; # base | client | server
};

Levels are cumulative: each tier adds its rules to those of lower tiers. You go up gradually, testing each host.

LevelWhat forCost / constraints
minimalCommon base, any system (default)Nearly none, transparent
intermediaryRecommended for almost all systemsLow, a few adjustments
reinforcedSensitive or multi-user systemsReal: isolation, MAC, auditd
highDedicated skills and budgetHigh: kernel recompilation

The category selects subsets of rules according to the machine’s usage. It is independent of the level.

CategoryTargeted machineNotably adds
baseUniversal, always appliedAll common rules
clientWorkstation (screen, USB, session)USBGuard, session locking
serverServer (exposed services)Network isolation, service monitoring

The module’s protections rely on standard Linux mechanisms. Here are the ones you need to know to read the rules catalog.

ConceptWhat it does
Secure Boot 🡕Only allows signed code at boot (anti-rootkit)
LUKS2 🡕Encrypts the disk: stolen machine = unreadable data
IOMMU 🡕Isolates device memory access (anti-DMA)
Bootloader passwordPrevents modifying the boot process without authentication
ConceptWhat it does
sysctl 🡕Kernel settings that close risky behaviors
LSM 🡕Security modules hooked into the kernel
Lockdown 🡕Locks direct kernel access (memory, kexec)
Yama 🡕Restricts ptrace (a process cannot spy on another)
Signed modulesRefuses to load an unsigned kernel driver
linux_hardened 🡕Precompiled kernel with enhanced protections
ConceptWhat it does
PAM 🡕The chain that validates each authentication
yescrypt 🡕Modern password storage algorithm
pam_faillockLocks the account after several failures (anti brute force)
Immutable accountsAccounts are declared in config, not created on the fly
Least privilege sudoTargeted, traced admin rights, without negation
ConceptWhat it does
MAC 🡕Mandatory Access Control (AppArmor): a service does not leave its sandbox
systemd isolationProtectSystem, namespaces, reduced capabilities per service
CapabilitiesGrant a specific right (e.g. open a port) without full root
Minimal setuidReduce binaries that run as root
ConceptWhat it does
nftables 🡕The firewall engine (DNF is deny-by-default)
Egress filteringBlocks what the machine is allowed to contact
DNSSEC 🡕 / DoT 🡕Authenticated and encrypted DNS resolution
NTS 🡕Authenticated time synchronization
Reduced network surfaceMonitors and limits listening ports
ConceptWhat it does
Sealed persistent logsTamper-proof traces, preserved across reboots
auditd 🡕Records sensitive system calls
Sealing / HIDSVerifies that no system file has been altered

Some rules break legitimate usage. They are neutralized by label in excludes, without lowering the global level.

LabelIgnores
kernel-recompileKernel hardening at compilation (R15 to R27, C1)
no-ipv6IPv6 disabling (R13, R22)
no-macMandatory access control (R37, R45)
no-auditdauditd (R73)
needs-jitStrict W^X (Java, .NET, V8, WebAssembly)
needs-hibernationDisabling hibernation (laptops)
needs-usb-hotplugUSBGuard (workstations with frequent USB connections)
darkone.system.security.excludes = [ "needs-jit" "no-ipv6" ];

To bypass one specific rule without affecting the rest, set an exception with a justification (mandatory, tracked in configuration).

darkone.system.security.exceptions = {
R9.rationale = "Conteneurs rootless requis en développement.";
};

Raising a level may hinder common usage. Main pitfalls:

Each rule file documents its side effects in sideEffects comments. The rule catalog provides an overview by level.