On Mar 17, 2006, at 7:33 PM, Jeffrey Altman wrote:

I am cc'ing the [email protected] mailing list because this is
really an OpenAFS discussion.  [EMAIL PROTECTED] is meant to be a mailing
list focused on development of the MIT Kerberos reference implementation.

The fundamental issue being discussed here is whether the Kerberos.App
display of the Kerberos Credential Cache contents can be used as an
indication by end users that the AFS kernel module contains tokens for
that user.  Hank is claiming that presence of an "afs/[EMAIL PROTECTED]"
service ticket in the credential cache is an indicator that there are
AFS tokens installed in the AFS kernel module.

I believe that end users should be discouraged from checking the
Kerberos credential cache to see if they have AFS tokens because doing
so is fundamentally flawed.  There are many reasons why tokens might be
removed from the AFS kernel after their initial installation let alone
reasons why tokens might not be able to be stored in the first place.
Therefore, using the Kerberos credential cache as a replacement for the
"tokens" command or a GUI token display will only make the lives of end
users and those that support them more difficult.

If there is a concern that the presence of the AFS service ticket will
be misinterpreted as meaning that tokens are present then perhaps the
thing to do is modify aklog and anything that derives from its code base
to not use the default credential cache and instead use a local memory
cache.  We could make this the default behavior and allow the default
credential cache be used when "-d" is specified on the command line to
allow the presence of the service tickets to be used for debugging purposes.

One other place that the credential cache and the AFS token get out of sync is when trying to renew the TGT.  Renewal of the TGT and AFS token is a whole subject on its own, but suffice it to say that running "kinit -R" will renew the TGT, but remove the AFS service ticket, while the AFS token remains unchanged.

While not part of the same topic, Derrick Brashear spent time this week
attempting to prepare a KFM KLL plug-in for aklog that would work on
Tiger and discovered that under Tiger we will not be able to provide
such functionality.   We will work with Apple to try to make this happen
in a future release.  For those who are unaware, the KFM KLL plug-ins
have been used in previous releases of MacOS X to allow the Kerberos
initial ticket getting functionality to be extended such that whenever a
new Kerberos 5 Initial Ticket is obtained a new AFS token would be
acquired at the same time.  Without this functionality it is not
possible to provide a single sign-on experience for AFS on Tiger.

(Remember, I'm just a developer who happens to work at Apple; I don't speak for Apple.)

It turns out I was working this week on something similar, a PAM module for aklog.  This is still highly experimental, but I have modified aklog to be more reentrant and embeddible, by converting all the global variables into fields of a structure.  I have add an additional routine that allocates such a structure, which is then passed to the aklog() routine.  So now, the main() routine of the aklog program calls alloc_aklog_globals() to get a block of memory, and passes that to the aklog() routine with the arguments.

The PAM modules does the same thing.  There are some differences that are taken care of with a macro definition, like the fact that argv[0] is the name of the aklog program, but is the first real argument from the PAM modules.  Also, the aklog program exits on error; the PAM modules does a longjmp back to the aklog() routine to do an error return (because there is no exit, there might be some memory leaks or other cleanup that will need to be done).

Creating a loadable PAM module did present some problem.  The LWP code uses assembly language (process.s for ppc and process.i386.s for x86), but that code references a global variable in way that would require a writable text segment.  So I added the usual assembly goop to move the relocation info to a data segment.  (I had tried to replace LWP with the pthread code, but was running into a bunch of undefined symbol problems, so I fell back to LWP.  I did notice four places that allocate pthread mutexes but don't initialize with PTHREAD_MUTEX_INITIALIZER as per POSIX, and would have made a difference on Mac OS X, since when uninitialized, it would reside in common segment, which is not allowed for a bundle.  Initializing it moves it into a data segment.)

So I finally created the PAM module, which only does session open and close.  The open calls aklog to create the token.  The close does the equivalent of unlog, but I then commented that out, since I can imagine being logging into the GUI, when an ssh session comes in, renews the AFS token and then removes it on logout, leaving the GUI without a token.  Some mechanism for the last-one-out removing the token is needed.

So fine, I have a PAM module, but so what?  Well, I also wrote a loginwindow "LoginHook", that is called loginwindow_pam_helper.  It gets run when loginwindow finishes authenticating (presuming /etc/authorization is set up to do Kerberos authentication).  It then does the usual PAM stuff to open a session and I set up the PAM config file to call my pam_aklog module.  In loginwindow_pam_helper, I use a kqueue to monitor when loginwindow terminates (usually when the user logs out, or if loginwindow dies) and then close the session.

Well, this actually all works!  I log in, and my AFS tokens are there.  I can even set up a .xlog file and get tokens for multiple cells.

Now I'm not saying this is the best approach.  My thinking was that a PAM module would be useful for other Unix platforms as well, but doesn't really fit in so nicely in Mac OS X.  The KFM might be a little cleaner, though Mac OS X specific.  But it might be possible to get loginwindow to do PAM directly, so my loginwindow_pam_helper wouldn't be needed anymore, and then the PAM module might fit in better (of course, I'm not on the loginwindow team, so I can't say they will make this change).

Mac OS X also has it's own way of doing things, like the Authorization Services framework.  Now I'm a Unix guy, so the Authorization Services framework is new to me.  But it might also be feasible to put in aklog as a plug-in.  Then loginwindow could get to aklog through Authorization Services, and since there is already a pam_securityserver.so module that calls into the Authorization Services framework, things like ssh might also be able to get to aklog.  Again this is Mac OS specific, but could be the cleanest way for both Mac OS X applications and command-line programs to get aklog access.  And since aklog is embeddable, we could build the aklog program, the aklog PAM module, the aklog Authorization plug-in and possibly even the KFM KLL plug-in, all using the same base code.

Anyways, Derrick, let me know if I can be of help with the KFM KLL plug-in (which is something else I don't know much about).

--------------------------------------------------------------------------

Edward Moy

Apple


Reply via email to