From: David Howells Subject: Re: Keyrings, user namespaces and the user_struct Date: Wed, 26 Oct 2016 08:37:20 +0100 Message-ID: <30199.1477467440@warthog.procyon.org.uk> References: <87y41bvhui.fsf@xmission.com> <1477414605.3079.40.camel@HansenPartnership.com> <17576.1477412418@warthog.procyon.org.uk> <18335.1477414412@warthog.procyon.org.uk> <18846.1477416621@warthog.procyon.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <87y41bvhui.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> Content-ID: <29561.1477467138.1-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "Eric W. Biederman" Cc: James Bottomley , containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org, dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, keyrings-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, simo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org List-Id: containers.vger.kernel.org Eric W. Biederman wrote: > David Howells writes: > > > James Bottomley wrote: > > > >> > There's another possibility here - since user_namespaces are > >> > hierarchical, does it make sense to let a process see keys that are > >> > in an ancestral namespace? > >> > >> I think that should be the decision of the owner. If you're creating a > >> userns to de-privilege the next user, likely you don't want this, but > >> if you're creating a userns to enhance it, then you do. > > > > Maybe the simplest is to put a 'stop here' flag on a user_namespace. Then > > when we look to see if a key is in the caller's namespace, we go up the tree > > until we hit the flag. If you don't find the key's ns within the caller's > > permitted subtree, you don't get to see the key. > > Let me just say we already have all of that (in a much nicer format) by > limiting the set of keys we can access to the set of users visible in > the user namespace. Except that we don't. Users outside of a namespace can see any key that grants permissions to 'other' - though this is something we don't do by default. David