All of lore.kernel.org
 help / color / mirror / Atom feed
* namespaced file capabilities
@ 2016-04-22 17:26 ` serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA
  0 siblings, 0 replies; 79+ messages in thread
From: serge.hallyn @ 2016-04-22 17:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-api, containers, ebiederm, morgan, luto, keescook, jmorris

Hi,

I've sent a few patches and emails over the past months about supporting
file capabilities in user namespace confined containers.  A few of the
requirements as I see them are:

1. Root in a user namespace should be able to set file capabilities on a binary
for use by any user mapped into his namespace.

2. Any uid not mapped into the user namespace whose root user set file
capabilities should not gain privileges when running an executable which only
has file capabilities set by this root user.

3. Existing calls to cap_set_file(3) and cap_get_file(3) as well as
setcap(8) and getcap(8) should transparently work.  This would allow
package managers to simply set file capabilities in postinst.

Below is a kernel patch which implements a new security.nscapability
extended attribute.  Setting this xattr on a file requires cap_setfcap
against the current user namespace, and for the file to be owned by
a uid and gid mapped into that namespace.  When found on a file,
the capabilities will take effect only if the file is owned by the
root uid in the caller's namespace, or the root uid in any ancestor
namespace.

While this design supports nested namespaces, it does not support
use of file capabilities by users in unrelated namespaces.  So if
the same file is linked into two namespaces N1 and N2 which do not
share the same root kuid, then the only way for N1 and N2 to both
execute the file while respecting security.nscapability is to have
a common ancestor namespace write the capability.  The only reasonable
way we could handle this case would be to use a securityfs interface
to set file capabilities.  The capability.ko module could then
do the work of keeping a list of uid ranges for which file capabilities
should be honored.  I don't think that flexibility is really called
for.
 
The kernel patch follows, and can be found at
https://git.kernel.org/cgit/linux/kernel/git/sergeh/linux-security.git/log/?h=2016-04-22/nsfscaps

The libcap patch can be found at
https://git.kernel.org/cgit/linux/kernel/git/sergeh/libcap.git/log/?h=2016-04-22/nscaps

Comments/conversation/suggestions greatly appreciated.

thanks,
-serge

^ permalink raw reply	[flat|nested] 79+ messages in thread

end of thread, other threads:[~2016-05-20 23:32 UTC | newest]

Thread overview: 79+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-22 17:26 namespaced file capabilities serge.hallyn
2016-04-22 17:26 ` serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA
     [not found] ` <1461345993-17526-1-git-send-email-serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
2016-04-22 17:26   ` [PATCH 1/1] simplified security.nscapability xattr serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA
2016-04-22 17:26     ` serge.hallyn
2016-04-26 21:59     ` Kees Cook
     [not found]       ` <CAGXu5jKFNQs8oxq+yD6_Q8HcNyf+GouSHFzkxT9u9BkK=ZLQ7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-26 22:26         ` Serge E. Hallyn
2016-04-26 22:26           ` Serge E. Hallyn
     [not found]           ` <20160426222627.GA19307-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-04-26 22:39             ` Kees Cook
2016-04-26 22:39               ` Kees Cook
2016-04-27  4:39               ` Serge E. Hallyn
2016-04-27  4:39                 ` Serge E. Hallyn
2016-04-27  8:09               ` Jann Horn
     [not found]               ` <CAGXu5jJbmSKst_RiM84-7OaX=2XettzpTh34uFFoevvoPRO76Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-27  4:39                 ` Serge E. Hallyn
2016-04-27  8:09                 ` Jann Horn
2016-05-02  3:54                 ` Serge E. Hallyn
2016-05-02  3:54                   ` Serge E. Hallyn
     [not found]                   ` <20160502035452.GA31837-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-02 18:31                     ` Michael Kerrisk (man-pages)
2016-05-02 18:31                       ` Michael Kerrisk (man-pages)
2016-05-02 21:31                     ` Eric W. Biederman
2016-05-02 21:31                       ` Eric W. Biederman
     [not found]                       ` <87h9egp2oq.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-05-03  3:57                         ` Andrew G. Morgan
2016-05-03  4:50                           ` Eric W. Biederman
2016-05-03  4:50                             ` Eric W. Biederman
     [not found]                             ` <874mafiw2m.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-05-10 19:00                               ` Serge E. Hallyn
2016-05-10 19:00                                 ` Serge E. Hallyn
     [not found]                           ` <CALQRfL7mfpyudWs4Z8W5Zi8CTG-9O0OvrCnRU7pk0MXtsLBd0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-03  4:50                             ` Eric W. Biederman
