Process Authentication Groups (PAGs)

Peter Braam (braam@cs.cmu.edu)
Tue, 17 Feb 1998 22:24:39 -0500 (EST)


Process Authentication Groups
-----------------------------

Coda as well as other system services want to implement a stricter
form of protection and authentication. Unix authorizes processes
based on their uid -- the uid defines a partition of the set of
processes. Coda finds this partition into protection groups based on
uid too coarse; the sets of processes it wants to authorize should be
smaller.

For example smbfs and ncpfs need subsets of processes to allow more
than one authenticated session to an NT or Novel server, much like
Coda. Another example, is that root is not to be trusted lightly but
can change its uid easily -- systems based on the Kerberos model don't
like this. A further worry arises when telnetd is serving two
sessions for the same uid, it is good practice to ask each of these
sessions to authenticate.

The smaller group of processes for which authentication should give
access is called a PAG, a process authentication group. Hopefully
defined by the following:
- Every process should belong to a pag
- Pag's are inherited by fork
- at boottime init has a zero pag
- when process executes a login related operation (preferrably
through a PAM module) this login process would execute a "newpag"
system call which places the process in a new PAG.
- any process can execute newpag and thereby leave an
authentication group of which is was a member
- the kernel can return a list of PAG's in use (a la "ps") so that
processes holding resources indexed by PAGs can garbage collect
resources for PAGS that have gone away. This list will include
the pags found under "SAVED_IDS".

PAG's are different from process groups and session groups. These
change more often and are meant for job control.

History
-------

The Andrew project used PAGs for AFS authentication. They were
"hacked" in the sense that they used 2 fields in the groups array.
Root can fairly easily change fields in the group array on some
systems -- so this doesn't look so nice. I have no idea what the
second field was used for.

They called the system call "setpag", but "newpag" seems to better
convey semantics. Finally there was/is a special value of pag which
was meant to be ignored. I haven't seen the need for this.

Implementation
--------------

The simplest is to assign a PAGid just like the pid when newpag is
executed. This costs one "int" field in the process structure. The
PAG can be made increasing and will always be new. Newpag will be a
simple system call increasing a global variable maxpag and assigning
this to the PAG field in the process structure. We could use
/proc/pags to hold a list of pags.

One may argue that kernel subsystems may want to hold data related to
a PAG and that using a pointer to some kernel data structure - which
we can extend as need arises - is more efficient. The worry I have
about this is that this pointer may be re-used for a different PAG and
that it might be difficult to update all user level processing holding
data related to a PAG.

How would Coda use PAGS?
------------------------

The following discussion summarizes our ideas about using PAGs for
Coda.

When a system call reaches the Coda kernel code, Coda queries Venus
for access by giving it the PAG as part of the Coda credentials of the
process. Venus checks if it has a token for this pag and bases access
on this. To get a token a process in the same PAG would use the
"clog" (Coda login) program. This negotiates a session key with the
auth server (perhaps using Kerberos) and asks the kernel to pass Venus
the session key and PAG -- from this moment Venus associates a PAG
with a session key.

A) session keys for root

There are a few interesting issues which relate to root and PAGS.
Since PAGS are inherited by fork, it could be very dangerous for a
root process to have a session key. Imagine that root has a session
key and starts a deamon process. The deamon process would inherit the
permissions root has through it's PAG and session key and possibly
pass such permissions to any user process requesting service from the
daemon.

In contrast with this, it is highly desirable that root can start
processes which have session keys: however we don't want to give the
current PAG those session keys since that could be risky. We propose
the following solution:

1) clog will not acquire token for the root user without a further
argument.
2) clog can be given a "-e" (for execute) flag. If one were to
execute:
clog braam -e program
Clog would:
fork
in the child:
newpag
get a session key
exec(program)

If roots want a Coda authenticated shell with a key for user moose she
would execute:
clog moose -e bash

B) weaker authentication for special programs

Imagine that we are running an NFS server on machine A, and that A is
a coda client. We want this nfs server to export /coda to machine B.

We assume that the nfs server is well behaved and changes its fsuid to
that of the user on behalf of which it is servicing a request.

To make this useful we would want a user U on B to telnet to A and
create an "unsafe" session key there with "clog --unsafe U". A
session key would be given to Venus with a sloppy flag which enables
the following:

When Venus decides access permissions to serve a request coming from
the NFS server, it fails to find a PAG key for the PAG passed by the
NFS server. It continues searching for a sloppy key matching the
fsuid of the NFS server and grants permissions based on that.

- Peter Braam -

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu