linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kyle Moffett <kyle@moffetthome.net>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	lkml <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	Ashwin Ganti <ashwin.ganti@gmail.com>, Greg KH <greg@kroah.com>,
	rsc@swtch.com, ericvh@gmail.com,
	linux-security-module@vger.kernel.org,
	Ron Minnich <rminnich@gmail.com>,
	jt.beard@gmail.com, Andrew Morton <akpm@linux-foundation.org>,
	Andrew Morgan <morgan@kernel.org>,
	oleg@us.ibm.com, Eric Paris <eparis@redhat.com>,
	linux-api@vger.kernel.org, Randy Dunlap <rdunlap@xenotime.net>
Subject: Re: [PATCH 3/3] p9auth: add p9auth driver
Date: Thu, 22 Apr 2010 00:57:03 -0400	[thread overview]
Message-ID: <w2wf73f7ab81004212157o371c5738o10c8b6ff807ba36a@mail.gmail.com> (raw)
In-Reply-To: <m11ve81usw.fsf@fess.ebiederm.org>

On Wed, Apr 21, 2010 at 15:15, Eric W. Biederman <ebiederm@xmission.com> wrote:
> "Serge E. Hallyn" <serue@us.ibm.com> writes:
>
>> Ignoring namespaces for a moment, I guess we could do something like
>>
>> struct credentials_pass {
>>       pid_t global_pid;
>>       unsigned long unique_id;
>>       uid_t new_uid;
>>       gid_t new_gid;
>>       int num_aux_gids;
>>       gid_t aux_gids[];
>> }
>
> This looks surprising like what I am doing in passing uids and pids
> through unix domain sockets.
>
> So if this looks like a direction we want to go it shouldn't be too
> difficult.

Hmm... for an alternative idea:

We have this nice "kernel keyring" infrastructure that lets us stuff
arbitrary things into "keys" and grant/revoke them between processes.
What if we created a relatively generic way for processes to package
up privileges (of whatever form) into a "key" that could be granted to
another process (via UNIX-domain socket)?  Then the other process
would use a setuid()-ish syscall which would instead apply a specific
key as your credentials, possibly including the audit context and/or
namespaces it came from.

By using the keyring system, such tokens could be kept around across
multiple processes easily (as opposed to FDs), in the same style as a
"sudo" ticket file, for example (even with an expiration time).

Types of credentials you could pass around:
  * Capabilities
  * Filesystem UID/GID in a particular UID namespace (for FS operations)
  * Process UID/GID in a particular UID namespace (for kill(), etc)
  * Audit contexts
  * SELinux/etc security labels

All of the above could be optionally limited to effectively require a
bprm-secure-style exec() with specific args.  So for example, instead
of making "/usr/sbin/passwd" a setuid program, you could make it be an
unprivileged helper.  It would connect to a privileged daemon and ask
for a password-change cookie for that particular user.  The daemon
would create what is essentially a "delayed exec" key which grants a
specific UID and capabilities when that process performs an execkey().

So as an example, you could rewrite "sudo" as a partially-privileged
daemon and an unprivileged helper.  The unpriv helper would send
across a request (optionally including the command and environment)
which would be checked by the daemon.  It would then issue a key to
allow the unpriv helper to perform a limited exec.

Another option would be to rewrite network login programs (eg OpenSSH)
to use this for privilege separation.  The listening process would get
a non-expiring key to allow it to exec a partially-privileged
password-checking program.  If the password-checking program likes the
password it generates a single-use key to pass back to the forked
network process that allows it to exec a program as that user.

Cheers,
Kyle Moffett

  parent reply	other threads:[~2010-04-22  4:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100421012749.GA21338@us.ibm.com>
     [not found] ` <20100421012749.GA21338-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-21  1:29   ` [PATCH 3/3] p9auth: add p9auth driver Serge E. Hallyn
     [not found]     ` <20100421012908.GB24251-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-21  3:04       ` Greg KH
     [not found]         ` <20100421030406.GB10258-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2010-04-21  3:45           ` Serge E. Hallyn
2010-04-21  4:18             ` Ashwin Ganti
2010-04-21 13:47               ` Serge E. Hallyn
     [not found]                 ` <20100421134759.GE16326-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-21 14:44                   ` Ashwin Ganti
2010-04-21  4:45             ` Eric W. Biederman
     [not found]               ` <m1zl0xo1m9.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2010-04-21 13:21                 ` Serge E. Hallyn
2010-04-24  3:36                 ` Serge E. Hallyn
2010-04-24 16:25                   ` ron minnich
     [not found]                     ` <n2s13426df11004240925id540ed94mc2ebafada0099ec4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-04-24 18:01                       ` Eric W. Biederman
2010-04-25  3:24                         ` Serge E. Hallyn
2010-04-21  9:27       ` Alan Cox
     [not found]         ` <20100421102739.6ad932fb-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2010-04-21 13:39           ` Serge E. Hallyn
2010-04-21 14:19             ` Alan Cox
     [not found]               ` <20100421151917.5ae20265-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2010-04-21 15:09                 ` Serge E. Hallyn
2010-04-21 19:15                   ` Eric W. Biederman
2010-04-21 20:23                     ` Serge E. Hallyn
2010-04-22  4:57                     ` Kyle Moffett [this message]
     [not found]                       ` <w2wf73f7ab81004212157o371c5738o10c8b6ff807ba36a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-04-22 14:36                         ` Serge E. Hallyn
2010-04-21 13:55           ` Eric Paris
2010-04-21 14:30             ` Serge E. Hallyn
2010-04-21 10:49       ` David Howells
2010-04-21 13:40         ` Serge E. Hallyn

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=w2wf73f7ab81004212157o371c5738o10c8b6ff807ba36a@mail.gmail.com \
    --to=kyle@moffetthome.net \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ashwin.ganti@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=eparis@redhat.com \
    --cc=ericvh@gmail.com \
    --cc=greg@kroah.com \
    --cc=jt.beard@gmail.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=morgan@kernel.org \
    --cc=oleg@us.ibm.com \
    --cc=rdunlap@xenotime.net \
    --cc=rminnich@gmail.com \
    --cc=rsc@swtch.com \
    --cc=serue@us.ibm.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 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).