linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
To: Kees Cook <keescook@chromium.org>
Cc: James Morris <jmorris@namei.org>,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] LSM: Ignore "security=" when "lsm=" is specified
Date: Tue, 12 Feb 2019 09:21:40 +0900	[thread overview]
Message-ID: <201902120021.x1C0LeYB051392@www262.sakura.ne.jp> (raw)
In-Reply-To: <20190211225403.GA7769@beast>

Kees Cook wrote:
> To avoid potential confusion, explicitly ignore "security=" when "lsm=" is
> used on the command line, and report that it is happening.

To maintain the existing behavior of CONFIG_DEFAULT_SECURITY, I also suggest this change.
This saves e.g. Ubuntu users who are using only AppArmor from explicitly specifying
security=apparmor when they don't want to enable other LSM_FLAG_LEGACY_MAJOR modules.

---
 security/Kconfig    | 37 +++++++++++++++++++++++++++++++++++++
 security/security.c |  5 ++++-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/security/Kconfig b/security/Kconfig
index 9555f49..6a40995 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -250,5 +250,42 @@ config LSM
 
 	  If unsure, leave this as the default.
 
+choice
+	prompt "Default exclusive security module"
+	default DEFAULT_SECURITY_SELINUX if SECURITY_SELINUX
+	default DEFAULT_SECURITY_SMACK if SECURITY_SMACK
+	default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO
+	default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR
+	default DEFAULT_SECURITY_DAC
+
+	help
+	  The security module where only one of these modules should be enabled if
+	  neither the "security=" parameter nor the "lsm=" parameter is specified.
+
+	config DEFAULT_SECURITY_SELINUX
+		bool "SELinux" if SECURITY_SELINUX=y
+
+	config DEFAULT_SECURITY_SMACK
+		bool "Simplified Mandatory Access Control" if SECURITY_SMACK=y
+
+	config DEFAULT_SECURITY_TOMOYO
+		bool "TOMOYO" if SECURITY_TOMOYO=y
+
+	config DEFAULT_SECURITY_APPARMOR
+		bool "AppArmor" if SECURITY_APPARMOR=y
+
+	config DEFAULT_SECURITY_DAC
+		bool "Unix Discretionary Access Controls"
+
+endchoice
+
+config DEFAULT_SECURITY
+	string
+	default "selinux" if DEFAULT_SECURITY_SELINUX
+	default "smack" if DEFAULT_SECURITY_SMACK
+	default "tomoyo" if DEFAULT_SECURITY_TOMOYO
+	default "apparmor" if DEFAULT_SECURITY_APPARMOR
+	default "" if DEFAULT_SECURITY_DAC
+
 endmenu
 
diff --git a/security/security.c b/security/security.c
index e6153ed..c44e3cd 100644
--- a/security/security.c
+++ b/security/security.c
@@ -294,8 +294,11 @@ static void __init ordered_lsm_init(void)
 			chosen_major_lsm = NULL;
 		}
 		ordered_lsm_parse(chosen_lsm_order, "cmdline");
-	} else
+	} else {
+		if (!chosen_major_lsm)
+			chosen_major_lsm = CONFIG_DEFAULT_SECURITY;
 		ordered_lsm_parse(builtin_lsm_order, "builtin");
+	}
 
 	for (lsm = ordered_lsms; *lsm; lsm++)
 		prepare_lsm(*lsm);
-- 
1.8.3.1


  parent reply	other threads:[~2019-02-12  0:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 22:54 [PATCH] LSM: Ignore "security=" when "lsm=" is specified Kees Cook
2019-02-11 23:10 ` Casey Schaufler
2019-02-11 23:18   ` Kees Cook
2019-02-12  0:07     ` James Morris
2019-02-12  0:21 ` Tetsuo Handa [this message]
2019-02-12  0:26   ` Kees Cook
2019-02-12  0:59     ` Tetsuo Handa
2019-02-12 18:26       ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201902120021.x1C0LeYB051392@www262.sakura.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).