[OpenAFS] AFS Module for Apache
Mikkel Kruse Johnsen
mikkel@linet.dk
Fri, 10 Dec 2004 16:39:55 +0100
This is a multi-part message in MIME format.
--------------070408080105070208010107
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi All
Im trying to make apache able to read AFS. I have found some examples on
the net but they are all fro apache 1.3, AFS 1.2 and Kerberos 4
I need apache 2, AFS 1.3.74 and Kerberos IV.
Using the attached module I get in /var/log/message "Dec 10 15:54:08
frodo kernel: afs: Tokens for user of AFS id 48 for cell linet.dk are
discarded (rxkad error=19270407)", which I think means bad ticket.
I don't really know what Im doing, since I havent hacked in AFS or
Kerberos's API before, so this is a learning process. But my question is:
In the examples they all copy the "v4creds.session" into
"ClearToken.HandShakeKey" but in v5creds there is no session key, I
think it is called keyblock. What is the sessionKey in Kerberos IV ?
If anyone would like to help me out coding the module I would appreciate it.
If there already is a module I would really like the link :)
/Mikkel
--------------070408080105070208010107
Content-Type: text/plain;
name="mod_afs.c"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="mod_afs.c"
LyoKICBDb3B5cmlnaHQgMjAwNCBNaWtrZWwgS3J1c2UgSm9obnNlbiwgTGluZXQgPG1pa2tl
bEBsaW5ldC5kaz4KCiAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4g
cmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKICBpdCB1bmRlciB0aGUgdGVybXMgb2Yg
dGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGFzIHB1Ymxpc2hlZCBieQogIHRoZSBG
cmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vu
c2UsIG9yCiAgKGF0IHlvdXIgb3B0aW9uKSBhbnkgbGF0ZXIgdmVyc2lvbi4KCiAgVGhpcyBw
cm9ncmFtIGlzIGRpc3RyaWJ1dGVkIGluIHRoZSB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