162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci# 362306a36Sopenharmony_ci# Security configuration 462306a36Sopenharmony_ci# 562306a36Sopenharmony_ci 662306a36Sopenharmony_cimenu "Security options" 762306a36Sopenharmony_ci 862306a36Sopenharmony_cisource "security/keys/Kconfig" 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciconfig SECURITY_DMESG_RESTRICT 1162306a36Sopenharmony_ci bool "Restrict unprivileged access to the kernel syslog" 1262306a36Sopenharmony_ci default n 1362306a36Sopenharmony_ci help 1462306a36Sopenharmony_ci This enforces restrictions on unprivileged users reading the kernel 1562306a36Sopenharmony_ci syslog via dmesg(8). 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci If this option is not selected, no restrictions will be enforced 1862306a36Sopenharmony_ci unless the dmesg_restrict sysctl is explicitly set to (1). 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci If you are unsure how to answer this question, answer N. 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciconfig SECURITY 2362306a36Sopenharmony_ci bool "Enable different security models" 2462306a36Sopenharmony_ci depends on SYSFS 2562306a36Sopenharmony_ci depends on MULTIUSER 2662306a36Sopenharmony_ci help 2762306a36Sopenharmony_ci This allows you to choose different security modules to be 2862306a36Sopenharmony_ci configured into your kernel. 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci If this option is not selected, the default Linux security 3162306a36Sopenharmony_ci model will be used. 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci If you are unsure how to answer this question, answer N. 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciconfig SECURITYFS 3662306a36Sopenharmony_ci bool "Enable the securityfs filesystem" 3762306a36Sopenharmony_ci help 3862306a36Sopenharmony_ci This will build the securityfs filesystem. It is currently used by 3962306a36Sopenharmony_ci various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM). 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci If you are unsure how to answer this question, answer N. 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ciconfig SECURITY_NETWORK 4462306a36Sopenharmony_ci bool "Socket and Networking Security Hooks" 4562306a36Sopenharmony_ci depends on SECURITY 4662306a36Sopenharmony_ci help 4762306a36Sopenharmony_ci This enables the socket and networking security hooks. 4862306a36Sopenharmony_ci If enabled, a security module can use these hooks to 4962306a36Sopenharmony_ci implement socket and networking access controls. 5062306a36Sopenharmony_ci If you are unsure how to answer this question, answer N. 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ciconfig SECURITY_INFINIBAND 5362306a36Sopenharmony_ci bool "Infiniband Security Hooks" 5462306a36Sopenharmony_ci depends on SECURITY && INFINIBAND 5562306a36Sopenharmony_ci help 5662306a36Sopenharmony_ci This enables the Infiniband security hooks. 5762306a36Sopenharmony_ci If enabled, a security module can use these hooks to 5862306a36Sopenharmony_ci implement Infiniband access controls. 5962306a36Sopenharmony_ci If you are unsure how to answer this question, answer N. 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciconfig SECURITY_NETWORK_XFRM 6262306a36Sopenharmony_ci bool "XFRM (IPSec) Networking Security Hooks" 6362306a36Sopenharmony_ci depends on XFRM && SECURITY_NETWORK 6462306a36Sopenharmony_ci help 6562306a36Sopenharmony_ci This enables the XFRM (IPSec) networking security hooks. 6662306a36Sopenharmony_ci If enabled, a security module can use these hooks to 6762306a36Sopenharmony_ci implement per-packet access controls based on labels 6862306a36Sopenharmony_ci derived from IPSec policy. Non-IPSec communications are 6962306a36Sopenharmony_ci designated as unlabelled, and only sockets authorized 7062306a36Sopenharmony_ci to communicate unlabelled data can send without using 7162306a36Sopenharmony_ci IPSec. 7262306a36Sopenharmony_ci If you are unsure how to answer this question, answer N. 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ciconfig SECURITY_PATH 7562306a36Sopenharmony_ci bool "Security hooks for pathname based access control" 7662306a36Sopenharmony_ci depends on SECURITY 7762306a36Sopenharmony_ci help 7862306a36Sopenharmony_ci This enables the security hooks for pathname based access control. 7962306a36Sopenharmony_ci If enabled, a security module can use these hooks to 8062306a36Sopenharmony_ci implement pathname based access controls. 8162306a36Sopenharmony_ci If you are unsure how to answer this question, answer N. 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ciconfig INTEL_TXT 8462306a36Sopenharmony_ci bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)" 8562306a36Sopenharmony_ci depends on HAVE_INTEL_TXT 8662306a36Sopenharmony_ci help 8762306a36Sopenharmony_ci This option enables support for booting the kernel with the 8862306a36Sopenharmony_ci Trusted Boot (tboot) module. This will utilize 8962306a36Sopenharmony_ci Intel(R) Trusted Execution Technology to perform a measured launch 9062306a36Sopenharmony_ci of the kernel. If the system does not support Intel(R) TXT, this 9162306a36Sopenharmony_ci will have no effect. 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci Intel TXT will provide higher assurance of system configuration and 9462306a36Sopenharmony_ci initial state as well as data reset protection. This is used to 9562306a36Sopenharmony_ci create a robust initial kernel measurement and verification, which 9662306a36Sopenharmony_ci helps to ensure that kernel security mechanisms are functioning 9762306a36Sopenharmony_ci correctly. This level of protection requires a root of trust outside 9862306a36Sopenharmony_ci of the kernel itself. 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci Intel TXT also helps solve real end user concerns about having 10162306a36Sopenharmony_ci confidence that their hardware is running the VMM or kernel that 10262306a36Sopenharmony_ci it was configured with, especially since they may be responsible for 10362306a36Sopenharmony_ci providing such assurances to VMs and services running on it. 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci See <https://www.intel.com/technology/security/> for more information 10662306a36Sopenharmony_ci about Intel(R) TXT. 10762306a36Sopenharmony_ci See <http://tboot.sourceforge.net> for more information about tboot. 10862306a36Sopenharmony_ci See Documentation/arch/x86/intel_txt.rst for a description of how to enable 10962306a36Sopenharmony_ci Intel TXT support in a kernel boot. 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci If you are unsure as to whether this is required, answer N. 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ciconfig LSM_MMAP_MIN_ADDR 11462306a36Sopenharmony_ci int "Low address space for LSM to protect from user allocation" 11562306a36Sopenharmony_ci depends on SECURITY && SECURITY_SELINUX 11662306a36Sopenharmony_ci default 32768 if ARM || (ARM64 && COMPAT) 11762306a36Sopenharmony_ci default 65536 11862306a36Sopenharmony_ci help 11962306a36Sopenharmony_ci This is the portion of low virtual memory which should be protected 12062306a36Sopenharmony_ci from userspace allocation. Keeping a user from writing to low pages 12162306a36Sopenharmony_ci can help reduce the impact of kernel NULL pointer bugs. 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci For most ia64, ppc64 and x86 users with lots of address space 12462306a36Sopenharmony_ci a value of 65536 is reasonable and should cause no problems. 12562306a36Sopenharmony_ci On arm and other archs it should not be higher than 32768. 12662306a36Sopenharmony_ci Programs which use vm86 functionality or have some need to map 12762306a36Sopenharmony_ci this low address space will need the permission specific to the 12862306a36Sopenharmony_ci systems running LSM. 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ciconfig HARDENED_USERCOPY 13162306a36Sopenharmony_ci bool "Harden memory copies between kernel and userspace" 13262306a36Sopenharmony_ci imply STRICT_DEVMEM 13362306a36Sopenharmony_ci help 13462306a36Sopenharmony_ci This option checks for obviously wrong memory regions when 13562306a36Sopenharmony_ci copying memory to/from the kernel (via copy_to_user() and 13662306a36Sopenharmony_ci copy_from_user() functions) by rejecting memory ranges that 13762306a36Sopenharmony_ci are larger than the specified heap object, span multiple 13862306a36Sopenharmony_ci separately allocated pages, are not on the process stack, 13962306a36Sopenharmony_ci or are part of the kernel text. This prevents entire classes 14062306a36Sopenharmony_ci of heap overflow exploits and similar kernel memory exposures. 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ciconfig FORTIFY_SOURCE 14362306a36Sopenharmony_ci bool "Harden common str/mem functions against buffer overflows" 14462306a36Sopenharmony_ci depends on ARCH_HAS_FORTIFY_SOURCE 14562306a36Sopenharmony_ci # https://bugs.llvm.org/show_bug.cgi?id=41459 14662306a36Sopenharmony_ci depends on !CC_IS_CLANG || CLANG_VERSION >= 120001 14762306a36Sopenharmony_ci # https://github.com/llvm/llvm-project/issues/53645 14862306a36Sopenharmony_ci depends on !CC_IS_CLANG || !X86_32 14962306a36Sopenharmony_ci help 15062306a36Sopenharmony_ci Detect overflows of buffers in common string and memory functions 15162306a36Sopenharmony_ci where the compiler can determine and validate the buffer sizes. 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ciconfig STATIC_USERMODEHELPER 15462306a36Sopenharmony_ci bool "Force all usermode helper calls through a single binary" 15562306a36Sopenharmony_ci help 15662306a36Sopenharmony_ci By default, the kernel can call many different userspace 15762306a36Sopenharmony_ci binary programs through the "usermode helper" kernel 15862306a36Sopenharmony_ci interface. Some of these binaries are statically defined 15962306a36Sopenharmony_ci either in the kernel code itself, or as a kernel configuration 16062306a36Sopenharmony_ci option. However, some of these are dynamically created at 16162306a36Sopenharmony_ci runtime, or can be modified after the kernel has started up. 16262306a36Sopenharmony_ci To provide an additional layer of security, route all of these 16362306a36Sopenharmony_ci calls through a single executable that can not have its name 16462306a36Sopenharmony_ci changed. 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci Note, it is up to this single binary to then call the relevant 16762306a36Sopenharmony_ci "real" usermode helper binary, based on the first argument 16862306a36Sopenharmony_ci passed to it. If desired, this program can filter and pick 16962306a36Sopenharmony_ci and choose what real programs are called. 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci If you wish for all usermode helper programs are to be 17262306a36Sopenharmony_ci disabled, choose this option and then set 17362306a36Sopenharmony_ci STATIC_USERMODEHELPER_PATH to an empty string. 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ciconfig STATIC_USERMODEHELPER_PATH 17662306a36Sopenharmony_ci string "Path to the static usermode helper binary" 17762306a36Sopenharmony_ci depends on STATIC_USERMODEHELPER 17862306a36Sopenharmony_ci default "/sbin/usermode-helper" 17962306a36Sopenharmony_ci help 18062306a36Sopenharmony_ci The binary called by the kernel when any usermode helper 18162306a36Sopenharmony_ci program is wish to be run. The "real" application's name will 18262306a36Sopenharmony_ci be in the first argument passed to this program on the command 18362306a36Sopenharmony_ci line. 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ci If you wish for all usermode helper programs to be disabled, 18662306a36Sopenharmony_ci specify an empty string here (i.e. ""). 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_cisource "security/selinux/Kconfig" 18962306a36Sopenharmony_cisource "security/smack/Kconfig" 19062306a36Sopenharmony_cisource "security/tomoyo/Kconfig" 19162306a36Sopenharmony_cisource "security/apparmor/Kconfig" 19262306a36Sopenharmony_cisource "security/loadpin/Kconfig" 19362306a36Sopenharmony_cisource "security/yama/Kconfig" 19462306a36Sopenharmony_cisource "security/safesetid/Kconfig" 19562306a36Sopenharmony_cisource "security/lockdown/Kconfig" 19662306a36Sopenharmony_cisource "security/xpm/Kconfig" 19762306a36Sopenharmony_cisource "security/landlock/Kconfig" 19862306a36Sopenharmony_cisource "security/container_escape_detection/Kconfig" 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_cisource "security/integrity/Kconfig" 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_cichoice 20362306a36Sopenharmony_ci prompt "First legacy 'major LSM' to be initialized" 20462306a36Sopenharmony_ci default DEFAULT_SECURITY_SELINUX if SECURITY_SELINUX 20562306a36Sopenharmony_ci default DEFAULT_SECURITY_SMACK if SECURITY_SMACK 20662306a36Sopenharmony_ci default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO 20762306a36Sopenharmony_ci default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR 20862306a36Sopenharmony_ci default DEFAULT_SECURITY_DAC 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_ci help 21162306a36Sopenharmony_ci This choice is there only for converting CONFIG_DEFAULT_SECURITY 21262306a36Sopenharmony_ci in old kernel configs to CONFIG_LSM in new kernel configs. Don't 21362306a36Sopenharmony_ci change this choice unless you are creating a fresh kernel config, 21462306a36Sopenharmony_ci for this choice will be ignored after CONFIG_LSM has been set. 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci Selects the legacy "major security module" that will be 21762306a36Sopenharmony_ci initialized first. Overridden by non-default CONFIG_LSM. 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci config DEFAULT_SECURITY_SELINUX 22062306a36Sopenharmony_ci bool "SELinux" if SECURITY_SELINUX=y 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci config DEFAULT_SECURITY_SMACK 22362306a36Sopenharmony_ci bool "Simplified Mandatory Access Control" if SECURITY_SMACK=y 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci config DEFAULT_SECURITY_TOMOYO 22662306a36Sopenharmony_ci bool "TOMOYO" if SECURITY_TOMOYO=y 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci config DEFAULT_SECURITY_APPARMOR 22962306a36Sopenharmony_ci bool "AppArmor" if SECURITY_APPARMOR=y 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci config DEFAULT_SECURITY_DAC 23262306a36Sopenharmony_ci bool "Unix Discretionary Access Controls" 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ciendchoice 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_ciconfig LSM 23762306a36Sopenharmony_ci string "Ordered list of enabled LSMs" 23862306a36Sopenharmony_ci default "landlock,lockdown,yama,loadpin,safesetid,smack,selinux,tomoyo,apparmor,bpf" if DEFAULT_SECURITY_SMACK 23962306a36Sopenharmony_ci default "landlock,lockdown,yama,loadpin,safesetid,apparmor,selinux,smack,tomoyo,bpf" if DEFAULT_SECURITY_APPARMOR 24062306a36Sopenharmony_ci default "landlock,lockdown,yama,loadpin,safesetid,tomoyo,bpf" if DEFAULT_SECURITY_TOMOYO 24162306a36Sopenharmony_ci default "landlock,lockdown,yama,loadpin,safesetid,bpf" if DEFAULT_SECURITY_DAC 24262306a36Sopenharmony_ci default "landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,bpf" 24362306a36Sopenharmony_ci help 24462306a36Sopenharmony_ci A comma-separated list of LSMs, in initialization order. 24562306a36Sopenharmony_ci Any LSMs left off this list, except for those with order 24662306a36Sopenharmony_ci LSM_ORDER_FIRST and LSM_ORDER_LAST, which are always enabled 24762306a36Sopenharmony_ci if selected in the kernel configuration, will be ignored. 24862306a36Sopenharmony_ci This can be controlled at boot with the "lsm=" parameter. 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci If unsure, leave this as the default. 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_cisource "security/Kconfig.hardening" 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ciendmenu 25562306a36Sopenharmony_ci 256