184d6cd8eSMark Murray.\" 284d6cd8eSMark Murray.\" $Id: pam_krb5.5,v 1.5 2000/01/05 00:59:56 fcusack Exp $ 3f93beda9SXin LI.Dd May 3, 2010 488de1238SRuslan Ermilov.Dt PAM_KRB5 8 588de1238SRuslan Ermilov.Os 68b136a6dSChris Costello.Sh NAME 78b136a6dSChris Costello.Nm pam_krb5 88b136a6dSChris Costello.Nd Kerberos 5 PAM module 98b136a6dSChris Costello.Sh SYNOPSIS 108b136a6dSChris Costello.Pa /usr/lib/pam_krb5.so 118b136a6dSChris Costello.Sh DESCRIPTION 1284d6cd8eSMark MurrayThe Kerberos 5 service module for PAM, typically 138b136a6dSChris Costello.Pa /usr/lib/pam_krb5.so , 1484d6cd8eSMark Murrayprovides functionality for three PAM categories: 1584d6cd8eSMark Murrayauthentication, 1684d6cd8eSMark Murrayaccount management, 1784d6cd8eSMark Murrayand password management. 1884d6cd8eSMark MurrayIt also provides null functions for session management. 1984d6cd8eSMark MurrayThe 208b136a6dSChris Costello.Pa pam_krb5.so 2184d6cd8eSMark Murraymodule is a shared object 2284d6cd8eSMark Murraythat can be dynamically loaded to provide 2384d6cd8eSMark Murraythe necessary functionality upon demand. 2484d6cd8eSMark MurrayIts path is specified in the 258b136a6dSChris CostelloPAM configuration file. 268b136a6dSChris Costello.Ss Kerberos 5 Authentication Module 2784d6cd8eSMark MurrayThe Kerberos 5 authentication component 288b136a6dSChris Costelloprovides functions to verify the identity of a user 298b136a6dSChris Costello.Pq Fn pam_sm_authenticate 3084d6cd8eSMark Murrayand to set user specific credentials 318b136a6dSChris Costello.Pq Fn pam_sm_setcred . 328b136a6dSChris Costello.Fn pam_sm_authenticate 3384d6cd8eSMark Murrayconverts the supplied username into a Kerberos principal, 3484d6cd8eSMark Murrayby appending the default local realm name. 3584d6cd8eSMark MurrayIt also supports usernames with explicit realm names. 36a48060a2SDima DorfmanIf a realm name is supplied, then upon a successful return, it 3784d6cd8eSMark Murraychanges the username by mapping the principal name into a local username 388b136a6dSChris Costello(calling 3988de1238SRuslan Ermilov.Fn krb5_aname_to_localname ) . 408b136a6dSChris CostelloThis typically just means 4184d6cd8eSMark Murraythe realm name is stripped. 428b136a6dSChris Costello.Pp 4384d6cd8eSMark MurrayIt prompts the user for a password and obtains a new Kerberos TGT for 4488de1238SRuslan Ermilovthe principal. 4588de1238SRuslan ErmilovThe TGT is verified by obtaining a service 4684d6cd8eSMark Murrayticket for the local host. 478b136a6dSChris Costello.Pp 4884d6cd8eSMark MurrayWhen prompting for the current password, the authentication 498b136a6dSChris Costellomodule will use the prompt 5088de1238SRuslan Ermilov.Dq Li "Password for <principal>:" . 518b136a6dSChris Costello.Pp 5284d6cd8eSMark MurrayThe 538b136a6dSChris Costello.Fn pam_sm_setcred 5484d6cd8eSMark Murrayfunction stores the newly acquired credentials in a credentials cache, 5584d6cd8eSMark Murrayand sets the environment variable 568b136a6dSChris Costello.Ev KRB5CCNAME 5784d6cd8eSMark Murrayappropriately. 5884d6cd8eSMark MurrayThe credentials cache should be destroyed by the user at logout with 598b136a6dSChris Costello.Xr kdestroy 1 . 608b136a6dSChris Costello.Pp 6184d6cd8eSMark MurrayThe following options may be passed to the authentication module: 62e8b02a42SRuslan Ermilov.Bl -tag -width ".Cm use_first_pass" 6388de1238SRuslan Ermilov.It Cm debug 648b136a6dSChris Costello.Xr syslog 3 6584d6cd8eSMark Murraydebugging information at 668b136a6dSChris Costello.Dv LOG_DEBUG 6784d6cd8eSMark Murraylevel. 68ca0bdcddSMark Murray.It Cm no_warn 69ca0bdcddSMark Murraysuppress warning messages to the user. 70ca0bdcddSMark MurrayThese messages include 71ca0bdcddSMark Murrayreasons why the user's 72ca0bdcddSMark Murrayauthentication attempt was declined. 7388de1238SRuslan Ermilov.It Cm use_first_pass 7484d6cd8eSMark MurrayIf the authentication module is not the first in the stack, 7584d6cd8eSMark Murrayand a previous module obtained the user's password, that password is 7688de1238SRuslan Ermilovused to authenticate the user. 7788de1238SRuslan ErmilovIf this fails, the authentication 7884d6cd8eSMark Murraymodule returns failure without prompting the user for a password. 7984d6cd8eSMark MurrayThis option has no effect if the authentication module is 8084d6cd8eSMark Murraythe first in the stack, or if no previous modules obtained the 8184d6cd8eSMark Murrayuser's password. 8288de1238SRuslan Ermilov.It Cm try_first_pass 8384d6cd8eSMark MurrayThis option is similar to the 8488de1238SRuslan Ermilov.Cm use_first_pass 8584d6cd8eSMark Murrayoption, except that if the previously obtained password fails, the 8684d6cd8eSMark Murrayuser is prompted for another password. 8788de1238SRuslan Ermilov.It Cm forwardable 8884d6cd8eSMark MurrayObtain forwardable Kerberos credentials for the user. 8988de1238SRuslan Ermilov.It Cm no_ccache 9088de1238SRuslan ErmilovDo not save the obtained credentials in a credentials cache. 9188de1238SRuslan ErmilovThis is a 9284d6cd8eSMark Murrayuseful option if the authentication module is used for services such 9388de1238SRuslan Ermilovas ftp or pop, where the user would not be able to destroy them. 9488de1238SRuslan Ermilov[This 9584d6cd8eSMark Murrayis not a recommendation to use the module for those services.] 9688de1238SRuslan Ermilov.It Cm ccache Ns = Ns Ar name 9788de1238SRuslan ErmilovUse 9888de1238SRuslan Ermilov.Ar name 9988de1238SRuslan Ermilovas the credentials cache. 10088de1238SRuslan Ermilov.Ar name 10188de1238SRuslan Ermilovmust be in the form 10288de1238SRuslan Ermilov.Ar type : Ns Ar residual . 10384d6cd8eSMark MurrayThe special tokens 10488de1238SRuslan Ermilov.Ql %u , 10588de1238SRuslan Ermilovto designate the decimal UID of the user; 10684d6cd8eSMark Murrayand 10788de1238SRuslan Ermilov.Ql %p , 10888de1238SRuslan Ermilovto designate the current process ID; can be used in 10988de1238SRuslan Ermilov.Ar name . 110813847e4SCy Schubert.It Cm allow_kdc_spoof 111813847e4SCy SchubertAllow 112813847e4SCy Schubert.Nm 113813847e4SCy Schubertto succeed even if there is no host or service key available in a 114813847e4SCy Schubertkeytab to authenticate the Kerberos KDC's ticket. 115813847e4SCy SchubertIf there is no such key, for example on a host with no keytabs, 116813847e4SCy Schubert.Nm 117813847e4SCy Schubertwill fail immediately without prompting the user. 118813847e4SCy Schubert.Pp 119813847e4SCy Schubert.Sy Warning : 120813847e4SCy SchubertIf the host has not been configured with a keytab from the KDC, setting 121813847e4SCy Schubertthis option makes it vulnerable to malicious KDCs, e.g. via DNS 122813847e4SCy Schubertflooding, because 123813847e4SCy Schubert.Nm 124813847e4SCy Schuberthas no way to distinguish the legitimate KDC from a spoofed KDC. 125551e75c7SMartin Matuska.It Cm no_user_check 126551e75c7SMartin MatuskaDo not verify if a user exists on the local system. This option implies the 127551e75c7SMartin Matuska.Cm no_ccache 128551e75c7SMartin Matuskaoption because there is no secure local uid/gid for the cache file. 1298b136a6dSChris Costello.El 1308b136a6dSChris Costello.Ss Kerberos 5 Account Management Module 13184d6cd8eSMark MurrayThe Kerberos 5 account management component 13284d6cd8eSMark Murrayprovides a function to perform account management, 1338b136a6dSChris Costello.Fn pam_sm_acct_mgmt . 13484d6cd8eSMark MurrayThe function verifies that the authenticated principal is allowed 13584d6cd8eSMark Murrayto login to the local user account by calling 1368b136a6dSChris Costello.Fn krb5_kuserok 13788de1238SRuslan Ermilov(which checks the user's 13888de1238SRuslan Ermilov.Pa .k5login 13988de1238SRuslan Ermilovfile). 1408b136a6dSChris Costello.Ss Kerberos 5 Password Management Module 14184d6cd8eSMark MurrayThe Kerberos 5 password management component 14284d6cd8eSMark Murrayprovides a function to change passwords 1438b136a6dSChris Costello.Pq Fn pam_sm_chauthtok . 1448b136a6dSChris CostelloThe username supplied (the 14584d6cd8eSMark Murrayuser running the 1468b136a6dSChris Costello.Xr passwd 1 14784d6cd8eSMark Murraycommand, or the username given as an argument) is mapped into 14884d6cd8eSMark Murraya Kerberos principal name, using the same technique as in 14988de1238SRuslan Ermilovthe authentication module. 15088de1238SRuslan ErmilovNote that if a realm name was 15184d6cd8eSMark Murrayexplicitly supplied during authentication, but not during 15284d6cd8eSMark Murraya password change, the mapping 15384d6cd8eSMark Murraydone by the password management module may not result in the 15484d6cd8eSMark Murraysame principal as was used for authentication. 1558b136a6dSChris Costello.Pp 15684d6cd8eSMark MurrayUnlike when 15788de1238SRuslan Ermilovchanging a 15888de1238SRuslan Ermilov.Ux 15988de1238SRuslan Ermilovpassword, the password management module will 16084d6cd8eSMark Murrayallow any user to change any principal's password (if the user knows 16188de1238SRuslan Ermilovthe principal's old password, of course). 16288de1238SRuslan ErmilovAlso unlike 16388de1238SRuslan Ermilov.Ux , 16488de1238SRuslan Ermilovroot 16584d6cd8eSMark Murrayis always prompted for the principal's old password. 1668b136a6dSChris Costello.Pp 16784d6cd8eSMark MurrayThe password management module uses the same heuristics as 1688b136a6dSChris Costello.Xr kpasswd 1 16984d6cd8eSMark Murrayto determine how to contact the Kerberos password server. 1708b136a6dSChris Costello.Pp 17184d6cd8eSMark MurrayThe following options may be passed to the password management 17284d6cd8eSMark Murraymodule: 173e8b02a42SRuslan Ermilov.Bl -tag -width ".Cm use_first_pass" 17488de1238SRuslan Ermilov.It Cm debug 17588de1238SRuslan Ermilov.Xr syslog 3 17684d6cd8eSMark Murraydebugging information at 1778b136a6dSChris Costello.Dv LOG_DEBUG 17884d6cd8eSMark Murraylevel. 17988de1238SRuslan Ermilov.It Cm use_first_pass 18084d6cd8eSMark MurrayIf the password management module is not the first in the stack, 18184d6cd8eSMark Murrayand a previous module obtained the user's old password, that password is 18288de1238SRuslan Ermilovused to authenticate the user. 18388de1238SRuslan ErmilovIf this fails, the password 18484d6cd8eSMark Murraymanagement 18584d6cd8eSMark Murraymodule returns failure without prompting the user for the old password. 18684d6cd8eSMark MurrayIf successful, the new password entered to the previous module is also 18788de1238SRuslan Ermilovused as the new Kerberos password. 18888de1238SRuslan ErmilovIf the new password fails, 18984d6cd8eSMark Murraythe password management module returns failure without 19084d6cd8eSMark Murrayprompting the user for a new password. 19188de1238SRuslan Ermilov.It Cm try_first_pass 19284d6cd8eSMark MurrayThis option is similar to the 19388de1238SRuslan Ermilov.Cm use_first_pass 19484d6cd8eSMark Murrayoption, except that if the previously obtained old or new passwords fail, 19584d6cd8eSMark Murraythe user is prompted for them. 1968b136a6dSChris Costello.El 1978b136a6dSChris Costello.Ss Kerberos 5 Session Management Module 19884d6cd8eSMark MurrayThe Kerberos 5 session management component 19984d6cd8eSMark Murrayprovides functions to initiate 2008b136a6dSChris Costello.Pq Fn pam_sm_open_session 20184d6cd8eSMark Murrayand terminate 2028b136a6dSChris Costello.Pq Fn pam_sm_close_session 20388de1238SRuslan Ermilovsessions. 20488de1238SRuslan ErmilovSince session management is not defined under Kerberos 5, 20588de1238SRuslan Ermilovboth of these functions simply return success. 20688de1238SRuslan ErmilovThey are provided 20784d6cd8eSMark Murrayonly because of the naming conventions for PAM modules. 2088b136a6dSChris Costello.Sh ENVIRONMENT 2098b136a6dSChris Costello.Bl -tag -width "KRB5CCNAME" 2108b136a6dSChris Costello.It Ev KRB5CCNAME 21184d6cd8eSMark MurrayLocation of the credentials cache. 2128b136a6dSChris Costello.El 2138b136a6dSChris Costello.Sh FILES 214e8b02a42SRuslan Ermilov.Bl -tag -width ".Pa /tmp/krb5cc_ Ns Ar uid" -compact 21588de1238SRuslan Ermilov.It Pa /tmp/krb5cc_ Ns Ar uid 21688de1238SRuslan Ermilovdefault credentials cache 21788de1238SRuslan Ermilov.Ar ( uid 21888de1238SRuslan Ermilovis the decimal UID of the user). 2198b136a6dSChris Costello.It Pa $HOME/.k5login 22084d6cd8eSMark Murrayfile containing Kerberos principals that are allowed access. 2218b136a6dSChris Costello.El 2228b136a6dSChris Costello.Sh SEE ALSO 2238b136a6dSChris Costello.Xr kdestroy 1 , 2248b136a6dSChris Costello.Xr passwd 1 , 225*6e1fc011SGraham Percival.Xr pam 3 , 2268b136a6dSChris Costello.Xr syslog 3 , 227*6e1fc011SGraham Percival.Xr pam.conf 5 2288b136a6dSChris Costello.Sh NOTES 22984d6cd8eSMark MurrayApplications should not call 2308b136a6dSChris Costello.Fn pam_authenticate 23184d6cd8eSMark Murraymore than once between calls to 2328b136a6dSChris Costello.Fn pam_start 23384d6cd8eSMark Murrayand 2348b136a6dSChris Costello.Fn pam_end 23584d6cd8eSMark Murraywhen using the Kerberos 5 PAM module. 236