| 1 |
# SPDX-License-Identifier: GPL-2.0-only |
| 2 |
# |
| 3 |
# Security configuration |
| 4 |
# |
| 5 |
|
| 6 |
menu "Security options" |
| 7 |
|
| 8 |
source "security/keys/Kconfig" |
| 9 |
|
| 10 |
config SECURITY_DMESG_RESTRICT |
| 11 |
bool "Restrict unprivileged access to the kernel syslog" |
| 12 |
default n |
| 13 |
help |
| 14 |
This enforces restrictions on unprivileged users reading the kernel |
| 15 |
syslog via dmesg(8). |
| 16 |
|
| 17 |
If this option is not selected, no restrictions will be enforced |
| 18 |
unless the dmesg_restrict sysctl is explicitly set to (1). |
| 19 |
|
| 20 |
If you are unsure how to answer this question, answer N. |
| 21 |
|
| 22 |
choice |
| 23 |
prompt "Allow /proc/pid/mem access override" |
| 24 |
default PROC_MEM_ALWAYS_FORCE |
| 25 |
help |
| 26 |
Traditionally /proc/pid/mem allows users to override memory |
| 27 |
permissions for users like ptrace, assuming they have ptrace |
| 28 |
capability. |
| 29 |
|
| 30 |
This allows people to limit that - either never override, or |
| 31 |
require actual active ptrace attachment. |
| 32 |
|
| 33 |
Defaults to the traditional behavior (for now) |
| 34 |
|
| 35 |
config PROC_MEM_ALWAYS_FORCE |
| 36 |
bool "Traditional /proc/pid/mem behavior" |
| 37 |
help |
| 38 |
This allows /proc/pid/mem accesses to override memory mapping |
| 39 |
permissions if you have ptrace access rights. |
| 40 |
|
| 41 |
config PROC_MEM_FORCE_PTRACE |
| 42 |
bool "Require active ptrace() use for access override" |
| 43 |
help |
| 44 |
This allows /proc/pid/mem accesses to override memory mapping |
| 45 |
permissions for active ptracers like gdb. |
| 46 |
|
| 47 |
config PROC_MEM_NO_FORCE |
| 48 |
bool "Never" |
| 49 |
help |
| 50 |
Never override memory mapping permissions |
| 51 |
|
| 52 |
endchoice |
| 53 |
|
| 54 |
config MSEAL_SYSTEM_MAPPINGS |
| 55 |
bool "mseal system mappings" |
| 56 |
depends on 64BIT |
| 57 |
depends on ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS |
| 58 |
depends on !CHECKPOINT_RESTORE |
| 59 |
help |
| 60 |
Apply mseal on system mappings. |
| 61 |
The system mappings includes vdso, vvar, vvar_vclock, |
| 62 |
vectors (arm compat-mode), sigpage (arm compat-mode), uprobes. |
| 63 |
|
| 64 |
A 64-bit kernel is required for the memory sealing feature. |
| 65 |
No specific hardware features from the CPU are needed. |
| 66 |
|
| 67 |
WARNING: This feature breaks programs which rely on relocating |
| 68 |
or unmapping system mappings. Known broken software at the time |
| 69 |
of writing includes CHECKPOINT_RESTORE, UML, gVisor, rr. Therefore |
| 70 |
this config can't be enabled universally. |
| 71 |
|
| 72 |
For complete descriptions of memory sealing, please see |
| 73 |
Documentation/userspace-api/mseal.rst |
| 74 |
|
| 75 |
config SECURITY_PERF_EVENTS_RESTRICT |
| 76 |
bool "Restrict unprivileged use of performance events" |
| 77 |
depends on PERF_EVENTS |
| 78 |
help |
| 79 |
If you say Y here, the kernel.perf_event_paranoid sysctl |
| 80 |
will be set to 3 by default, and no unprivileged use of the |
| 81 |
perf_event_open syscall will be permitted unless it is |
| 82 |
changed. |
| 83 |
|
| •84 |
config SECURITY |
| 85 |
bool "Enable different security models" |
| 86 |
depends on SYSFS |
| 87 |
depends on MULTIUSER |
| 88 |
help |
| 89 |
This allows you to choose different security modules to be |
| 90 |
configured into your kernel. |
| 91 |
|
| 92 |
If this option is not selected, the default Linux security |
| 93 |
model will be used. |
| 94 |
|
| 95 |
If you are unsure how to answer this question, answer N. |
| 96 |
|
| 97 |
config HAS_SECURITY_AUDIT |
| 98 |
def_bool y |
| 99 |
depends on AUDIT |
| 100 |
depends on SECURITY |
| 101 |
|
| 102 |
config SECURITYFS |
| 103 |
bool "Enable the securityfs filesystem" |
| 104 |
help |
| 105 |
This will build the securityfs filesystem. It is currently used by |
| 106 |
various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM). |
| 107 |
|
| 108 |
If you are unsure how to answer this question, answer N. |
| 109 |
|
| 110 |
config SECURITY_NETWORK |
| 111 |
bool "Socket and Networking Security Hooks" |
| 112 |
depends on SECURITY |
| 113 |
help |
| 114 |
This enables the socket and networking security hooks. |
| 115 |
If enabled, a security module can use these hooks to |
| 116 |
implement socket and networking access controls. |
| 117 |
If you are unsure how to answer this question, answer N. |
| 118 |
|
| 119 |
config SECURITY_INFINIBAND |
| 120 |
bool "Infiniband Security Hooks" |
| 121 |
depends on SECURITY && INFINIBAND |
| 122 |
help |
| 123 |
This enables the Infiniband security hooks. |
| 124 |
If enabled, a security module can use these hooks to |
| 125 |
implement Infiniband access controls. |
| 126 |
If you are unsure how to answer this question, answer N. |
| 127 |
|
| 128 |
config SECURITY_NETWORK_XFRM |
| 129 |
bool "XFRM (IPSec) Networking Security Hooks" |
| 130 |
depends on XFRM && SECURITY_NETWORK |
| 131 |
help |
| 132 |
This enables the XFRM (IPSec) networking security hooks. |
| 133 |
If enabled, a security module can use these hooks to |
| 134 |
implement per-packet access controls based on labels |
| 135 |
derived from IPSec policy. Non-IPSec communications are |
| 136 |
designated as unlabelled, and only sockets authorized |
| 137 |
to communicate unlabelled data can send without using |
| 138 |
IPSec. |
| 139 |
If you are unsure how to answer this question, answer N. |
| 140 |
|
| 141 |
config SECURITY_PATH |
| 142 |
bool "Security hooks for pathname based access control" |
| 143 |
depends on SECURITY |
| 144 |
help |
| 145 |
This enables the security hooks for pathname based access control. |
| 146 |
If enabled, a security module can use these hooks to |
| 147 |
implement pathname based access controls. |
| 148 |
If you are unsure how to answer this question, answer N. |
| 149 |
|
| 150 |
config INTEL_TXT |
| 151 |
bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)" |
| 152 |
depends on HAVE_INTEL_TXT |
| 153 |
help |
| 154 |
This option enables support for booting the kernel with the |
| 155 |
Trusted Boot (tboot) module. This will utilize |
| 156 |
Intel(R) Trusted Execution Technology to perform a measured launch |
| 157 |
of the kernel. If the system does not support Intel(R) TXT, this |
| 158 |
will have no effect. |
| 159 |
|
| 160 |
Intel TXT will provide higher assurance of system configuration and |
| 161 |
initial state as well as data reset protection. This is used to |
| 162 |
create a robust initial kernel measurement and verification, which |
| 163 |
helps to ensure that kernel security mechanisms are functioning |
| 164 |
correctly. This level of protection requires a root of trust outside |
| 165 |
of the kernel itself. |
| 166 |
|
| 167 |
Intel TXT also helps solve real end user concerns about having |
| 168 |
confidence that their hardware is running the VMM or kernel that |
| 169 |
it was configured with, especially since they may be responsible for |
| 170 |
providing such assurances to VMs and services running on it. |
| 171 |
|
| 172 |
See <https://www.intel.com/technology/security/> for more information |
| 173 |
about Intel(R) TXT. |
| 174 |
See <http://tboot.sourceforge.net> for more information about tboot. |
| 175 |
See Documentation/arch/x86/intel_txt.rst for a description of how to enable |
| 176 |
Intel TXT support in a kernel boot. |
| 177 |
|
| 178 |
If you are unsure as to whether this is required, answer N. |
| 179 |
|
| 180 |
config LSM_MMAP_MIN_ADDR |
| 181 |
int "Low address space for LSM to protect from user allocation" |
| 182 |
depends on SECURITY && SECURITY_SELINUX |
| 183 |
default 32768 if ARM || (ARM64 && COMPAT) |
| 184 |
default 65536 |
| 185 |
help |
| 186 |
This is the portion of low virtual memory which should be protected |
| 187 |
from userspace allocation. Keeping a user from writing to low pages |
| 188 |
can help reduce the impact of kernel NULL pointer bugs. |
| 189 |
|
| 190 |
For most ia64, ppc64 and x86 users with lots of address space |
| 191 |
a value of 65536 is reasonable and should cause no problems. |
| 192 |
On arm and other archs it should not be higher than 32768. |
| 193 |
Programs which use vm86 functionality or have some need to map |
| 194 |
this low address space will need the permission specific to the |
| 195 |
systems running LSM. |
| 196 |
|
| 197 |
config STATIC_USERMODEHELPER |
| 198 |
bool "Force all usermode helper calls through a single binary" |
| 199 |
help |
| 200 |
By default, the kernel can call many different userspace |
| 201 |
binary programs through the "usermode helper" kernel |
| 202 |
interface. Some of these binaries are statically defined |
| 203 |
either in the kernel code itself, or as a kernel configuration |
| 204 |
option. However, some of these are dynamically created at |
| 205 |
runtime, or can be modified after the kernel has started up. |
| 206 |
To provide an additional layer of security, route all of these |
| 207 |
calls through a single executable that can not have its name |
| 208 |
changed. |
| 209 |
|
| 210 |
Note, it is up to this single binary to then call the relevant |
| 211 |
"real" usermode helper binary, based on the first argument |
| 212 |
passed to it. If desired, this program can filter and pick |
| 213 |
and choose what real programs are called. |
| 214 |
|
| 215 |
If you wish for all usermode helper programs are to be |
| 216 |
disabled, choose this option and then set |
| 217 |
STATIC_USERMODEHELPER_PATH to an empty string. |
| 218 |
|
| 219 |
config STATIC_USERMODEHELPER_PATH |
| 220 |
string "Path to the static usermode helper binary" |
| 221 |
depends on STATIC_USERMODEHELPER |
| 222 |
default "/sbin/usermode-helper" |
| 223 |
help |
| 224 |
The binary called by the kernel when any usermode helper |
| 225 |
program is wish to be run. The "real" application's name will |
| 226 |
be in the first argument passed to this program on the command |
| 227 |
line. |
| 228 |
|
| 229 |
If you wish for all usermode helper programs to be disabled, |
| 230 |
specify an empty string here (i.e. ""). |
| 231 |
|
| 232 |
source "security/selinux/Kconfig" |
| 233 |
source "security/smack/Kconfig" |
| 234 |
source "security/tomoyo/Kconfig" |
| 235 |
source "security/apparmor/Kconfig" |
| 236 |
source "security/loadpin/Kconfig" |
| 237 |
source "security/yama/Kconfig" |
| 238 |
source "security/safesetid/Kconfig" |
| 239 |
source "security/lockdown/Kconfig" |
| 240 |
source "security/landlock/Kconfig" |
| 241 |
source "security/ipe/Kconfig" |
| 242 |
|
| 243 |
source "security/integrity/Kconfig" |
| 244 |
|
| 245 |
choice |
| 246 |
prompt "First legacy 'major LSM' to be initialized" |
| 247 |
default DEFAULT_SECURITY_SELINUX if SECURITY_SELINUX |
| 248 |
default DEFAULT_SECURITY_SMACK if SECURITY_SMACK |
| 249 |
default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO |
| 250 |
default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR |
| 251 |
default DEFAULT_SECURITY_DAC |
| 252 |
|
| 253 |
help |
| 254 |
This choice is there only for converting CONFIG_DEFAULT_SECURITY |
| 255 |
in old kernel configs to CONFIG_LSM in new kernel configs. Don't |
| 256 |
change this choice unless you are creating a fresh kernel config, |
| 257 |
for this choice will be ignored after CONFIG_LSM has been set. |
| 258 |
|
| 259 |
Selects the legacy "major security module" that will be |
| 260 |
initialized first. Overridden by non-default CONFIG_LSM. |
| 261 |
|
| 262 |
config DEFAULT_SECURITY_SELINUX |
| 263 |
bool "SELinux" if SECURITY_SELINUX=y |
| 264 |
|
| 265 |
config DEFAULT_SECURITY_SMACK |
| 266 |
bool "Simplified Mandatory Access Control" if SECURITY_SMACK=y |
| 267 |
|
| 268 |
config DEFAULT_SECURITY_TOMOYO |
| 269 |
bool "TOMOYO" if SECURITY_TOMOYO=y |
| 270 |
|
| 271 |
config DEFAULT_SECURITY_APPARMOR |
| 272 |
bool "AppArmor" if SECURITY_APPARMOR=y |
| 273 |
|
| 274 |
config DEFAULT_SECURITY_DAC |
| 275 |
bool "Unix Discretionary Access Controls" |
| 276 |
|
| 277 |
endchoice |
| 278 |
|
| 279 |
config LSM |
| 280 |
string "Ordered list of enabled LSMs" |
| 281 |
depends on SECURITY |
| 282 |
default "landlock,lockdown,yama,loadpin,safesetid,smack,selinux,tomoyo,apparmor,ipe,bpf" if DEFAULT_SECURITY_SMACK |
| 283 |
default "landlock,lockdown,yama,loadpin,safesetid,apparmor,selinux,smack,tomoyo,ipe,bpf" if DEFAULT_SECURITY_APPARMOR |
| 284 |
default "landlock,lockdown,yama,loadpin,safesetid,tomoyo,ipe,bpf" if DEFAULT_SECURITY_TOMOYO |
| 285 |
default "landlock,lockdown,yama,loadpin,safesetid,ipe,bpf" if DEFAULT_SECURITY_DAC |
| 286 |
default "landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,ipe,bpf" |
| 287 |
help |
| 288 |
A comma-separated list of LSMs, in initialization order. |
| 289 |
Any LSMs left off this list, except for those with order |
| 290 |
LSM_ORDER_FIRST and LSM_ORDER_LAST, which are always enabled |
| 291 |
if selected in the kernel configuration, will be ignored. |
| 292 |
This can be controlled at boot with the "lsm=" parameter. |
| 293 |
|
| 294 |
If unsure, leave this as the default. |
| 295 |
|
| 296 |
config SECURITY_COMMONCAP_KUNIT_TEST |
| 297 |
bool "Build KUnit tests for commoncap" if !KUNIT_ALL_TESTS |
| 298 |
depends on KUNIT=y && USER_NS |
| 299 |
default KUNIT_ALL_TESTS |
| 300 |
help |
| 301 |
This builds the commoncap KUnit tests. |
| 302 |
|
| 303 |
KUnit tests run during boot and output the results to the debug log |
| 304 |
in TAP format (https://testanything.org/). Only useful for kernel devs |
| 305 |
running KUnit test harness and are not for inclusion into a |
| 306 |
production build. |
| 307 |
|
| 308 |
For more information on KUnit and unit tests in general please refer |
| 309 |
to the KUnit documentation in Documentation/dev-tools/kunit/. |
| 310 |
|
| 311 |
If unsure, say N. |
| 312 |
|
| 313 |
source "security/Kconfig.hardening" |
| 314 |
|
| 315 |
endmenu |
| 316 |
|