depends on SECURITY
default n
help
- This enables NSA Security-Enhanced Linux (SELinux).
+ This selects NSA Security-Enhanced Linux (SELinux).
You will also need a policy configuration and a labeled filesystem.
You can obtain the policy compiler (checkpolicy), the utility for
labeling filesystems (setfiles), and an example policy configuration
from http://www.nsa.gov/selinux.
+ SELinux needs to be explicitly enabled on the kernel command line with
+ selinux=1. If you specify selinux=0 or do not use this parameter,
+ SELinux will not be enabled.
If you are unsure how to answer this question, answer N.
config SECURITY_SELINUX_DEVELOP
__setup("enforcing=", enforcing_setup);
#endif
+int selinux_enabled = 0;
+
+static int __init selinux_enabled_setup(char *str)
+{
+ selinux_enabled = simple_strtol(str, NULL, 0);
+ return 1;
+}
+__setup("selinux=", selinux_enabled_setup);
+
/* Original (dummy) security module. */
static struct security_operations *original_ops = NULL;
{
struct task_security_struct *tsec;
+ if (!selinux_enabled) {
+ printk(KERN_INFO "SELinux: Not enabled at boot.\n");
+ return 0;
+ }
+
printk(KERN_INFO "SELinux: Initializing.\n");
/* Set the security state for the initial task. */
#include "security.h"
#include "objsec.h"
+extern int selinux_enabled;
+
/* Check whether a task is allowed to use a security operation. */
int task_has_security(struct task_struct *tsk,
u32 perms)
static int __init init_sel_fs(void)
{
- return register_filesystem(&sel_fs_type);
+ return selinux_enabled ? register_filesystem(&sel_fs_type) : 0;
}
__initcall(init_sel_fs);