diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-10-21 13:28:06 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2013-10-21 13:28:06 -0400 |
commit | 6b53fc9ce38ba6fff2fd5c2f6ed143747067a39d (patch) | |
tree | 4c0e0f68cc638f91f0c7a6810507c4e8e2f9d55d /utils/exportfs/exportfs.c | |
parent | f9cac65972da588d5218236de60a7be11247a8aa (diff) | |
download | nfs-utils-6b53fc9ce38ba6fff2fd5c2f6ed143747067a39d.tar.gz nfs-utils-6b53fc9ce38ba6fff2fd5c2f6ed143747067a39d.tar.xz nfs-utils-6b53fc9ce38ba6fff2fd5c2f6ed143747067a39d.zip |
gssd: do a more thorough change of identity after forking
The part of process_krb5_upcall that handles non-machine user creds
first tries to query GSSAPI for credentials. If that fails, it then
falls back to trawling through likely credcache locations to find them
and then points $KRB5CCNAME at it before proceeding. There are a number
of bugs in this code that this patch attempts to address.
The code that queries GSSAPI for credentials does it as root which
almost universally fails to do anything useful unless we happen to be
looking for non-machine root creds. Because of this, gssd almost always
falls back to having to search for credcaches "manually". The code that
handles credential switching is in create_auth_rpc_client, so it's too
late to be of any use here.
Worse yet, for historical reasons the MIT krb5 authors used %{uid} in
the default credcache locations which translates to the real uid. Thus
switching the fsuid or even euid is insufficient. You must switch the
real uid in order to be able to find the proper credcache in most cases.
This patch moves the credential switching to occur much earlier in the
process and has it do a much more thorough job of it. It first drops all
supplimentary groups, then determines a gid to use and switches the gids
and uids to the correct ones. If it can't determine the correct gid to
use, it then tries to look up the one for "nobody" and uses that.
Once the credentials are switched, the forked child now no longer tries
to change them back. It does the downcall with the new credentials and
just exits when it's done.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/exportfs/exportfs.c')
0 files changed, 0 insertions, 0 deletions