All of lore.kernel.org
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Eric Paris <eparis@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	jmorris@namei.org, linux-security-module@vger.kernel.org,
	selinux@tycho.nsa.gov, john.johansen@canonical.com,
	keescook@chromium.org, Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH v10] LSM: Multiple concurrent LSMs
Date: Wed, 12 Dec 2012 09:04:25 -0800	[thread overview]
Message-ID: <50C8B919.2060102@schaufler-ca.com> (raw)
In-Reply-To: <1355330026.3527.44.camel@localhost>

On 12/12/2012 8:33 AM, Eric Paris wrote:
> On Wed, 2012-12-12 at 08:24 -0800, Casey Schaufler wrote:
>> On 12/12/2012 7:55 AM, Eric Paris wrote:
>>> On Wed, 2012-12-12 at 07:48 -0800, Casey Schaufler wrote:
>>>
>>> How about asking every LSM to implement a new 'enable' function.  If the
>>> LSM is not 'present' only the new 'enable' function can be used.  If the
>>> LSM is present either the legacy enable function every LSM uses today or
>>> the new enable function can be used.  Thus even if you build the kernel
>>> with stacking, you cannot enable a non-present LSM unless the tools have
>>> been updated.
>> I'm sorry, but I am having trouble understanding what you're suggesting.
> I'm believing every LSM has some mechanism by which it is 'enabled' at
> run time.  With SELinux that mechanism is loading policy.  If you don't
> load policy SELinux will not enforce anything.  I'm assuming something
> similar exists for others.  Tell me if I'm wrong.
>
> We know that legacy tools will break on an LSM if it is not
> CONFIG_SECURITY_PRESET (or equivalent 'first in list').  I'm calling
> this first LSM the 'present' LSM.
>
> Legacy tools also will attempt to enable their LSM using the current
> enabling interface.  For SELinux this is /sys/fs/selinux/load
>
> Thus if as part of stacking we implement a new enabling interface for
> each LSM and disable the legacy enabling mechanism when the LSM is not
> present we make sure that new kernels can't get into the half and half
> situation with old userspace.
>
> Legacy 'enable' interface is /sys/fs/selinux/load
> New enabling interface could be /sys/fs/selinux/new_load
>
> In SELinux present mode, they would do the exact same thing.  In SELinux
> non-present mode we could disable /sys/fs/selinux/load and only allow
> new_load.  Thus old userspace cannot 'enable' SELinux on a new kernel
> when it won't work.
>
> Make any more sense?
>
Yes, thank you.

I'm headed in what I hope is a simpler direction. I have added
two files into securityfs:

	/sys/kernel/security/lsm     - a comma separated list of LSMs
	/sys/kernel/security/present - the presented LSM

I have also added LSM identified files in /proc/.../attr:

	/proc/.../attr/current
	/proc/.../attr/selinux.current
	/proc/.../attr/apparmor.current
	/proc/.../attr/keycreate
	/proc/.../attr/selinux.keycreate

SELinux applications and libraries can use simple logic to determine
what to do:

	if /sys/kernel/security/lsm does not contain "selinux"
		Stop! No SELinux here!
	if /sys/kernel/security/present does not contain "selinux"
		Use selinux.current
	else
		Use current if you like.


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2012-12-12 17:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <50C65DE2.5090909@schaufler-ca.com>
     [not found] ` <201212112128.ADI26010.OQJVLOFSOFtHMF@I-love.SAKURA.ne.jp>
2012-12-11 15:31   ` [PATCH v10] LSM: Multiple concurrent LSMs Casey Schaufler
     [not found]     ` <201212122159.CEC09839.HMOFtQFLJSVFOO@I-love.SAKURA.ne.jp>
2012-12-12 15:48       ` Casey Schaufler
2012-12-12 15:55         ` Eric Paris
2012-12-12 16:24           ` Casey Schaufler
2012-12-12 16:33             ` Eric Paris
2012-12-12 17:04               ` Casey Schaufler [this message]
2012-12-12 17:11                 ` Eric Paris
     [not found]                   ` <CAGXu5jLf+apZK5poD6GKzLkC+p6+mAqKhU3neoOZjr2JumvmpA@mail.gmail.com>
2012-12-12 17:22                     ` Eric Paris
2012-12-12 17:31                   ` Casey Schaufler
2012-12-12 17:47                     ` Eric Paris
2012-12-12 18:25                       ` Casey Schaufler
2012-12-12 18:47                         ` Eric Paris
2012-12-12 20:46                           ` Casey Schaufler
2012-12-12 20:51                             ` Eric Paris
2012-12-12 22:01                               ` Casey Schaufler
     [not found]                 ` <201212132106.AFI82338.QMFHFLSJOtOOFV@I-love.SAKURA.ne.jp>
2012-12-13 16:12                   ` Eric Paris
2012-12-13 16:31                     ` Casey Schaufler
     [not found]                       ` <CAGXu5jJf4NEvs6TjVCBxgd9e8cGwag_-viEntgTBUq85fULr8w@mail.gmail.com>
2012-12-16  3:06                         ` Casey Schaufler
     [not found]                     ` <201212142326.DDG90674.SFHFMOOVLFJtQO@I-love.SAKURA.ne.jp>
2012-12-14 15:07                       ` Eric Paris
2012-12-13 16:38                   ` Casey Schaufler

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=50C8B919.2060102@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=eparis@redhat.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=selinux@tycho.nsa.gov \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.