1*ed4af728Sriastradh.\" $NetBSD: pam_krb5.8,v 1.13 2023/06/20 22:17:18 riastradh Exp $ 26f11bdf1Schristos.\" $FreeBSD: src/lib/libpam/modules/pam_krb5/pam_krb5.8,v 1.6 2001/11/24 23:41:32 dd Exp $ 3c2af20cfSreed.\" 4c2af20cfSreed.\" Copyright (c) Frank Cusack, 1999-2001. All rights reserved. 5c2af20cfSreed.\" 6c2af20cfSreed.\" Redistribution and use in source and binary forms, with or without 7c2af20cfSreed.\" modification, are permitted provided that the following conditions 8c2af20cfSreed.\" are met: 9c2af20cfSreed.\" 1. Redistributions of source code must retain the above copyright 10c2af20cfSreed.\" notices, and the entire permission notice in its entirety, 11c2af20cfSreed.\" including the disclaimer of warranties. 12c2af20cfSreed.\" 2. Redistributions in binary form must reproduce the above copyright 13c2af20cfSreed.\" notice, this list of conditions and the following disclaimer in the 14c2af20cfSreed.\" documentation and/or other materials provided with the distribution. 15c2af20cfSreed.\" 3. The name of the author may not be used to endorse or promote 16c2af20cfSreed.\" products derived from this software without specific prior 17c2af20cfSreed.\" written permission. 18c2af20cfSreed.\" 19c2af20cfSreed.\" ALTERNATIVELY, this product may be distributed under the terms of 20c2af20cfSreed.\" the GNU Public License, in which case the provisions of the GPL are 21c2af20cfSreed.\" required INSTEAD OF the above restrictions. (This clause is 22c2af20cfSreed.\" necessary due to a potential bad interaction between the GPL and 23c2af20cfSreed.\" the restrictions contained in a BSD-style copyright.) 24c2af20cfSreed.\" 25c2af20cfSreed.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 26c2af20cfSreed.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27c2af20cfSreed.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28c2af20cfSreed.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 29c2af20cfSreed.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30c2af20cfSreed.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31c2af20cfSreed.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32c2af20cfSreed.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33c2af20cfSreed.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34c2af20cfSreed.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 35c2af20cfSreed.\" OF THE POSSIBILITY OF SUCH DAMAGE. 36c2af20cfSreed.\" 3750873dadSchristos.Dd March 10, 2007 386f11bdf1Schristos.Dt PAM_KRB5 8 396f11bdf1Schristos.Os 406f11bdf1Schristos.Sh NAME 416f11bdf1Schristos.Nm pam_krb5 426f11bdf1Schristos.Nd Kerberos 5 PAM module 436f11bdf1Schristos.Sh SYNOPSIS 44aa2b5663Sthorpej.Op Ar service-name 45aa2b5663Sthorpej.Ar module-type 46aa2b5663Sthorpej.Ar control-flag 47aa2b5663Sthorpej.Pa pam_krb5 48aa2b5663Sthorpej.Op Ar arguments 496f11bdf1Schristos.Sh DESCRIPTION 50aa2b5663SthorpejThe Kerberos 5 service module for PAM 516f11bdf1Schristosprovides functionality for three PAM categories: 526f11bdf1Schristosauthentication, 536f11bdf1Schristosaccount management, 546f11bdf1Schristosand password management. 556f11bdf1SchristosIt also provides null functions for session management. 566f11bdf1Schristos.Ss Kerberos 5 Authentication Module 576f11bdf1SchristosThe Kerberos 5 authentication component 586f11bdf1Schristosprovides functions to verify the identity of a user 596f11bdf1Schristos.Pq Fn pam_sm_authenticate 606f11bdf1Schristosand to set user specific credentials 616f11bdf1Schristos.Pq Fn pam_sm_setcred . 626f11bdf1Schristos.Fn pam_sm_authenticate 636f11bdf1Schristosconverts the supplied username into a Kerberos principal, 646f11bdf1Schristosby appending the default local realm name. 656f11bdf1SchristosIt also supports usernames with explicit realm names. 666f11bdf1SchristosIf a realm name is supplied, then upon a successful return, it 676f11bdf1Schristoschanges the username by mapping the principal name into a local username 686f11bdf1Schristos(calling 696f11bdf1Schristos.Fn krb5_aname_to_localname ) . 706f11bdf1SchristosThis typically just means 716f11bdf1Schristosthe realm name is stripped. 726f11bdf1Schristos.Pp 736f11bdf1SchristosIt prompts the user for a password and obtains a new Kerberos TGT for 746f11bdf1Schristosthe principal. 756f11bdf1SchristosThe TGT is verified by obtaining a service 766f11bdf1Schristosticket for the local host. 776f11bdf1Schristos.Pp 786f11bdf1SchristosWhen prompting for the current password, the authentication 796f11bdf1Schristosmodule will use the prompt 8001869ca4Swiz.Dq Li "Password for <principal>:" . 816f11bdf1Schristos.Pp 826f11bdf1SchristosThe 836f11bdf1Schristos.Fn pam_sm_setcred 846f11bdf1Schristosfunction stores the newly acquired credentials in a credentials cache, 856f11bdf1Schristosand sets the environment variable 866f11bdf1Schristos.Ev KRB5CCNAME 876f11bdf1Schristosappropriately. 886f11bdf1SchristosThe credentials cache should be destroyed by the user at logout with 896f11bdf1Schristos.Xr kdestroy 1 . 906f11bdf1Schristos.Pp 916f11bdf1SchristosThe following options may be passed to the authentication module: 926f11bdf1Schristos.Bl -tag -width ".Cm use_first_pass" 936f11bdf1Schristos.It Cm debug 946f11bdf1Schristos.Xr syslog 3 956f11bdf1Schristosdebugging information at 966f11bdf1Schristos.Dv LOG_DEBUG 976f11bdf1Schristoslevel. 986f11bdf1Schristos.It Cm no_warn 996f11bdf1Schristossuppress warning messages to the user. 1006f11bdf1SchristosThese messages include 1016f11bdf1Schristosreasons why the user's 1026f11bdf1Schristosauthentication attempt was declined. 1036f11bdf1Schristos.It Cm use_first_pass 1046f11bdf1SchristosIf the authentication module is not the first in the stack, 1056f11bdf1Schristosand a previous module obtained the user's password, that password is 1066f11bdf1Schristosused to authenticate the user. 1076f11bdf1SchristosIf this fails, the authentication 1086f11bdf1Schristosmodule returns failure without prompting the user for a password. 1096f11bdf1SchristosThis option has no effect if the authentication module is 1106f11bdf1Schristosthe first in the stack, or if no previous modules obtained the 1116f11bdf1Schristosuser's password. 1126f11bdf1Schristos.It Cm try_first_pass 1136f11bdf1SchristosThis option is similar to the 1146f11bdf1Schristos.Cm use_first_pass 1156f11bdf1Schristosoption, except that if the previously obtained password fails, the 1166f11bdf1Schristosuser is prompted for another password. 11747693378Schristos.It Cm renewable Ns = Ns Ar timeperiod 1186ccceec0SchristosObtain renewable Kerberos credentials for the user. 11947693378SchristosThe renewable time can be specified, or it defaults to one month. 12047693378SchristosSince spaces are not allowed in the pam configuration time, underscores 12146b47239Swizare used to form parseable times (e.g., 1_month). 1226f11bdf1Schristos.It Cm forwardable 1236f11bdf1SchristosObtain forwardable Kerberos credentials for the user. 1246f11bdf1Schristos.It Cm no_ccache 1256f11bdf1SchristosDo not save the obtained credentials in a credentials cache. 1266f11bdf1SchristosThis is a 1276f11bdf1Schristosuseful option if the authentication module is used for services such 1286f11bdf1Schristosas ftp or pop, where the user would not be able to destroy them. 1296f11bdf1Schristos[This 1306f11bdf1Schristosis not a recommendation to use the module for those services.] 1316f11bdf1Schristos.It Cm ccache Ns = Ns Ar name 1326f11bdf1SchristosUse 1336f11bdf1Schristos.Ar name 1346f11bdf1Schristosas the credentials cache. 1356f11bdf1Schristos.Ar name 1366f11bdf1Schristosmust be in the form 1376f11bdf1Schristos.Ar type : Ns Ar residual . 1386f11bdf1SchristosThe special tokens 1396f11bdf1Schristos.Ql %u , 1406f11bdf1Schristosto designate the decimal UID of the user; 1416f11bdf1Schristosand 1426f11bdf1Schristos.Ql %p , 1436f11bdf1Schristosto designate the current process ID; can be used in 1446f11bdf1Schristos.Ar name . 145*ed4af728Sriastradh.It Cm allow_kdc_spoof 146*ed4af728SriastradhAllow 147*ed4af728Sriastradh.Nm 148*ed4af728Sriastradhto succeed even if there is no host or service key available in a 149*ed4af728Sriastradhkeytab to authenticate the Kerberos KDC's ticket. 150*ed4af728SriastradhIf there is no such key, for example on a host with no keytabs, 151*ed4af728Sriastradh.Nm 152*ed4af728Sriastradhwill fail immediately without prompting the user. 153*ed4af728Sriastradh.Pp 154*ed4af728Sriastradh.Sy Warning : 155*ed4af728SriastradhIf the host has not been configured with a keytab from the KDC, setting 156*ed4af728Sriastradhthis option makes it vulnerable to malicious KDCs, e.g. via DNS 157*ed4af728Sriastradhflooding, because 158*ed4af728Sriastradh.Nm 159*ed4af728Sriastradhhas no way to distinguish the legitimate KDC from a spoofed KDC. 1606f11bdf1Schristos.El 1616f11bdf1Schristos.Ss Kerberos 5 Account Management Module 1626f11bdf1SchristosThe Kerberos 5 account management component 1636f11bdf1Schristosprovides a function to perform account management, 1646f11bdf1Schristos.Fn pam_sm_acct_mgmt . 1656f11bdf1SchristosThe function verifies that the authenticated principal is allowed 1666f11bdf1Schristosto login to the local user account by calling 1676f11bdf1Schristos.Fn krb5_kuserok 1686f11bdf1Schristos(which checks the user's 1696f11bdf1Schristos.Pa .k5login 1706f11bdf1Schristosfile). 1716f11bdf1Schristos.Ss Kerberos 5 Password Management Module 1726f11bdf1SchristosThe Kerberos 5 password management component 1736f11bdf1Schristosprovides a function to change passwords 1746f11bdf1Schristos.Pq Fn pam_sm_chauthtok . 1756f11bdf1SchristosThe username supplied (the 1766f11bdf1Schristosuser running the 1776f11bdf1Schristos.Xr passwd 1 1786f11bdf1Schristoscommand, or the username given as an argument) is mapped into 1796f11bdf1Schristosa Kerberos principal name, using the same technique as in 1806f11bdf1Schristosthe authentication module. 1816f11bdf1SchristosNote that if a realm name was 1826f11bdf1Schristosexplicitly supplied during authentication, but not during 1836f11bdf1Schristosa password change, the mapping 1846f11bdf1Schristosdone by the password management module may not result in the 1856f11bdf1Schristossame principal as was used for authentication. 1866f11bdf1Schristos.Pp 1876f11bdf1SchristosUnlike when 1886f11bdf1Schristoschanging a 1896f11bdf1Schristos.Ux 1906f11bdf1Schristospassword, the password management module will 1916f11bdf1Schristosallow any user to change any principal's password (if the user knows 1926f11bdf1Schristosthe principal's old password, of course). 1936f11bdf1SchristosAlso unlike 1946f11bdf1Schristos.Ux , 1956f11bdf1Schristosroot 1966f11bdf1Schristosis always prompted for the principal's old password. 1976f11bdf1Schristos.Pp 1986f11bdf1SchristosThe password management module uses the same heuristics as 1996f11bdf1Schristos.Xr kpasswd 1 2006f11bdf1Schristosto determine how to contact the Kerberos password server. 2016f11bdf1Schristos.Pp 2026f11bdf1SchristosThe following options may be passed to the password management 2036f11bdf1Schristosmodule: 2046f11bdf1Schristos.Bl -tag -width ".Cm use_first_pass" 2056f11bdf1Schristos.It Cm debug 2066f11bdf1Schristos.Xr syslog 3 2076f11bdf1Schristosdebugging information at 2086f11bdf1Schristos.Dv LOG_DEBUG 2096f11bdf1Schristoslevel. 2106f11bdf1Schristos.It Cm use_first_pass 2116f11bdf1SchristosIf the password management module is not the first in the stack, 2126f11bdf1Schristosand a previous module obtained the user's old password, that password is 2136f11bdf1Schristosused to authenticate the user. 2146f11bdf1SchristosIf this fails, the password 2156f11bdf1Schristosmanagement 2166f11bdf1Schristosmodule returns failure without prompting the user for the old password. 2176f11bdf1SchristosIf successful, the new password entered to the previous module is also 2186f11bdf1Schristosused as the new Kerberos password. 2196f11bdf1SchristosIf the new password fails, 2206f11bdf1Schristosthe password management module returns failure without 2216f11bdf1Schristosprompting the user for a new password. 2226f11bdf1Schristos.It Cm try_first_pass 2236f11bdf1SchristosThis option is similar to the 2246f11bdf1Schristos.Cm use_first_pass 2256f11bdf1Schristosoption, except that if the previously obtained old or new passwords fail, 2266f11bdf1Schristosthe user is prompted for them. 2276f11bdf1Schristos.El 2286f11bdf1Schristos.Ss Kerberos 5 Session Management Module 2296f11bdf1SchristosThe Kerberos 5 session management component 2306f11bdf1Schristosprovides functions to initiate 2316f11bdf1Schristos.Pq Fn pam_sm_open_session 2326f11bdf1Schristosand terminate 2336f11bdf1Schristos.Pq Fn pam_sm_close_session 2346f11bdf1Schristossessions. 2356f11bdf1SchristosSince session management is not defined under Kerberos 5, 2366f11bdf1Schristosboth of these functions simply return success. 2376f11bdf1SchristosThey are provided 2386f11bdf1Schristosonly because of the naming conventions for PAM modules. 2396f11bdf1Schristos.Sh ENVIRONMENT 2406f11bdf1Schristos.Bl -tag -width "KRB5CCNAME" 2416f11bdf1Schristos.It Ev KRB5CCNAME 2426f11bdf1SchristosLocation of the credentials cache. 2436f11bdf1Schristos.El 2446f11bdf1Schristos.Sh FILES 2456f11bdf1Schristos.Bl -tag -width ".Pa /tmp/krb5cc_ Ns Ar uid" -compact 2466f11bdf1Schristos.It Pa /tmp/krb5cc_ Ns Ar uid 2476f11bdf1Schristosdefault credentials cache 2486f11bdf1Schristos.Ar ( uid 2496f11bdf1Schristosis the decimal UID of the user). 2506f11bdf1Schristos.It Pa $HOME/.k5login 2516f11bdf1Schristosfile containing Kerberos principals that are allowed access. 2526f11bdf1Schristos.El 2536f11bdf1Schristos.Sh SEE ALSO 2546f11bdf1Schristos.Xr kdestroy 1 , 2556f11bdf1Schristos.Xr passwd 1 , 2566f11bdf1Schristos.Xr syslog 3 , 2576f11bdf1Schristos.Xr pam.conf 5 , 2586f11bdf1Schristos.Xr pam 8 2596f11bdf1Schristos.Sh NOTES 2606f11bdf1SchristosApplications should not call 2616f11bdf1Schristos.Fn pam_authenticate 2626f11bdf1Schristosmore than once between calls to 2636f11bdf1Schristos.Fn pam_start 2646f11bdf1Schristosand 2656f11bdf1Schristos.Fn pam_end 2666f11bdf1Schristoswhen using the Kerberos 5 PAM module. 267a4e3f974Sthorpej.Sh SECURITY CONSIDERATIONS 268a4e3f974SthorpejThe 269a4e3f974Sthorpej.Nm 270a4e3f974Sthorpejmodule implements what is fundamentally a password authentication scheme. 271a4e3f974SthorpejIt does not use a Kerberos 5 exchange between client and server, but rather 272a4e3f974Sthorpejauthenticates the password provided by the client against the Kerberos KDC. 273a4e3f974SthorpejTherefore, care should be taken to only use this module over a secure session 274a4e3f974Sthorpej.Po 275a4e3f974Sthorpejsecure TTY, encrypted session, etc. 276a4e3f974Sthorpej.Pc , 277a4e3f974Sthorpejotherwise the user's Kerberos 5 password could be compromised. 278