Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically clear the Kerberos ticket cache

Does anyone know how to clear out the Kerberos ticket cache on the local computer - using managed \ unmanaegd code?

Thanks in advance!

like image 916
rkellerm Avatar asked Feb 15 '10 14:02

rkellerm


People also ask

What is the command to destroy the Kerberos ticket?

To destroy your tickets, use the kdestroy command. % /usr/bin/kdestroy. The kdestroy command destroys all your tickets.

Where are Kerberos tickets cached?

The file is located in the c:\windows\temp directory by default. WARNING: This script is simply a wrapper for the included OS tool Klist.exe. The script simply loops through each known SessionID and attempts to dump the Kerberos cache from that session.

What is Klist purge command?

purge - Allows you to delete a specific ticket. Purging tickets destroys all tickets that you have cached, so use this attribute with caution. It might stop you from being able to authenticate to resources. If this happens, you'll have to log off and log on again.


2 Answers

I believe you need to do a call to LsaCallAuthenticationPackage using KERB_PURGE_TKT_CACHE_REQUEST after using either LsaConnectUntrusted or LsaRegisterLogonProcess. Sorry no specifics, but I don't have my code for this around...

like image 177
Christopher G. Lewis Avatar answered Nov 12 '22 11:11

Christopher G. Lewis


The most simple way is to take the source code of Microsoft's KList (Included in the platform SDK\ Samples), and to do like them...

like image 45
rkellerm Avatar answered Nov 12 '22 11:11

rkellerm