[OpenAFS-devel] Re: Strange behavior of tkt_MakeTicket / tkt_DecodeTicket
Remi Ferrand
remi.ferrand@cc.in2p3.fr
Thu, 26 Aug 2010 14:59:17 +0200
This is a cryptographically signed message in MIME format.
--------------ms070808020906070005070604
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Sorry for the spam fellows ...
I now understand how lifetime is retrieved using rxkad/lifetimes.h conten=
t.
I didn't take a look a life_to_time and time_to_life, for I was thinking
it was an obvious subtraction... sorry.
Have a nice day :)
R.
Le 26/08/2010 14:20, Remi Ferrand a =E9crit :
> Hye everyone,
>=20
> I'm playing around with afs libs (v 1.4.11) and I noticed a strange
> behavior when trying to forge token from scratch.
>=20
> My program is as simple as:
>=20
> * Call tkt_MakeTicket
> * Call tkt_DecodeTicket on this very token
>=20
> The ticket I forged is valid and correct, it works perfectly, excpect
> for the timestamps...
>=20
> I tried to forge a token with a lifetime of 500 seconds.
> Both startTime and endTime are of type Date (afs_uint32)
>=20
> # Time code manipulation is below:
> Date startTime, endTime;
> startTime =3D time(NULL);
> endTime =3D startTime + 500;
>=20
> I added some debug messages in rxkad/ticket.c to trace timestamps
> encoded in the token.
>=20
> Here is my output:
>=20
> [libAFS::tkt_MakeTicket] start: 1282823804
> [libAFS::tkt_MakeTicket] end: 1282824304 (OK, 500 seconds)
>=20
> [libAFS::assemble_athena_ticket] start: 1282823804
> [libAFS::assemble_athena_ticket] end: 1282824304 (OK, 500 seconds)
>=20
> // Decode token
> [libAFS::decode_athena_ticket] start: 1282823804
> [libAFS::decode_athena_ticket] end: 1282824404 (NOT OK, 600 seconds)
> [libAFS::tkt_DecodeTicket] start: 1282823804
> [libAFS::tkt_DecodeTicket] end: 1282824404 (NOT OK, 600 seconds)
>=20
> Encrypted info::
> name: admin
> instance:
> cell: test.fr
> host: 0
> startTime: 1282823804
> endTime: 1282824404
>=20
> Lifetime encrypted: 600 sec
> Lifetime clear: 500 sec
>=20
> As you can see, endTime retrieved with tkt_DecodeTicket (which calls
> decode_athena_ticket) is incorrect.
>=20
> Athena ticket only stores the token startTime and lifetime and endTime
> is deduced from those two values.
>=20
>=20
> I don't really know what's happening here, but if I tried to forge a
> token with a very large lifetime (86400 seconds for instance), i.e
>=20
> endTime =3D startTime + 86400
>=20
>=20
> [libAFS::tkt_MakeTicket] start: 1282824973
> [libAFS::tkt_MakeTicket] end: 1282911373
> [libAFS::assemble_athena_ticket] start: 1282824973
> [libAFS::assemble_athena_ticket] end: 1282911373
>=20
> [libAFS::decode_athena_ticket] start: 1282824973
> [libAFS::decode_athena_ticket] end: 1282916554
> [libAFS::tkt_DecodeTicket] start: 1282824973
> [libAFS::tkt_DecodeTicket] end: 1282916554
>=20
> Encrypted info::
> name: admin
> instance:
> cell: test.fr
> host: 0
> startTime: 1282824973
> endTime: 1282916554
>=20
> Lifetime encrypted: 91581 sec
> Lifetime clear: 86400 sec
>=20
> The gap between real lifetime (clear one before token is dropped from
> token cache) and encrypted lifetime increases.
>=20
>=20
> This is very very strange and I'm totally lost here...
>=20
> Note: When running tkt_DecodeTicket on a token obtained from "klog",
> encrypted and clear lifetime match.
>=20
> Has anyone already have this problem ?
> Where am I wrong ?
>=20
> If you need my code, I can send it to you, just ask :)
>=20
> Thanks in advance.
>=20
> R.
>=20
--=20
Remi Ferrand | Institut National de Physique Nucleaire
Tel. +33(0)4.78.93.08.80 | et de Physique des Particules
Fax. +33(0)4.72.69.41.70 | Centre de Calcul - http://cc.in2p3.fr/
--------------ms070808020906070005070604
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature
MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIM2zCC
A20wggJVoAMCAQICAQIwDQYJKoZIhvcNAQEEBQAwKzELMAkGA1UEBhMCRlIxDTALBgNVBAoT
BENOUlMxDTALBgNVBAMTBENOUlMwHhcN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