linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Jeff Layton <jlayton@redhat.com>, simo@redhat.com
Cc: dhowells@redhat.com, keyrings@linux-nfs.org,
	linux-nfs@vger.kernel.org, krbdev@mit.edu,
	"Serge E. Hallyn" <serge.hallyn@ubuntu.com>,
	linux-kernel@vger.kernel.org,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [PATCH 2/2] KEYS: Add per-user_namespace registers for persistent per-UID kerberos caches
Date: Fri, 02 Aug 2013 17:53:25 +0100	[thread overview]
Message-ID: <7136.1375462405@warthog.procyon.org.uk> (raw)
In-Reply-To: <20130802095555.07a2cda3@tlielax.poochiereds.net>

Jeff Layton <jlayton@redhat.com> wrote:

> > +	/* -1 indicates the current user */
> > +	if (_uid == (uid_t)-1) {
> > +		uid = current_uid();
>
> Isn't it possible to have a valid uid of (unsigned int)-1? I know that
> at least some sites use that for "nobody". Why not just require passing
> in the correct UID?

See setresuid() and co. - there -1 is "don't change".

> Looks good overall, but I share Daniel's concerns about making
> krb5-specific infrastructure like this. Essentially this is just a
> persistent keyring that's associated with a kuid, right? Perhaps this
> could be done in such a way that it could be usable for other
> applications in the future?

It's not too hard, I suppose:

	keyctl_get_persistent(uid, prefix, destring)

eg:

	keyctl_get_persistent(-1, "_krb.", KEYCTL_SPEC_PROCESS_KEYRING)

giving:

	struct user_namespace
	  \___ .krb_cache keyring
		\___ _krb.0 keyring
		\___ _krb.5000 keyring
		\___ _krb.5001 keyring
		|	\___ tkt785 big_key
		|	\___ tkt12345 big_key
		\___ _afs.5000 keyring
			\___ afs.redhat.com rxrpc

The other way to do it is create one keyring per user and let userspace create
subkeyrings under that:

	struct user_namespace
	  \___ .krb_cache keyring
		\___ _uid_p.0 keyring
		\___ _uid_p.5000 keyring
		\___ _uid_p.5001 keyring
			\___ krb keyring
			|	\___ tkt785 big_key
			|	\___ tkt12345 big_key
			\___ afs keyring
				\___ afs.redhat.com rxrpc

In the above scheme, it might be worth just making these the same as the user
keyring - which means KEYCTL_SPEC_USER_KEYRING will automatically target it.

Simo:  I believe the problem you have with the user keyring is that it's not
persistent beyond the life of the processes of that UID, right?

David

  parent reply	other threads:[~2013-08-02 16:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 17:38 [RFC][PATCH 0/2] KEYS: Kerberos caching support David Howells
2013-08-01 17:38 ` [PATCH 1/2] KEYS: Implement a big key type that can save to tmpfs David Howells
2013-08-02 20:49   ` Nico Williams
2013-08-02 20:50     ` Nico Williams
2013-08-08 14:46   ` David Howells
2013-08-09 16:24     ` Nico Williams
2013-08-01 17:39 ` [PATCH 2/2] KEYS: Add per-user_namespace registers for persistent per-UID kerberos caches David Howells
2013-08-01 17:54   ` Daniel Kahn Gillmor
2013-08-01 18:29     ` Simo Sorce
2013-08-01 18:55       ` Daniel Kahn Gillmor
2013-08-01 19:10         ` Simo Sorce
2013-08-02 17:50       ` David Howells
2013-08-01 23:09   ` Eric W. Biederman
2013-08-02 13:55   ` Jeff Layton
2013-08-02 14:16     ` Simo Sorce
2013-08-02 20:20     ` Nico Williams
2013-08-02 16:53   ` David Howells [this message]
2013-08-02 17:00     ` Simo Sorce
2013-08-02 17:02     ` David Howells
2013-08-02 17:13     ` Jeff Layton
2013-08-02 17:00   ` David Howells
2013-08-02 17:05   ` David Howells
2013-08-02 17:44     ` Eric W. Biederman
2013-08-02 17:12   ` 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=7136.1375462405@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=jlayton@redhat.com \
    --cc=keyrings@linux-nfs.org \
    --cc=krbdev@mit.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=serge.hallyn@ubuntu.com \
    --cc=simo@redhat.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).