xref: /linux/security/Kconfig (revision 599bbba5a36f6de57ab14c373c25881e2b5273f5)
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"
24*599bbba5SLinus Torvalds	default PROC_MEM_FORCE_PTRACE
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
31*599bbba5SLinus Torvalds	  require actual active ptrace attachment (default).
3241e8149cSAdrian Ratiu
3341e8149cSAdrian Ratiuconfig PROC_MEM_ALWAYS_FORCE
3441e8149cSAdrian Ratiu	bool "Traditional /proc/pid/mem behavior"
3541e8149cSAdrian Ratiu	help
3641e8149cSAdrian Ratiu	  This allows /proc/pid/mem accesses to override memory mapping
3741e8149cSAdrian Ratiu	  permissions if you have ptrace access rights.
3841e8149cSAdrian Ratiu
3941e8149cSAdrian Ratiuconfig PROC_MEM_FORCE_PTRACE
4041e8149cSAdrian Ratiu	bool "Require active ptrace() use for access override"
4141e8149cSAdrian Ratiu	help
4241e8149cSAdrian Ratiu	  This allows /proc/pid/mem accesses to override memory mapping
4341e8149cSAdrian Ratiu	  permissions for active ptracers like gdb.
4441e8149cSAdrian Ratiu
4541e8149cSAdrian Ratiuconfig PROC_MEM_NO_FORCE
4641e8149cSAdrian Ratiu	bool "Never"
4741e8149cSAdrian Ratiu	help
4841e8149cSAdrian Ratiu	  Never override memory mapping permissions
4941e8149cSAdrian Ratiu
5041e8149cSAdrian Ratiuendchoice
5141e8149cSAdrian Ratiu
525796d396SJeff Xuconfig MSEAL_SYSTEM_MAPPINGS
535796d396SJeff Xu	bool "mseal system mappings"
545796d396SJeff Xu	depends on 64BIT
555796d396SJeff Xu	depends on ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
565796d396SJeff Xu	depends on !CHECKPOINT_RESTORE
575796d396SJeff Xu	help
585796d396SJeff Xu	  Apply mseal on system mappings.
595796d396SJeff Xu	  The system mappings includes vdso, vvar, vvar_vclock,
605796d396SJeff Xu	  vectors (arm compat-mode), sigpage (arm compat-mode), uprobes.
615796d396SJeff Xu
625796d396SJeff Xu	  A 64-bit kernel is required for the memory sealing feature.
635796d396SJeff Xu	  No specific hardware features from the CPU are needed.
645796d396SJeff Xu
655796d396SJeff Xu	  WARNING: This feature breaks programs which rely on relocating
665796d396SJeff Xu	  or unmapping system mappings. Known broken software at the time
675796d396SJeff Xu	  of writing includes CHECKPOINT_RESTORE, UML, gVisor, rr. Therefore
685796d396SJeff Xu	  this config can't be enabled universally.
695796d396SJeff Xu
705796d396SJeff Xu	  For complete descriptions of memory sealing, please see
715796d396SJeff Xu	  Documentation/userspace-api/mseal.rst
725796d396SJeff Xu
731da177e4SLinus Torvaldsconfig SECURITY
741da177e4SLinus Torvalds	bool "Enable different security models"
752c40579bSAdrian Bunk	depends on SYSFS
762813893fSIulia Manda	depends on MULTIUSER
771da177e4SLinus Torvalds	help
781da177e4SLinus Torvalds	  This allows you to choose different security modules to be
791da177e4SLinus Torvalds	  configured into your kernel.
801da177e4SLinus Torvalds
811da177e4SLinus Torvalds	  If this option is not selected, the default Linux security
821da177e4SLinus Torvalds	  model will be used.
831da177e4SLinus Torvalds
841da177e4SLinus Torvalds	  If you are unsure how to answer this question, answer N.
851da177e4SLinus Torvalds
867ccbe076SMickaël Salaünconfig HAS_SECURITY_AUDIT
877ccbe076SMickaël Salaün	def_bool y
887ccbe076SMickaël Salaün	depends on AUDIT
897ccbe076SMickaël Salaün	depends on SECURITY
907ccbe076SMickaël Salaün
91da31894eSEric Parisconfig SECURITYFS
92da31894eSEric Paris	bool "Enable the securityfs filesystem"
93da31894eSEric Paris	help
94da31894eSEric Paris	  This will build the securityfs filesystem.  It is currently used by
95b102c11eSPetr Vorel	  various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
96da31894eSEric Paris
97da31894eSEric Paris	  If you are unsure how to answer this question, answer N.
98da31894eSEric Paris
991da177e4SLinus Torvaldsconfig SECURITY_NETWORK
1001da177e4SLinus Torvalds	bool "Socket and Networking Security Hooks"
1011da177e4SLinus Torvalds	depends on SECURITY
1021da177e4SLinus Torvalds	help
1031da177e4SLinus Torvalds	  This enables the socket and networking security hooks.
1041da177e4SLinus Torvalds	  If enabled, a security module can use these hooks to
1051da177e4SLinus Torvalds	  implement socket and networking access controls.
1061da177e4SLinus Torvalds	  If you are unsure how to answer this question, answer N.
1071da177e4SLinus Torvalds
108d291f1a6SDaniel Jurgensconfig SECURITY_INFINIBAND
109d291f1a6SDaniel Jurgens	bool "Infiniband Security Hooks"
110d291f1a6SDaniel Jurgens	depends on SECURITY && INFINIBAND
111d291f1a6SDaniel Jurgens	help
112d291f1a6SDaniel Jurgens	  This enables the Infiniband security hooks.
113d291f1a6SDaniel Jurgens	  If enabled, a security module can use these hooks to
114d291f1a6SDaniel Jurgens	  implement Infiniband access controls.
115d291f1a6SDaniel Jurgens	  If you are unsure how to answer this question, answer N.
116d291f1a6SDaniel Jurgens
117df71837dSTrent Jaegerconfig SECURITY_NETWORK_XFRM
118df71837dSTrent Jaeger	bool "XFRM (IPSec) Networking Security Hooks"
119df71837dSTrent Jaeger	depends on XFRM && SECURITY_NETWORK
120df71837dSTrent Jaeger	help
121df71837dSTrent Jaeger	  This enables the XFRM (IPSec) networking security hooks.
122df71837dSTrent Jaeger	  If enabled, a security module can use these hooks to
123df71837dSTrent Jaeger	  implement per-packet access controls based on labels
124df71837dSTrent Jaeger	  derived from IPSec policy.  Non-IPSec communications are
125df71837dSTrent Jaeger	  designated as unlabelled, and only sockets authorized
126df71837dSTrent Jaeger	  to communicate unlabelled data can send without using
127df71837dSTrent Jaeger	  IPSec.
128df71837dSTrent Jaeger	  If you are unsure how to answer this question, answer N.
129df71837dSTrent Jaeger
130be6d3e56SKentaro Takedaconfig SECURITY_PATH
131be6d3e56SKentaro Takeda	bool "Security hooks for pathname based access control"
132be6d3e56SKentaro Takeda	depends on SECURITY
133be6d3e56SKentaro Takeda	help
134be6d3e56SKentaro Takeda	  This enables the security hooks for pathname based access control.
135be6d3e56SKentaro Takeda	  If enabled, a security module can use these hooks to
136be6d3e56SKentaro Takeda	  implement pathname based access controls.
137be6d3e56SKentaro Takeda	  If you are unsure how to answer this question, answer N.
138be6d3e56SKentaro Takeda
13931625340SJoseph Cihulaconfig INTEL_TXT
14031625340SJoseph Cihula	bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)"
14169575d38SShane Wang	depends on HAVE_INTEL_TXT
14231625340SJoseph Cihula	help
14331625340SJoseph Cihula	  This option enables support for booting the kernel with the
14431625340SJoseph Cihula	  Trusted Boot (tboot) module. This will utilize
14531625340SJoseph Cihula	  Intel(R) Trusted Execution Technology to perform a measured launch
14631625340SJoseph Cihula	  of the kernel. If the system does not support Intel(R) TXT, this
14731625340SJoseph Cihula	  will have no effect.
14831625340SJoseph Cihula
1493c556e41SArnaldo Carvalho de Melo	  Intel TXT will provide higher assurance of system configuration and
15031625340SJoseph Cihula	  initial state as well as data reset protection.  This is used to
15131625340SJoseph Cihula	  create a robust initial kernel measurement and verification, which
15231625340SJoseph Cihula	  helps to ensure that kernel security mechanisms are functioning
15331625340SJoseph Cihula	  correctly. This level of protection requires a root of trust outside
15431625340SJoseph Cihula	  of the kernel itself.
15531625340SJoseph Cihula
15631625340SJoseph Cihula	  Intel TXT also helps solve real end user concerns about having
15731625340SJoseph Cihula	  confidence that their hardware is running the VMM or kernel that
1583c556e41SArnaldo Carvalho de Melo	  it was configured with, especially since they may be responsible for
15931625340SJoseph Cihula	  providing such assurances to VMs and services running on it.
16031625340SJoseph Cihula
161c9fecf50SAlexander A. Klimov	  See <https://www.intel.com/technology/security/> for more information
16231625340SJoseph Cihula	  about Intel(R) TXT.
16331625340SJoseph Cihula	  See <http://tboot.sourceforge.net> for more information about tboot.
164ff61f079SJonathan Corbet	  See Documentation/arch/x86/intel_txt.rst for a description of how to enable
16531625340SJoseph Cihula	  Intel TXT support in a kernel boot.
16631625340SJoseph Cihula
16731625340SJoseph Cihula	  If you are unsure as to whether this is required, answer N.
16831625340SJoseph Cihula
169788084abSEric Parisconfig LSM_MMAP_MIN_ADDR
170024e6cb4SAndreas Schwab	int "Low address space for LSM to protect from user allocation"
171788084abSEric Paris	depends on SECURITY && SECURITY_SELINUX
172530b099dSColin Cross	default 32768 if ARM || (ARM64 && COMPAT)
173a58578e4SDave Jones	default 65536
174788084abSEric Paris	help
175788084abSEric Paris	  This is the portion of low virtual memory which should be protected
176788084abSEric Paris	  from userspace allocation.  Keeping a user from writing to low pages
177788084abSEric Paris	  can help reduce the impact of kernel NULL pointer bugs.
178788084abSEric Paris
179788084abSEric Paris	  For most ia64, ppc64 and x86 users with lots of address space
180788084abSEric Paris	  a value of 65536 is reasonable and should cause no problems.
181788084abSEric Paris	  On arm and other archs it should not be higher than 32768.
182788084abSEric Paris	  Programs which use vm86 functionality or have some need to map
183788084abSEric Paris	  this low address space will need the permission specific to the
184788084abSEric Paris	  systems running LSM.
185788084abSEric Paris
18664e90a8aSGreg Kroah-Hartmanconfig STATIC_USERMODEHELPER
18764e90a8aSGreg Kroah-Hartman	bool "Force all usermode helper calls through a single binary"
18864e90a8aSGreg Kroah-Hartman	help
18964e90a8aSGreg Kroah-Hartman	  By default, the kernel can call many different userspace
19064e90a8aSGreg Kroah-Hartman	  binary programs through the "usermode helper" kernel
19164e90a8aSGreg Kroah-Hartman	  interface.  Some of these binaries are statically defined
19264e90a8aSGreg Kroah-Hartman	  either in the kernel code itself, or as a kernel configuration
19364e90a8aSGreg Kroah-Hartman	  option.  However, some of these are dynamically created at
19464e90a8aSGreg Kroah-Hartman	  runtime, or can be modified after the kernel has started up.
19564e90a8aSGreg Kroah-Hartman	  To provide an additional layer of security, route all of these
19664e90a8aSGreg Kroah-Hartman	  calls through a single executable that can not have its name
19764e90a8aSGreg Kroah-Hartman	  changed.
19864e90a8aSGreg Kroah-Hartman
19964e90a8aSGreg Kroah-Hartman	  Note, it is up to this single binary to then call the relevant
20064e90a8aSGreg Kroah-Hartman	  "real" usermode helper binary, based on the first argument
20164e90a8aSGreg Kroah-Hartman	  passed to it.  If desired, this program can filter and pick
20264e90a8aSGreg Kroah-Hartman	  and choose what real programs are called.
20364e90a8aSGreg Kroah-Hartman
20464e90a8aSGreg Kroah-Hartman	  If you wish for all usermode helper programs are to be
20564e90a8aSGreg Kroah-Hartman	  disabled, choose this option and then set
20664e90a8aSGreg Kroah-Hartman	  STATIC_USERMODEHELPER_PATH to an empty string.
20764e90a8aSGreg Kroah-Hartman
20864e90a8aSGreg Kroah-Hartmanconfig STATIC_USERMODEHELPER_PATH
20964e90a8aSGreg Kroah-Hartman	string "Path to the static usermode helper binary"
21064e90a8aSGreg Kroah-Hartman	depends on STATIC_USERMODEHELPER
21164e90a8aSGreg Kroah-Hartman	default "/sbin/usermode-helper"
21264e90a8aSGreg Kroah-Hartman	help
21364e90a8aSGreg Kroah-Hartman	  The binary called by the kernel when any usermode helper
21464e90a8aSGreg Kroah-Hartman	  program is wish to be run.  The "real" application's name will
21564e90a8aSGreg Kroah-Hartman	  be in the first argument passed to this program on the command
21664e90a8aSGreg Kroah-Hartman	  line.
21764e90a8aSGreg Kroah-Hartman
21864e90a8aSGreg Kroah-Hartman	  If you wish for all usermode helper programs to be disabled,
21964e90a8aSGreg Kroah-Hartman	  specify an empty string here (i.e. "").
22064e90a8aSGreg Kroah-Hartman
2218636a1f9SMasahiro Yamadasource "security/selinux/Kconfig"
2228636a1f9SMasahiro Yamadasource "security/smack/Kconfig"
2238636a1f9SMasahiro Yamadasource "security/tomoyo/Kconfig"
2248636a1f9SMasahiro Yamadasource "security/apparmor/Kconfig"
2258636a1f9SMasahiro Yamadasource "security/loadpin/Kconfig"
2268636a1f9SMasahiro Yamadasource "security/yama/Kconfig"
227aeca4e2cSMicah Mortonsource "security/safesetid/Kconfig"
228000d388eSMatthew Garrettsource "security/lockdown/Kconfig"
22990945448SMickaël Salaünsource "security/landlock/Kconfig"
23003115077SDeven Bowerssource "security/ipe/Kconfig"
2311da177e4SLinus Torvalds
2328636a1f9SMasahiro Yamadasource "security/integrity/Kconfig"
2333323eec9SMimi Zohar
2342623c4fbSKees Cookchoice
2352623c4fbSKees Cook	prompt "First legacy 'major LSM' to be initialized"
2362623c4fbSKees Cook	default DEFAULT_SECURITY_SELINUX if SECURITY_SELINUX
2372623c4fbSKees Cook	default DEFAULT_SECURITY_SMACK if SECURITY_SMACK
2382623c4fbSKees Cook	default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO
2392623c4fbSKees Cook	default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR
2402623c4fbSKees Cook	default DEFAULT_SECURITY_DAC
2412623c4fbSKees Cook
2422623c4fbSKees Cook	help
2432623c4fbSKees Cook	  This choice is there only for converting CONFIG_DEFAULT_SECURITY
2442623c4fbSKees Cook	  in old kernel configs to CONFIG_LSM in new kernel configs. Don't
2452623c4fbSKees Cook	  change this choice unless you are creating a fresh kernel config,
2462623c4fbSKees Cook	  for this choice will be ignored after CONFIG_LSM has been set.
2472623c4fbSKees Cook
2482623c4fbSKees Cook	  Selects the legacy "major security module" that will be
2492623c4fbSKees Cook	  initialized first. Overridden by non-default CONFIG_LSM.
2502623c4fbSKees Cook
2512623c4fbSKees Cook	config DEFAULT_SECURITY_SELINUX
2522623c4fbSKees Cook		bool "SELinux" if SECURITY_SELINUX=y
2532623c4fbSKees Cook
2542623c4fbSKees Cook	config DEFAULT_SECURITY_SMACK
2552623c4fbSKees Cook		bool "Simplified Mandatory Access Control" if SECURITY_SMACK=y
2562623c4fbSKees Cook
2572623c4fbSKees Cook	config DEFAULT_SECURITY_TOMOYO
2582623c4fbSKees Cook		bool "TOMOYO" if SECURITY_TOMOYO=y
2592623c4fbSKees Cook
2602623c4fbSKees Cook	config DEFAULT_SECURITY_APPARMOR
2612623c4fbSKees Cook		bool "AppArmor" if SECURITY_APPARMOR=y
2622623c4fbSKees Cook
2632623c4fbSKees Cook	config DEFAULT_SECURITY_DAC
2642623c4fbSKees Cook		bool "Unix Discretionary Access Controls"
2652623c4fbSKees Cook
2662623c4fbSKees Cookendchoice
2672623c4fbSKees Cook
26813e735c0SKees Cookconfig LSM
26913e735c0SKees Cook	string "Ordered list of enabled LSMs"
27054d94c42SRandy Dunlap	depends on SECURITY
27103115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,smack,selinux,tomoyo,apparmor,ipe,bpf" if DEFAULT_SECURITY_SMACK
27203115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,apparmor,selinux,smack,tomoyo,ipe,bpf" if DEFAULT_SECURITY_APPARMOR
27303115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,tomoyo,ipe,bpf" if DEFAULT_SECURITY_TOMOYO
27403115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,ipe,bpf" if DEFAULT_SECURITY_DAC
27503115077SDeven Bowers	default "landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,ipe,bpf"
27613e735c0SKees Cook	help
27713e735c0SKees Cook	  A comma-separated list of LSMs, in initialization order.
278b9b8701bSRoberto Sassu	  Any LSMs left off this list, except for those with order
279b9b8701bSRoberto Sassu	  LSM_ORDER_FIRST and LSM_ORDER_LAST, which are always enabled
280b9b8701bSRoberto Sassu	  if selected in the kernel configuration, will be ignored.
281b9b8701bSRoberto Sassu	  This can be controlled at boot with the "lsm=" parameter.
28213e735c0SKees Cook
28313e735c0SKees Cook	  If unsure, leave this as the default.
28413e735c0SKees Cook
28524e9b431SRyan Fosterconfig SECURITY_COMMONCAP_KUNIT_TEST
28624e9b431SRyan Foster	bool "Build KUnit tests for commoncap" if !KUNIT_ALL_TESTS
28724e9b431SRyan Foster	depends on KUNIT=y && USER_NS
28824e9b431SRyan Foster	default KUNIT_ALL_TESTS
28924e9b431SRyan Foster	help
29024e9b431SRyan Foster	  This builds the commoncap KUnit tests.
29124e9b431SRyan Foster
29224e9b431SRyan Foster	  KUnit tests run during boot and output the results to the debug log
29324e9b431SRyan Foster	  in TAP format (https://testanything.org/). Only useful for kernel devs
29424e9b431SRyan Foster	  running KUnit test harness and are not for inclusion into a
29524e9b431SRyan Foster	  production build.
29624e9b431SRyan Foster
29724e9b431SRyan Foster	  For more information on KUnit and unit tests in general please refer
29824e9b431SRyan Foster	  to the KUnit documentation in Documentation/dev-tools/kunit/.
29924e9b431SRyan Foster
30024e9b431SRyan Foster	  If unsure, say N.
30124e9b431SRyan Foster
3029f671e58SKees Cooksource "security/Kconfig.hardening"
3039f671e58SKees Cook
3041da177e4SLinus Torvaldsendmenu
3051da177e4SLinus Torvalds
306