xref: /linux/security/Kconfig (revision 8c7c1b5506e593ce00c42214b4fcafd640ceeb42)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
21da177e4SLinus Torvalds#
31da177e4SLinus Torvalds# Security configuration
41da177e4SLinus Torvalds#
51da177e4SLinus Torvalds
61da177e4SLinus Torvaldsmenu "Security options"
71da177e4SLinus Torvalds
88636a1f9SMasahiro Yamadasource "security/keys/Kconfig"
91da177e4SLinus Torvalds
10eaf06b24SDan Rosenbergconfig SECURITY_DMESG_RESTRICT
11eaf06b24SDan Rosenberg	bool "Restrict unprivileged access to the kernel syslog"
12eaf06b24SDan Rosenberg	default n
13eaf06b24SDan Rosenberg	help
14eaf06b24SDan Rosenberg	  This enforces restrictions on unprivileged users reading the kernel
15eaf06b24SDan Rosenberg	  syslog via dmesg(8).
16eaf06b24SDan Rosenberg
17eaf06b24SDan Rosenberg	  If this option is not selected, no restrictions will be enforced
18eaf06b24SDan Rosenberg	  unless the dmesg_restrict sysctl is explicitly set to (1).
19eaf06b24SDan Rosenberg
20eaf06b24SDan Rosenberg	  If you are unsure how to answer this question, answer N.
21eaf06b24SDan Rosenberg
2241e8149cSAdrian Ratiuchoice
2341e8149cSAdrian Ratiu	prompt "Allow /proc/pid/mem access override"
2441e8149cSAdrian Ratiu	default PROC_MEM_ALWAYS_FORCE
2541e8149cSAdrian Ratiu	help
2641e8149cSAdrian Ratiu	  Traditionally /proc/pid/mem allows users to override memory
2741e8149cSAdrian Ratiu	  permissions for users like ptrace, assuming they have ptrace
2841e8149cSAdrian Ratiu	  capability.
2941e8149cSAdrian Ratiu
3041e8149cSAdrian Ratiu	  This allows people to limit that - either never override, or
3141e8149cSAdrian Ratiu	  require actual active ptrace attachment.
3241e8149cSAdrian Ratiu
3341e8149cSAdrian Ratiu	  Defaults to the traditional behavior (for now)
3441e8149cSAdrian Ratiu
3541e8149cSAdrian Ratiuconfig PROC_MEM_ALWAYS_FORCE
3641e8149cSAdrian Ratiu	bool "Traditional /proc/pid/mem behavior"
3741e8149cSAdrian Ratiu	help
3841e8149cSAdrian Ratiu	  This allows /proc/pid/mem accesses to override memory mapping
3941e8149cSAdrian Ratiu	  permissions if you have ptrace access rights.
4041e8149cSAdrian Ratiu
4141e8149cSAdrian Ratiuconfig PROC_MEM_FORCE_PTRACE
4241e8149cSAdrian Ratiu	bool "Require active ptrace() use for access override"
4341e8149cSAdrian Ratiu	help
4441e8149cSAdrian Ratiu	  This allows /proc/pid/mem accesses to override memory mapping
4541e8149cSAdrian Ratiu	  permissions for active ptracers like gdb.
4641e8149cSAdrian Ratiu
4741e8149cSAdrian Ratiuconfig PROC_MEM_NO_FORCE
4841e8149cSAdrian Ratiu	bool "Never"
4941e8149cSAdrian Ratiu	help
5041e8149cSAdrian Ratiu	  Never override memory mapping permissions
5141e8149cSAdrian Ratiu
5241e8149cSAdrian Ratiuendchoice
5341e8149cSAdrian Ratiu
54*5796d396SJeff Xuconfig MSEAL_SYSTEM_MAPPINGS
55*5796d396SJeff Xu	bool "mseal system mappings"
56*5796d396SJeff Xu	depends on 64BIT
57*5796d396SJeff Xu	depends on ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
58*5796d396SJeff Xu	depends on !CHECKPOINT_RESTORE
59*5796d396SJeff Xu	help
60*5796d396SJeff Xu	  Apply mseal on system mappings.
61*5796d396SJeff Xu	  The system mappings includes vdso, vvar, vvar_vclock,
62*5796d396SJeff Xu	  vectors (arm compat-mode), sigpage (arm compat-mode), uprobes.
63*5796d396SJeff Xu
64*5796d396SJeff Xu	  A 64-bit kernel is required for the memory sealing feature.
65*5796d396SJeff Xu	  No specific hardware features from the CPU are needed.
66*5796d396SJeff Xu
67*5796d396SJeff Xu	  WARNING: This feature breaks programs which rely on relocating
68*5796d396SJeff Xu	  or unmapping system mappings. Known broken software at the time
69*5796d396SJeff Xu	  of writing includes CHECKPOINT_RESTORE, UML, gVisor, rr. Therefore
70*5796d396SJeff Xu	  this config can't be enabled universally.
71*5796d396SJeff Xu
72*5796d396SJeff Xu	  For complete descriptions of memory sealing, please see
73*5796d396SJeff Xu	  Documentation/userspace-api/mseal.rst
74*5796d396SJeff Xu
751da177e4SLinus Torvaldsconfig SECURITY
761da177e4SLinus Torvalds	bool "Enable different security models"
772c40579bSAdrian Bunk	depends on SYSFS
782813893fSIulia Manda	depends on MULTIUSER
791da177e4SLinus Torvalds	help
801da177e4SLinus Torvalds	  This allows you to choose different security modules to be
811da177e4SLinus Torvalds	  configured into your kernel.
821da177e4SLinus Torvalds
831da177e4SLinus Torvalds	  If this option is not selected, the default Linux security
841da177e4SLinus Torvalds	  model will be used.
851da177e4SLinus Torvalds
861da177e4SLinus Torvalds	  If you are unsure how to answer this question, answer N.
871da177e4SLinus Torvalds
887ccbe076SMickaël Salaünconfig HAS_SECURITY_AUDIT
897ccbe076SMickaël Salaün	def_bool y
907ccbe076SMickaël Salaün	depends on AUDIT
917ccbe076SMickaël Salaün	depends on SECURITY
927ccbe076SMickaël Salaün
93da31894eSEric Parisconfig SECURITYFS
94da31894eSEric Paris	bool "Enable the securityfs filesystem"
95da31894eSEric Paris	help
96da31894eSEric Paris	  This will build the securityfs filesystem.  It is currently used by
97b102c11eSPetr Vorel	  various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
98da31894eSEric Paris
99da31894eSEric Paris	  If you are unsure how to answer this question, answer N.
100da31894eSEric Paris
1011da177e4SLinus Torvaldsconfig SECURITY_NETWORK
1021da177e4SLinus Torvalds	bool "Socket and Networking Security Hooks"
1031da177e4SLinus Torvalds	depends on SECURITY
1041da177e4SLinus Torvalds	help
1051da177e4SLinus Torvalds	  This enables the socket and networking security hooks.
1061da177e4SLinus Torvalds	  If enabled, a security module can use these hooks to
1071da177e4SLinus Torvalds	  implement socket and networking access controls.
1081da177e4SLinus Torvalds	  If you are unsure how to answer this question, answer N.
1091da177e4SLinus Torvalds
110d291f1a6SDaniel Jurgensconfig SECURITY_INFINIBAND
111d291f1a6SDaniel Jurgens	bool "Infiniband Security Hooks"
112d291f1a6SDaniel Jurgens	depends on SECURITY && INFINIBAND
113d291f1a6SDaniel Jurgens	help
114d291f1a6SDaniel Jurgens	  This enables the Infiniband security hooks.
115d291f1a6SDaniel Jurgens	  If enabled, a security module can use these hooks to
116d291f1a6SDaniel Jurgens	  implement Infiniband access controls.
117d291f1a6SDaniel Jurgens	  If you are unsure how to answer this question, answer N.
118d291f1a6SDaniel Jurgens
119df71837dSTrent Jaegerconfig SECURITY_NETWORK_XFRM
120df71837dSTrent Jaeger	bool "XFRM (IPSec) Networking Security Hooks"
121df71837dSTrent Jaeger	depends on XFRM && SECURITY_NETWORK
122df71837dSTrent Jaeger	help
123df71837dSTrent Jaeger	  This enables the XFRM (IPSec) networking security hooks.
124df71837dSTrent Jaeger	  If enabled, a security module can use these hooks to
125df71837dSTrent Jaeger	  implement per-packet access controls based on labels
126df71837dSTrent Jaeger	  derived from IPSec policy.  Non-IPSec communications are
127df71837dSTrent Jaeger	  designated as unlabelled, and only sockets authorized
128df71837dSTrent Jaeger	  to communicate unlabelled data can send without using
129df71837dSTrent Jaeger	  IPSec.
130df71837dSTrent Jaeger	  If you are unsure how to answer this question, answer N.
131df71837dSTrent Jaeger
132be6d3e56SKentaro Takedaconfig SECURITY_PATH
133be6d3e56SKentaro Takeda	bool "Security hooks for pathname based access control"
134be6d3e56SKentaro Takeda	depends on SECURITY
135be6d3e56SKentaro Takeda	help
136be6d3e56SKentaro Takeda	  This enables the security hooks for pathname based access control.
137be6d3e56SKentaro Takeda	  If enabled, a security module can use these hooks to
138be6d3e56SKentaro Takeda	  implement pathname based access controls.
139be6d3e56SKentaro Takeda	  If you are unsure how to answer this question, answer N.
140be6d3e56SKentaro Takeda
14131625340SJoseph Cihulaconfig INTEL_TXT
14231625340SJoseph Cihula	bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)"
14369575d38SShane Wang	depends on HAVE_INTEL_TXT
14431625340SJoseph Cihula	help
14531625340SJoseph Cihula	  This option enables support for booting the kernel with the
14631625340SJoseph Cihula	  Trusted Boot (tboot) module. This will utilize
14731625340SJoseph Cihula	  Intel(R) Trusted Execution Technology to perform a measured launch
14831625340SJoseph Cihula	  of the kernel. If the system does not support Intel(R) TXT, this
14931625340SJoseph Cihula	  will have no effect.
15031625340SJoseph Cihula
1513c556e41SArnaldo Carvalho de Melo	  Intel TXT will provide higher assurance of system configuration and
15231625340SJoseph Cihula	  initial state as well as data reset protection.  This is used to
15331625340SJoseph Cihula	  create a robust initial kernel measurement and verification, which
15431625340SJoseph Cihula	  helps to ensure that kernel security mechanisms are functioning
15531625340SJoseph Cihula	  correctly. This level of protection requires a root of trust outside
15631625340SJoseph Cihula	  of the kernel itself.
15731625340SJoseph Cihula
15831625340SJoseph Cihula	  Intel TXT also helps solve real end user concerns about having
15931625340SJoseph Cihula	  confidence that their hardware is running the VMM or kernel that
1603c556e41SArnaldo Carvalho de Melo	  it was configured with, especially since they may be responsible for
16131625340SJoseph Cihula	  providing such assurances to VMs and services running on it.
16231625340SJoseph Cihula
163c9fecf50SAlexander A. Klimov	  See <https://www.intel.com/technology/security/> for more information
16431625340SJoseph Cihula	  about Intel(R) TXT.
16531625340SJoseph Cihula	  See <http://tboot.sourceforge.net> for more information about tboot.
166ff61f079SJonathan Corbet	  See Documentation/arch/x86/intel_txt.rst for a description of how to enable
16731625340SJoseph Cihula	  Intel TXT support in a kernel boot.
16831625340SJoseph Cihula
16931625340SJoseph Cihula	  If you are unsure as to whether this is required, answer N.
17031625340SJoseph Cihula
171788084abSEric Parisconfig LSM_MMAP_MIN_ADDR
172024e6cb4SAndreas Schwab	int "Low address space for LSM to protect from user allocation"
173788084abSEric Paris	depends on SECURITY && SECURITY_SELINUX
174530b099dSColin Cross	default 32768 if ARM || (ARM64 && COMPAT)
175a58578e4SDave Jones	default 65536
176788084abSEric Paris	help
177788084abSEric Paris	  This is the portion of low virtual memory which should be protected
178788084abSEric Paris	  from userspace allocation.  Keeping a user from writing to low pages
179788084abSEric Paris	  can help reduce the impact of kernel NULL pointer bugs.
180788084abSEric Paris
181788084abSEric Paris	  For most ia64, ppc64 and x86 users with lots of address space
182788084abSEric Paris	  a value of 65536 is reasonable and should cause no problems.
183788084abSEric Paris	  On arm and other archs it should not be higher than 32768.
184788084abSEric Paris	  Programs which use vm86 functionality or have some need to map
185788084abSEric Paris	  this low address space will need the permission specific to the
186788084abSEric Paris	  systems running LSM.
187788084abSEric Paris
18864e90a8aSGreg Kroah-Hartmanconfig STATIC_USERMODEHELPER
18964e90a8aSGreg Kroah-Hartman	bool "Force all usermode helper calls through a single binary"
19064e90a8aSGreg Kroah-Hartman	help
19164e90a8aSGreg Kroah-Hartman	  By default, the kernel can call many different userspace
19264e90a8aSGreg Kroah-Hartman	  binary programs through the "usermode helper" kernel
19364e90a8aSGreg Kroah-Hartman	  interface.  Some of these binaries are statically defined
19464e90a8aSGreg Kroah-Hartman	  either in the kernel code itself, or as a kernel configuration
19564e90a8aSGreg Kroah-Hartman	  option.  However, some of these are dynamically created at
19664e90a8aSGreg Kroah-Hartman	  runtime, or can be modified after the kernel has started up.
19764e90a8aSGreg Kroah-Hartman	  To provide an additional layer of security, route all of these
19864e90a8aSGreg Kroah-Hartman	  calls through a single executable that can not have its name
19964e90a8aSGreg Kroah-Hartman	  changed.
20064e90a8aSGreg Kroah-Hartman
20164e90a8aSGreg Kroah-Hartman	  Note, it is up to this single binary to then call the relevant
20264e90a8aSGreg Kroah-Hartman	  "real" usermode helper binary, based on the first argument
20364e90a8aSGreg Kroah-Hartman	  passed to it.  If desired, this program can filter and pick
20464e90a8aSGreg Kroah-Hartman	  and choose what real programs are called.
20564e90a8aSGreg Kroah-Hartman
20664e90a8aSGreg Kroah-Hartman	  If you wish for all usermode helper programs are to be
20764e90a8aSGreg Kroah-Hartman	  disabled, choose this option and then set
20864e90a8aSGreg Kroah-Hartman	  STATIC_USERMODEHELPER_PATH to an empty string.
20964e90a8aSGreg Kroah-Hartman
21064e90a8aSGreg Kroah-Hartmanconfig STATIC_USERMODEHELPER_PATH
21164e90a8aSGreg Kroah-Hartman	string "Path to the static usermode helper binary"
21264e90a8aSGreg Kroah-Hartman	depends on STATIC_USERMODEHELPER
21364e90a8aSGreg Kroah-Hartman	default "/sbin/usermode-helper"
21464e90a8aSGreg Kroah-Hartman	help
21564e90a8aSGreg Kroah-Hartman	  The binary called by the kernel when any usermode helper
21664e90a8aSGreg Kroah-Hartman	  program is wish to be run.  The "real" application's name will
21764e90a8aSGreg Kroah-Hartman	  be in the first argument passed to this program on the command
21864e90a8aSGreg Kroah-Hartman	  line.
21964e90a8aSGreg Kroah-Hartman
22064e90a8aSGreg Kroah-Hartman	  If you wish for all usermode helper programs to be disabled,
22164e90a8aSGreg Kroah-Hartman	  specify an empty string here (i.e. "").
22264e90a8aSGreg Kroah-Hartman
2238636a1f9SMasahiro Yamadasource "security/selinux/Kconfig"
2248636a1f9SMasahiro Yamadasource "security/smack/Kconfig"
2258636a1f9SMasahiro Yamadasource "security/tomoyo/Kconfig"
2268636a1f9SMasahiro Yamadasource "security/apparmor/Kconfig"
2278636a1f9SMasahiro Yamadasource "security/loadpin/Kconfig"
2288636a1f9SMasahiro Yamadasource "security/yama/Kconfig"
229aeca4e2cSMicah Mortonsource "security/safesetid/Kconfig"
230000d388eSMatthew Garrettsource "security/lockdown/Kconfig"
23190945448SMickaël Salaünsource "security/landlock/Kconfig"
23203115077SDeven Bowerssource "security/ipe/Kconfig"
2331da177e4SLinus Torvalds
2348636a1f9SMasahiro Yamadasource "security/integrity/Kconfig"
2353323eec9SMimi Zohar
2362623c4fbSKees Cookchoice
2372623c4fbSKees Cook	prompt "First legacy 'major LSM' to be initialized"
2382623c4fbSKees Cook	default DEFAULT_SECURITY_SELINUX if SECURITY_SELINUX
2392623c4fbSKees Cook	default DEFAULT_SECURITY_SMACK if SECURITY_SMACK
2402623c4fbSKees Cook	default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO
2412623c4fbSKees Cook	default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR
2422623c4fbSKees Cook	default DEFAULT_SECURITY_DAC
2432623c4fbSKees Cook
2442623c4fbSKees Cook	help
2452623c4fbSKees Cook	  This choice is there only for converting CONFIG_DEFAULT_SECURITY
2462623c4fbSKees Cook	  in old kernel configs to CONFIG_LSM in new kernel configs. Don't
2472623c4fbSKees Cook	  change this choice unless you are creating a fresh kernel config,
2482623c4fbSKees Cook	  for this choice will be ignored after CONFIG_LSM has been set.
2492623c4fbSKees Cook
2502623c4fbSKees Cook	  Selects the legacy "major security module" that will be
2512623c4fbSKees Cook	  initialized first. Overridden by non-default CONFIG_LSM.
2522623c4fbSKees Cook
2532623c4fbSKees Cook	config DEFAULT_SECURITY_SELINUX
2542623c4fbSKees Cook		bool "SELinux" if SECURITY_SELINUX=y
2552623c4fbSKees Cook
2562623c4fbSKees Cook	config DEFAULT_SECURITY_SMACK
2572623c4fbSKees Cook		bool "Simplified Mandatory Access Control" if SECURITY_SMACK=y
2582623c4fbSKees Cook
2592623c4fbSKees Cook	config DEFAULT_SECURITY_TOMOYO
2602623c4fbSKees Cook		bool "TOMOYO" if SECURITY_TOMOYO=y
2612623c4fbSKees Cook
2622623c4fbSKees Cook	config DEFAULT_SECURITY_APPARMOR
2632623c4fbSKees Cook		bool "AppArmor" if SECURITY_APPARMOR=y
2642623c4fbSKees Cook
2652623c4fbSKees Cook	config DEFAULT_SECURITY_DAC
2662623c4fbSKees Cook		bool "Unix Discretionary Access Controls"
2672623c4fbSKees Cook
2682623c4fbSKees Cookendchoice
2692623c4fbSKees Cook
27013e735c0SKees Cookconfig LSM
27113e735c0SKees Cook	string "Ordered list of enabled LSMs"
27203115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,smack,selinux,tomoyo,apparmor,ipe,bpf" if DEFAULT_SECURITY_SMACK
27303115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,apparmor,selinux,smack,tomoyo,ipe,bpf" if DEFAULT_SECURITY_APPARMOR
27403115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,tomoyo,ipe,bpf" if DEFAULT_SECURITY_TOMOYO
27503115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,ipe,bpf" if DEFAULT_SECURITY_DAC
27603115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,ipe,bpf"
27713e735c0SKees Cook	help
27813e735c0SKees Cook	  A comma-separated list of LSMs, in initialization order.
279b9b8701bSRoberto Sassu	  Any LSMs left off this list, except for those with order
280b9b8701bSRoberto Sassu	  LSM_ORDER_FIRST and LSM_ORDER_LAST, which are always enabled
281b9b8701bSRoberto Sassu	  if selected in the kernel configuration, will be ignored.
282b9b8701bSRoberto Sassu	  This can be controlled at boot with the "lsm=" parameter.
28313e735c0SKees Cook
28413e735c0SKees Cook	  If unsure, leave this as the default.
28513e735c0SKees Cook
2869f671e58SKees Cooksource "security/Kconfig.hardening"
2879f671e58SKees Cook
2881da177e4SLinus Torvaldsendmenu
2891da177e4SLinus Torvalds
290