RHEL4 and module loading
The attached patch against the policy source for RHEL4 adds two new booleans, secure_mode_insmod and secure_mode_policyload.
secure_mode_insmod prevents loading kernel modules if it is set to the value 1, the command "setsebool -P secure_mode_insmod 1" does this.
secure_mode_policyload prevents loading a new policy and changing the values of booleans (can't escape this without a reboot), the command "setsebool -P secure_mode_policyload 1" does this.
These booleans are a standard feature in recent versions of the policy, I just back-ported them to RHEL4.
Note that if you have secure_mode_insmod enabled then you need to have ALL modules that you will use configured in the initrd. The command mkinitrd has the --with=module option for this, you may need 20 or more --with= options to get all the modules.
Some customers apparently want to compile their own kernels to prevent loading modules and other things. A custom kernel can not be supported by GSS, but a standard Red Hat kernel with some custom SE Linux policy will get a degree of support (the amount of support is determined by the problem in question and the significance of the policy changes).
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
domains/unconfined.te +7 -0
@@ -42,6 +42,13 @@ allow unconfined_t unlabeled_t:filesystem *; allow unlabeled_t unlabeled_t:filesystem associate; +# Disable loading modules +bool secure_mode_insmod false; + +# Disable loading policy, putting the machine in permissive mode, or +# setting booleans +bool secure_mode_policyload false; + # Support NFS home directories bool use_nfs_home_dirs false;
macros/global_macros.te +8 -0
@@ -594,14 +594,22 @@ allow $1 domain:msg { send receive }; # Access the security API. +if (secure_mode_policyload) { +allow $1 security_t:security ~{ load_policy setenforce setbool }; +} else { allow $1 security_t:security *; +} auditallow $1 security_t:security { load_policy setenforce setbool }; # Perform certain system operations that lacked individual capabilities. allow $1 kernel_t:system *; # Use any Linux capability. +if (secure_mode_insmod) { +allow $1 self:capability ~sys_module; +} else { allow $1 self:capability *; +} # Set user information and skip authentication. allow $1 self:passwd *;