2016-05-03  5:19                             ` Serge E. Hallyn
2016-05-03  5:19                           ` Serge E. Hallyn
2016-05-03  5:19                             ` Serge E. Hallyn
2016-05-03  5:54                             ` Eric W. Biederman
2016-05-03  5:54                               ` Eric W. Biederman
2016-05-03 14:25                               ` Serge E. Hallyn
2016-05-03 14:25                                 ` Serge E. Hallyn
2016-05-10 19:03                                 ` Serge E. Hallyn
2016-05-10 19:03                                   ` Serge E. Hallyn
     [not found]                                 ` <20160503142526.GA6309-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-10 19:03                                   ` Serge E. Hallyn
     [not found]                               ` <87bn4nhejj.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-05-03 14:25                                 ` Serge E. Hallyn
2016-05-07 23:10                                 ` Jann Horn
2016-05-07 23:10                                   ` Jann Horn
2016-05-11 21:02                                   ` Serge E. Hallyn
2016-05-11 21:02                                     ` Serge E. Hallyn
     [not found]                                     ` <20160511210221.GA24015-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-16 21:15                                       ` Serge E. Hallyn
2016-05-16 21:15                                     ` Serge E. Hallyn
2016-05-16 21:15                                       ` Serge E. Hallyn
     [not found]                                       ` <20160516211523.GA5282-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-16 21:48                                         ` Serge E. Hallyn
2016-05-16 21:48                                           ` Serge E. Hallyn
2016-05-18 21:57                                           ` [PATCH RFC] user-namespaced file capabilities - now with more magic Serge E. Hallyn
2016-05-19 20:53                                             ` Mimi Zohar
2016-05-19 20:53                                               ` Mimi Zohar
     [not found]                                               ` <1463691236.2465.74.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-05-20  3:40                                                 ` Serge E. Hallyn
2016-05-20  3:40                                               ` Serge E. Hallyn
     [not found]                                                 ` <20160520034048.GA31216-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-20 11:19                                                   ` Mimi Zohar
2016-05-20 11:19                                                     ` Mimi Zohar
     [not found]                                                     ` <1463743150.2465.100.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-05-20 18:28                                                       ` Eric W. Biederman
2016-05-20 18:28                                                     ` Eric W. Biederman
2016-05-20 18:28                                                       ` Eric W. Biederman
     [not found]                                                       ` <87mvnklh20.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-05-20 19:09                                                         ` Mimi Zohar
2016-05-20 19:09                                                           ` Mimi Zohar
     [not found]                                                           ` <1463771344.2763.58.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-05-20 19:11                                                             ` Eric W. Biederman
2016-05-20 19:11                                                           ` Eric W. Biederman
2016-05-20 19:26                                                         ` Serge E. Hallyn
2016-05-20 19:26                                                           ` Serge E. Hallyn
2016-05-20 19:42                                                           ` Eric W. Biederman
2016-05-20 19:59                                                             ` Serge E. Hallyn
2016-05-20 19:59                                                               ` Serge E. Hallyn
2016-05-20 23:23                                                               ` Mimi Zohar
2016-05-20 23:23                                                                 ` Mimi Zohar
     [not found]                                                                 ` <1463786592.2763.74.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-05-20 23:32                                                                   ` Serge E. Hallyn
2016-05-20 23:32                                                                     ` Serge E. Hallyn
     [not found]                                                               ` <20160520195902.GB12101-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-20 23:23                                                                 ` Mimi Zohar
     [not found]                                                             ` <87iny8h5yv.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-05-20 19:59                                                               ` Serge E. Hallyn
     [not found]                                                           ` <20160520192607.GA11601-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-20 19:42                                                             ` Eric W. Biederman
     [not found]                                             ` <20160518215752.GA9187-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-19 20:53                                               ` Mimi Zohar
     [not found]                                           ` <20160516214804.GA5926-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-18 21:57                                             ` Serge E. Hallyn
     [not found]                                   ` <20160507231012.GA11076-J1fxOzX/cBvk1uMJSBkQmQ@public.gmane.org>
2016-05-11 21:02                                     ` [PATCH 1/1] simplified security.nscapability xattr Serge E. Hallyn
     [not found]                             ` <20160503051921.GA31551-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2016-05-03  5:54                               ` Eric W. Biederman
     [not found]     ` <1461345993-17526-2-git-send-email-serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
2016-04-26 19:46       ` Seth Forshee
2016-04-26 19:46         ` Seth Forshee
2016-04-26 21:59       ` Kees Cook

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.