Skip to content

Commit 1f69b21

Browse files
authored
nixos/profiles: remove hardened (#501199)
2 parents 3ba90b3 + 18a4528 commit 1f69b21

File tree

8 files changed

+16
-271
lines changed

8 files changed

+16
-271
lines changed

nixos/doc/manual/configuration/profiles.chapter.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ profiles/clone-config.section.md
2424
profiles/demo.section.md
2525
profiles/docker-container.section.md
2626
profiles/graphical.section.md
27-
profiles/hardened.section.md
2827
profiles/headless.section.md
2928
profiles/installation-device.section.md
3029
profiles/perlless.section.md

nixos/doc/manual/configuration/profiles/hardened.section.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

nixos/doc/manual/redirects.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,8 @@
17281728
"sec-profile-graphical": [
17291729
"index.html#sec-profile-graphical"
17301730
],
1731-
"sec-profile-hardened": [
1731+
"sec-release-26.05-incompatibilities-profiles-hardened-removed": [
1732+
"release-notes.html#sec-release-26.05-incompatibilities-profiles-hardened-removed",
17321733
"index.html#sec-profile-hardened"
17331734
],
17341735
"sec-profile-headless": [

nixos/doc/manual/release-notes/rl-2605.section.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@
8888

8989
- `opentrack`, `slushload`, `synthesia`, `vtfedit`, `winbox`, `wineasio`, and `yabridge` use wineWow64Packages instead of wineWowPackages as wine versions >= 11.0 have deprecated wineWowPackages. As such, the prefixes for these packages are NOT backwards compatible and need to be regenerated with potential for data loss.
9090

91+
- []{#sec-release-26.05-incompatibilities-profiles-hardened-removed} `profiles/hardened` has been removed, because:
92+
- It lacks a consistent and transparent baseline or standard,
93+
- It may introduce unexpected breakage or degrade performance without clear benefit,
94+
- It is difficult to manage user expectations, especially since the implications of enabling it are not always obvious,
95+
- and as multiple contributors have noted, it is often more of a “grab bag” of settings than a cohesive security policy.
96+
9197
- `services.crabfit` was removed because its upstream packages are unmaintained and insecure.
9298

9399
- `sing-box` has been updated to 1.13.0, which has removed some deprecated options. See [upstream documentation](https://sing-box.sagernet.org/configuration/) for details and migration options.
Lines changed: 8 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,11 @@
1-
# A profile with most (vanilla) hardening options enabled by default,
2-
# potentially at the cost of stability, features and performance.
3-
#
4-
# This profile enables options that are known to affect system
5-
# stability. If you experience any stability issues when using the
6-
# profile, try disabling it. If you report an issue and use this
7-
# profile, always mention that you do.
1+
# This profile included most standard hardening options enabled by default,
2+
# which may have impacted system stability, feature availability, and performance.
83

4+
{ lib, ... }:
95
{
10-
config,
11-
lib,
12-
pkgs,
13-
...
14-
}:
15-
let
16-
inherit (lib)
17-
mkDefault
18-
mkOverride
19-
mkEnableOption
20-
mkIf
21-
maintainers
22-
;
23-
in
24-
{
25-
options.profiles.hardened = mkEnableOption "hardened" // {
26-
default = true;
27-
example = false;
28-
};
29-
config = mkIf config.profiles.hardened {
30-
meta = {
31-
maintainers = [
32-
maintainers.emily
33-
];
34-
};
35-
36-
boot.kernelPackages = mkDefault pkgs.linuxKernel.packages.linux_hardened;
37-
38-
nix.settings.allowed-users = mkDefault [ "@users" ];
39-
40-
environment.memoryAllocator.provider = mkDefault "scudo";
41-
environment.variables.SCUDO_OPTIONS = mkDefault "zero_contents=true";
42-
43-
security.lockKernelModules = mkDefault true;
44-
45-
security.protectKernelImage = mkDefault true;
46-
47-
security.allowSimultaneousMultithreading = mkDefault false;
48-
49-
security.forcePageTableIsolation = mkDefault true;
50-
51-
# This is required by podman to run containers in rootless mode.
52-
security.unprivilegedUsernsClone = mkDefault config.virtualisation.containers.enable;
53-
54-
security.virtualisation.flushL1DataCache = mkDefault "always";
55-
56-
security.apparmor.enable = mkDefault true;
57-
security.apparmor.killUnconfinedConfinables = mkDefault true;
58-
59-
boot.kernelParams = [
60-
# Don't merge slabs
61-
"slab_nomerge"
62-
63-
# Overwrite free'd pages
64-
"page_poison=1"
65-
66-
# Enable page allocator randomization
67-
"page_alloc.shuffle=1"
68-
69-
# Disable debugfs
70-
"debugfs=off"
71-
];
72-
73-
boot.blacklistedKernelModules = [
74-
# Obscure network protocols
75-
"ax25"
76-
"netrom"
77-
"rose"
78-
79-
# Old or rare or insufficiently audited filesystems
80-
"adfs"
81-
"affs"
82-
"bfs"
83-
"befs"
84-
"cramfs"
85-
"efs"
86-
"erofs"
87-
"exofs"
88-
"freevxfs"
89-
"f2fs"
90-
"hfs"
91-
"hpfs"
92-
"jfs"
93-
"minix"
94-
"nilfs2"
95-
"ntfs"
96-
"omfs"
97-
"qnx4"
98-
"qnx6"
99-
"sysv"
100-
"ufs"
101-
];
102-
103-
# Hide kptrs even for processes with CAP_SYSLOG
104-
boot.kernel.sysctl."kernel.kptr_restrict" = mkOverride 500 2;
105-
106-
# Disable bpf() JIT (to eliminate spray attacks)
107-
boot.kernel.sysctl."net.core.bpf_jit_enable" = mkDefault false;
108-
109-
# Disable ftrace debugging
110-
boot.kernel.sysctl."kernel.ftrace_enabled" = mkDefault false;
111-
112-
# Enable strict reverse path filtering (that is, do not attempt to route
113-
# packets that "obviously" do not belong to the iface's network; dropped
114-
# packets are logged as martians).
115-
boot.kernel.sysctl."net.ipv4.conf.all.log_martians" = mkDefault true;
116-
boot.kernel.sysctl."net.ipv4.conf.all.rp_filter" = mkDefault "1";
117-
boot.kernel.sysctl."net.ipv4.conf.default.log_martians" = mkDefault true;
118-
boot.kernel.sysctl."net.ipv4.conf.default.rp_filter" = mkDefault "1";
119-
120-
# Ignore broadcast ICMP (mitigate SMURF)
121-
boot.kernel.sysctl."net.ipv4.icmp_echo_ignore_broadcasts" = mkDefault true;
122-
123-
# Ignore incoming ICMP redirects (note: default is needed to ensure that the
124-
# setting is applied to interfaces added after the sysctls are set)
125-
boot.kernel.sysctl."net.ipv4.conf.all.accept_redirects" = mkDefault false;
126-
boot.kernel.sysctl."net.ipv4.conf.all.secure_redirects" = mkDefault false;
127-
boot.kernel.sysctl."net.ipv4.conf.default.accept_redirects" = mkDefault false;
128-
boot.kernel.sysctl."net.ipv4.conf.default.secure_redirects" = mkDefault false;
129-
boot.kernel.sysctl."net.ipv6.conf.all.accept_redirects" = mkDefault false;
130-
boot.kernel.sysctl."net.ipv6.conf.default.accept_redirects" = mkDefault false;
131-
132-
# Ignore outgoing ICMP redirects (this is ipv4 only)
133-
boot.kernel.sysctl."net.ipv4.conf.all.send_redirects" = mkDefault false;
134-
boot.kernel.sysctl."net.ipv4.conf.default.send_redirects" = mkDefault false;
135-
};
6+
imports = [
7+
(lib.mkRemovedOptionModule [ "profiles" "hardened" ] ''
8+
The hardened profile has been removed, see the backward incompatibilities section of the 26.05 release notes for more information.
9+
'')
10+
];
13611
}

nixos/tests/all-tests.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,6 @@ in
701701
package = pkgs.hadoop_3_3;
702702
};
703703
haproxy = runTest ./haproxy.nix;
704-
hardened = runTest ./hardened.nix;
705704
harmonia = runTest ./harmonia.nix;
706705
haste-server = runTest ./haste-server.nix;
707706
hbase2 = runTest {

nixos/tests/hardened.nix

Lines changed: 0 additions & 113 deletions
This file was deleted.

pkgs/os-specific/linux/kernel/hardened/config.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# boot via sysctl or kernel cmdline are left enabled here, for improved
77
# flexibility.
88
#
9-
# See also <nixos/modules/profiles/hardened.nix>
10-
119
{
1210
stdenv,
1311
lib,

0 commit comments

Comments
 (0)