public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: authentication / encryption key retention
Date: Fri, 22 Aug 2003 16:25:43 +0100	[thread overview]
Message-ID: <18281.1061565943@redhat.com> (raw)


Hi Linus,

I'm looking at implementing authentication token and encryption key retention
for the 2.7 kernel again.

I can implement keyrings and sequences of keyrings, but the problem I'm not
sure about it how to attach them to a process. Are you willing to advise me on
my ideas?

I think the best way is to have a stack of "personae" attached to a
process. Each persona would then have an identity (UID) and a sequence of keys.

Personae would be acquired by way of SUID programs, AF_UNIX credential passing,
and directly by way of syscalls.

The top persona on the stack would define what the process looked like to other
processes - controlling access to the process by signal and ptrace.

One of the personae on the stack would be elected to be the "effective" one -
the one that gets attached to newly opened files, and is used to specify access
to other processes for signal and ptrace.

Syscalls would be provided to reorder and modify the contents of the persona
stack.

Each struct file would have a pointer to the persona that contains the identity
and keys governing access to the underlying data.

Syscalls would also be provided to subscribe a persona to new keyrings (persona
would be shared as long as possible, but would be forked on modification).

Each Keyring would contain a set of distinguishable keys of various types, eg:
UNIX groups list, kerberos TGT for a particular domain, encryption key, process
access key. Each keyring would have an ACL that governs which UIDs/GIDs are
allowed to subscribe to it or modify it. Whilst keyrings would be visible
through sysfs, they would not be persistent once no longer in use.


However, all this makes for a few problems:

 (1) setuid()

     This can be made to manipulate the personae stack in various ways, but
     it'd be hard to get it'd work exactly as before.

     This is especially true with respect to GIDs. I think I'd have to attach
     a GID to each persona, however this would mean these UID manipulating
     syscalls would _also_ manipulate GIDs.

 (2) setreuid(), setresuid()

     As with setuid(), except that these would then manipulate multiple
     personae simultaneously, which probably won't be a problem - except if the
     "effective" UID is not a member of the stack...

     The top two entries on the stack can be viewed as real (TOS) and saved
     (2OS) UIDs.

 (3) setgid()

     GIDs would no longer be independent of UIDs, so this would change the GID
     on both the TOS and the effective persona.

 (4) setregid(), setresgid()

     These give the worst problems. I could duplicate personae to make sure I
     can store all the GIDs if they are all different, but that then has
     consequences for setre*uid().

 (5) setfsuid()

     This would then select the first persona on the stack that matches the
     UID, but what if there is no match? Should it then create a new persona
     with a different UID?

What I don't know is how attached we are to the current interface.

David

             reply	other threads:[~2003-08-22 15:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-22 15:25 David Howells [this message]
2003-08-22 16:19 ` authentication / encryption key retention Linus Torvalds
2003-08-22 17:39   ` David Howells
2003-08-22 18:38     ` Linus Torvalds
2003-08-26 10:12       ` David Howells
2003-08-26 15:30         ` Alan Cox
2003-08-26 16:07           ` David Howells
2003-08-26 16:26             ` Valdis.Kletnieks
2003-08-26 16:26         ` Stephen Smalley
2003-08-27 15:31       ` [PATCH/RFC] " David Howells

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=18281.1061565943@redhat.com \
    --to=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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