From: Stephen Smalley <sds@tycho.nsa.gov>
To: "Serge E. Hallyn" <serge@hallyn.com>
Cc: selinux@tycho.nsa.gov
Subject: Re: [RFC 04/10] netns, selinux: create the selinux netlink socket per network namespace
Date: Tue, 10 Oct 2017 10:35:17 -0400 [thread overview]
Message-ID: <1507646117.30616.11.camel@tycho.nsa.gov> (raw)
In-Reply-To: <20171006192421.GA8935@mail.hallyn.com>
On Fri, 2017-10-06 at 14:24 -0500, Serge E. Hallyn wrote:
> Quoting Stephen Smalley (sds@tycho.nsa.gov):
> > On Fri, 2017-10-06 at 12:07 +1100, James Morris wrote:
> > > On Mon, 2 Oct 2017, Stephen Smalley wrote:
> > >
> > > > This change presumes that one will always unshare the network
> > > > namespace
> > > > when unsharing a new selinux namespace (the reverse is not
> > > > required).
> > > > Otherwise, the same inconsistencies could arise between the
> > > > notifications
> > > > and the relevant policy. At present, nothing enforces this
> > > > guarantee
> > > > at the kernel level; it is left up to userspace (e.g. container
> > > > runtimes).
> > > > It is an open question as to whether this is a good idea or
> > > > whether
> > > > unsharing of the selinux namespace should automatically unshare
> > > > the
> > > > network
> > > > namespace.
> > >
> > > What about logging a kernel warning if just SELinux is unshared?
> >
> > As with Serge's suggestion, the problem is that one can unshare
> > them in
> > any order, and potentially with intervening steps to set up the
>
> But is it going to stay that way? I thought that was a temporary
> thing
> while you test it out.
>
> Because as it is it seems unacceptably loose. A few questions:
>
> (thinking as I type here - ok only the last one is the real question)
>
> Assume I'm in my given netns. I unshare just my selinuxns. Does the
> selinuxns have the authority to decide things about that netns?
>
> If I unshare selinuxns+netns, then the selinuxns clearly "owns" the
> netns,
> so the selinuxns has clear authority. Likewise, when I unshare the
> netns after the selinuxns, from that point on the selinuxns can be
> said
> to have authority over the netns.
>
> I think you want to keep it completely orthogonal, and I guess so
> long
> as the parent selinuxns policy still applies it's ok.
>
> So I unshare my selinuxns but not userns. I don't have CAP_MAC_ADMIN
> against the user_ns, so any selinux related changes will be denied.
> Once I unshare userns, they will be allowed.
>
> Ah, right. Here's the real question. Policy dictates file
> transition
> rules. How will those be namespaced? Will only the init_selinux_ns
> be
> allowed to specify a file context? You can't let
> ns_capable(current_selinux_ns,
> CAP_MAC_ADMIN) guide that safely, but capable(CAP_MAC_ADMIN) will be
> very restrictive. What's the plan there? Sorry if it's spelled out
> elsewhere.
I don't think we know yet. The current patches support a separate and
distinct in-core inode security context for each namespace, which
supports scenarios such as using context mounts on the host OS to label
each container with a single context with MCS separation while using
per-file xattrs within a container to support a conventional targeted
policy, but we haven't yet resolved how to deal with the actual
persistent file security contexts, e.g. whether there will be only one
(possibly with a label mapping defined) or multiple.
next prev parent reply other threads:[~2017-10-10 14:35 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-02 15:58 [RFC 00/10] Introduce a SELinux namespace Stephen Smalley
2017-10-02 15:58 ` [RFC 01/10] selinux: introduce a selinux namespace Stephen Smalley
2018-02-06 22:18 ` Paul Moore
2018-02-07 16:17 ` Paul Moore
2018-02-07 17:48 ` Stephen Smalley
2018-02-07 19:56 ` Paul Moore
2018-02-08 15:02 ` Stephen Smalley
2018-02-08 21:41 ` Paul Moore
2017-10-02 15:58 ` [RFC 02/10] selinux: support multiple selinuxfs instances Stephen Smalley
2017-10-02 15:58 ` [RFC 03/10] selinux: move the AVC into the selinux namespace Stephen Smalley
2017-10-09 3:10 ` James Morris
2017-10-10 14:35 ` Stephen Smalley
2017-10-02 15:58 ` [RFC 04/10] netns, selinux: create the selinux netlink socket per network namespace Stephen Smalley
2017-10-05 5:47 ` Serge E. Hallyn
2017-10-05 14:06 ` Stephen Smalley
2017-10-05 14:11 ` Stephen Smalley
2017-10-29 3:16 ` Serge E. Hallyn
2017-10-06 1:07 ` James Morris
2017-10-06 13:21 ` Stephen Smalley
2017-10-06 19:24 ` Serge E. Hallyn
2017-10-10 14:35 ` Stephen Smalley [this message]
2017-10-02 15:58 ` [RFC 05/10] selinux: support per-task/cred selinux namespace Stephen Smalley
2017-10-06 1:14 ` James Morris
2017-10-06 19:25 ` Serge E. Hallyn
2017-10-08 22:08 ` James Morris
2017-10-02 15:58 ` [RFC 06/10] selinux: introduce cred_selinux_ns() and use it Stephen Smalley
2017-10-02 15:58 ` [RFC 07/10] selinux: support per-namespace inode security structures Stephen Smalley
2017-10-02 15:58 ` [RFC 08/10] selinux: support per-namespace superblock " Stephen Smalley
2017-10-02 15:58 ` [RFC 09/10] selinux: add a selinuxfs interface to unshare selinux namespace Stephen Smalley
2017-10-02 23:56 ` Casey Schaufler
2017-10-03 12:29 ` Stephen Smalley
2017-10-03 17:14 ` Casey Schaufler
2017-10-05 15:27 ` Stephen Smalley
2017-10-05 15:49 ` Stephen Smalley
2017-10-05 17:04 ` Stephen Smalley
2017-10-09 1:52 ` James Morris
[not found] ` <CAB9W1A2-PT8QU-md1s9fxhNg+Cv0C4Xu-i1w_q0XzQ+K9rsyAg@mail.gmail.com>
2017-10-09 13:53 ` Stephen Smalley
2017-10-09 23:04 ` James Morris
2017-10-02 15:58 ` [RFC 10/10] selinuxfs: restrict write operations to the same " Stephen Smalley
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=1507646117.30616.11.camel@tycho.nsa.gov \
--to=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
--cc=serge@hallyn.com \
/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.