All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Ceph Development <ceph-devel@vger.kernel.org>
Cc: Gregory Farnum <gfarnum@redhat.com>, Sage Weil <sage@redhat.com>
Subject: libcephfs API changes for credential rework
Date: Tue, 27 Sep 2016 10:39:08 -0400	[thread overview]
Message-ID: <1474987148.2652.31.camel@redhat.com> (raw)

(tl;dr: we need to make some changes to the libcephfs API to allow
 proper credential handling. What's the right approach to take?)

Greg Farnum has posted a pull request to rework how credentials are
handled in cephfs:

    https://github.com/ceph/ceph/pull/11218

...the patch pile is rather large, but the upshot is basically to
change the code not to carve out '-1' in the uid and gid ranges, and to
allow callers to pass down lists of supplementary groups. This is
mainly needed for nfs-ganesha, but it also allows ceph-fuse to delegate
permissions checks to the MDS.

That PR adds most of the low-level plumbing that's needed, but we still
need to expose this capability to applications via libcephfs. Many
libcephfs calls either take "int uid, int gid" or don't allow the
caller to send down creds at all.

I think what we'll want to do is allow applications to create a new
credential object and pass that down to the library in some fashion.
The question is: what's the best way to handle those API changes?

We have several options here:

1) make a clean break with the old API: just change the arguments to
the existing functions, bump the library's major version and set the
"age" field in it to 0. If you built against old headers, it'll fail to
load the library at runtime. This is clearly the simplest option, but
requires everyone to rebuild applications that were built against the
old headers.

2) create a "parallel" API that takes pointers to UserPerm objects, and
add new new calls for them. The old API then becomes a wrapper around
the new code. This would work, but it's more work -- we'd need to add a
whole swath of new calls that take this pointer. This has the advantage
of allowing existing programs to continue working through a lib
upgrade. For this, we'd bump the major lib version, and "age" field to
indicate that the library has a new API, but is backward compatible
with the old one. If we want to go this route, how should the new
functions be named?

3) get tricky with global and thread local variables. Add calls to
allow users to set libcephfs creds at the process and thread level.
When the API is called, we'll check to see if creds have been installed
in either spot and use those if they're present. If they're not, then
we'll grab them from the current task (much like we do today). This is
somewhat analogous to using setuid/setgid/setgroups before making a
syscall. It's less intuitive than option #2 and requires callers to
manage their creds carefully, but means that we don't need to explode
out the API _and_ preserves the ability to run programs built against
the old headers.

It's a fair bit of work any way we approach it, so I want to be clear
on a direction before I dive in too deeply.

Thoughts?
-- 
Jeff Layton <jlayton@redhat.com>

             reply	other threads:[~2016-09-27 14:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27 14:39 Jeff Layton [this message]
2016-09-27 15:13 ` libcephfs API changes for credential rework Sage Weil
2016-09-27 15:43   ` Jeff Layton
2016-09-27 20:40     ` Nathan Cutler
2016-09-28 14:55       ` Jeff Layton
2016-09-27 17:39   ` Jeff Layton
2016-09-27 18:17     ` Gregory Farnum
2016-09-27 19:10       ` Jeff Layton
2016-09-27 19:13         ` Gregory Farnum
2016-09-27 19:53           ` Jeff Layton

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=1474987148.2652.31.camel@redhat.com \
    --to=jlayton@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=gfarnum@redhat.com \
    --cc=sage@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 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.