xref: /netbsd-src/external/bsd/openpam/dist/doc/man/pam.3 (revision 0d9d0fd8a30be9a1924e715bbcf67a4a83efd262)
1*0d9d0fd8Schristos.\"	$NetBSD: pam.3,v 1.12 2023/06/30 21:46:20 christos Exp $
244269bb5Schristos.\"
38fa0fefeSchristos.\" Generated by gendoc.pl
4*0d9d0fd8Schristos.Dd June 27, 2023
544269bb5Schristos.Dt PAM 3
644269bb5Schristos.Os
744269bb5Schristos.Sh NAME
84cb4af11Schristos.Nm pam_acct_mgmt ,
94cb4af11Schristos.Nm pam_authenticate ,
104cb4af11Schristos.Nm pam_chauthtok ,
114cb4af11Schristos.Nm pam_close_session ,
124cb4af11Schristos.Nm pam_end ,
134cb4af11Schristos.Nm pam_get_data ,
144cb4af11Schristos.Nm pam_get_item ,
154cb4af11Schristos.Nm pam_get_user ,
164cb4af11Schristos.Nm pam_getenv ,
174cb4af11Schristos.Nm pam_getenvlist ,
184cb4af11Schristos.Nm pam_open_session ,
194cb4af11Schristos.Nm pam_putenv ,
204cb4af11Schristos.Nm pam_set_data ,
214cb4af11Schristos.Nm pam_set_item ,
224cb4af11Schristos.Nm pam_setcred ,
234cb4af11Schristos.Nm pam_start ,
244cb4af11Schristos.Nm pam_strerror
2544269bb5Schristos.Nd Pluggable Authentication Modules Library
2644269bb5Schristos.Sh LIBRARY
2744269bb5Schristos.Lb libpam
2844269bb5Schristos.Sh SYNOPSIS
2944269bb5Schristos.In security/pam_appl.h
304cb4af11Schristos.Ft "int"
314cb4af11Schristos.Fn pam_acct_mgmt "pam_handle_t *pamh" "int flags"
324cb4af11Schristos.Ft "int"
334cb4af11Schristos.Fn pam_authenticate "pam_handle_t *pamh" "int flags"
344cb4af11Schristos.Ft "int"
354cb4af11Schristos.Fn pam_chauthtok "pam_handle_t *pamh" "int flags"
364cb4af11Schristos.Ft "int"
374cb4af11Schristos.Fn pam_close_session "pam_handle_t *pamh" "int flags"
384cb4af11Schristos.Ft "int"
394cb4af11Schristos.Fn pam_end "pam_handle_t *pamh" "int status"
404cb4af11Schristos.Ft "int"
414cb4af11Schristos.Fn pam_get_data "const pam_handle_t *pamh" "const char *module_data_name" "const void **data"
424cb4af11Schristos.Ft "int"
434cb4af11Schristos.Fn pam_get_item "const pam_handle_t *pamh" "int item_type" "const void **item"
444cb4af11Schristos.Ft "int"
454cb4af11Schristos.Fn pam_get_user "pam_handle_t *pamh" "const char **user" "const char *prompt"
464cb4af11Schristos.Ft "const char *"
474cb4af11Schristos.Fn pam_getenv "pam_handle_t *pamh" "const char *name"
484cb4af11Schristos.Ft "char **"
494cb4af11Schristos.Fn pam_getenvlist "pam_handle_t *pamh"
504cb4af11Schristos.Ft "int"
514cb4af11Schristos.Fn pam_open_session "pam_handle_t *pamh" "int flags"
524cb4af11Schristos.Ft "int"
534cb4af11Schristos.Fn pam_putenv "pam_handle_t *pamh" "const char *namevalue"
544cb4af11Schristos.Ft "int"
554cb4af11Schristos.Fn pam_set_data "pam_handle_t *pamh" "const char *module_data_name" "void *data" "void (*cleanup)(pam_handle_t *pamh, void *data, int pam_end_status)"
564cb4af11Schristos.Ft "int"
574cb4af11Schristos.Fn pam_set_item "pam_handle_t *pamh" "int item_type" "const void *item"
584cb4af11Schristos.Ft "int"
594cb4af11Schristos.Fn pam_setcred "pam_handle_t *pamh" "int flags"
604cb4af11Schristos.Ft "int"
614cb4af11Schristos.Fn pam_start "const char *service" "const char *user" "const struct pam_conv *pam_conv" "pam_handle_t **pamh"
624cb4af11Schristos.Ft "const char *"
634cb4af11Schristos.Fn pam_strerror "const pam_handle_t *pamh" "int error_number"
6444269bb5Schristos.Sh DESCRIPTION
6544269bb5SchristosThe Pluggable Authentication Modules (PAM) library abstracts a number
6644269bb5Schristosof common authentication-related operations and provides a framework
6744269bb5Schristosfor dynamically loaded modules that implement these operations in
6844269bb5Schristosvarious ways.
6944269bb5Schristos.Ss Terminology
7044269bb5SchristosIn PAM parlance, the application that uses PAM to authenticate a user
7144269bb5Schristosis the server, and is identified for configuration purposes by a
7244269bb5Schristosservice name, which is often (but not necessarily) the program name.
7344269bb5Schristos.Pp
7444269bb5SchristosThe user requesting authentication is called the applicant, while the
7544269bb5Schristosuser (usually, root) charged with verifying his identity and granting
7644269bb5Schristoshim the requested credentials is called the arbitrator.
7744269bb5Schristos.Pp
7844269bb5SchristosThe sequence of operations the server goes through to authenticate a
7944269bb5Schristosuser and perform whatever task he requested is a PAM transaction; the
8044269bb5Schristoscontext within which the server performs the requested task is called
8144269bb5Schristosa session.
8244269bb5Schristos.Pp
8344269bb5SchristosThe functionality embodied by PAM is divided into six primitives
8444269bb5Schristosgrouped into four facilities: authentication, account management,
8544269bb5Schristossession management and password management.
8644269bb5Schristos.Ss Conversation
8744269bb5SchristosThe PAM library expects the application to provide a conversation
8844269bb5Schristoscallback which it can use to communicate with the user.
8944269bb5SchristosSome modules may use specialized conversation functions to communicate
9044269bb5Schristoswith special hardware such as cryptographic dongles or biometric
9144269bb5Schristosdevices.
9244269bb5SchristosSee
9344269bb5Schristos.Xr pam_conv 3
9444269bb5Schristosfor details.
9544269bb5Schristos.Ss Initialization and Cleanup
9644269bb5SchristosThe
9744269bb5Schristos.Fn pam_start
9844269bb5Schristosfunction initializes the PAM library and returns a handle which must
9944269bb5Schristosbe provided in all subsequent function calls.
10044269bb5SchristosThe transaction state is contained entirely within the structure
10144269bb5Schristosidentified by this handle, so it is possible to conduct multiple
10244269bb5Schristostransactions in parallel.
10344269bb5Schristos.Pp
10444269bb5SchristosThe
10544269bb5Schristos.Fn pam_end
10644269bb5Schristosfunction releases all resources associated with the specified context,
10744269bb5Schristosand can be called at any time to terminate a PAM transaction.
10844269bb5Schristos.Ss Storage
10944269bb5SchristosThe
11044269bb5Schristos.Fn pam_set_item
11144269bb5Schristosand
11244269bb5Schristos.Fn pam_get_item
11344269bb5Schristosfunctions set and retrieve a number of predefined items, including the
11444269bb5Schristosservice name, the names of the requesting and target users, the
11544269bb5Schristosconversation function, and prompts.
11644269bb5Schristos.Pp
11744269bb5SchristosThe
11844269bb5Schristos.Fn pam_set_data
11944269bb5Schristosand
12044269bb5Schristos.Fn pam_get_data
12144269bb5Schristosfunctions manage named chunks of free-form data, generally used by
12244269bb5Schristosmodules to store state from one invocation to another.
12344269bb5Schristos.Ss Authentication
12444269bb5SchristosThere are two authentication primitives:
12544269bb5Schristos.Fn pam_authenticate
12644269bb5Schristosand
12744269bb5Schristos.Fn pam_setcred .
12844269bb5SchristosThe former authenticates the user, while the latter manages his
12944269bb5Schristoscredentials.
13044269bb5Schristos.Ss Account Management
13144269bb5SchristosThe
13244269bb5Schristos.Fn pam_acct_mgmt
13344269bb5Schristosfunction enforces policies such as password expiry, account expiry,
13444269bb5Schristostime-of-day restrictions, and so forth.
13544269bb5Schristos.Ss Session Management
13644269bb5SchristosThe
13744269bb5Schristos.Fn pam_open_session
13844269bb5Schristosand
13944269bb5Schristos.Fn pam_close_session
14044269bb5Schristosfunctions handle session setup and teardown.
14144269bb5Schristos.Ss Password Management
14244269bb5SchristosThe
14344269bb5Schristos.Fn pam_chauthtok
14444269bb5Schristosfunction allows the server to change the user's password, either at
14544269bb5Schristosthe user's request or because the password has expired.
14644269bb5Schristos.Ss Miscellaneous
14744269bb5SchristosThe
14844269bb5Schristos.Fn pam_putenv ,
14944269bb5Schristos.Fn pam_getenv
15044269bb5Schristosand
15144269bb5Schristos.Fn pam_getenvlist
15244269bb5Schristosfunctions manage a private environment list in which modules can set
15344269bb5Schristosenvironment variables they want the server to export during the
15444269bb5Schristossession.
15544269bb5Schristos.Pp
15644269bb5SchristosThe
15744269bb5Schristos.Fn pam_strerror
15844269bb5Schristosfunction returns a pointer to a string describing the specified PAM
15944269bb5Schristoserror code.
16044269bb5Schristos.Sh RETURN VALUES
16144269bb5SchristosThe following return codes are defined by
16244269bb5Schristos.In security/pam_constants.h :
16344269bb5Schristos.Bl -tag -width 18n
16444269bb5Schristos.It Bq Er PAM_ABORT
16544269bb5SchristosGeneral failure.
16644269bb5Schristos.It Bq Er PAM_ACCT_EXPIRED
16744269bb5SchristosUser account has expired.
16844269bb5Schristos.It Bq Er PAM_AUTHINFO_UNAVAIL
16944269bb5SchristosAuthentication information is unavailable.
17044269bb5Schristos.It Bq Er PAM_AUTHTOK_DISABLE_AGING
17144269bb5SchristosAuthentication token aging disabled.
17244269bb5Schristos.It Bq Er PAM_AUTHTOK_ERR
17344269bb5SchristosAuthentication token failure.
17444269bb5Schristos.It Bq Er PAM_AUTHTOK_EXPIRED
17544269bb5SchristosPassword has expired.
17644269bb5Schristos.It Bq Er PAM_AUTHTOK_LOCK_BUSY
17744269bb5SchristosAuthentication token lock busy.
17844269bb5Schristos.It Bq Er PAM_AUTHTOK_RECOVERY_ERR
17944269bb5SchristosFailed to recover old authentication token.
18044269bb5Schristos.It Bq Er PAM_AUTH_ERR
18144269bb5SchristosAuthentication error.
1824cb4af11Schristos.It Bq Er PAM_BAD_CONSTANT
1834cb4af11SchristosBad constant.
1844cb4af11Schristos.It Bq Er PAM_BAD_FEATURE
1854cb4af11SchristosUnrecognized or restricted feature.
1864cb4af11Schristos.It Bq Er PAM_BAD_HANDLE
1874cb4af11SchristosInvalid PAM handle.
1884cb4af11Schristos.It Bq Er PAM_BAD_ITEM
1894cb4af11SchristosUnrecognized or restricted item.
19044269bb5Schristos.It Bq Er PAM_BUF_ERR
19144269bb5SchristosMemory buffer error.
19244269bb5Schristos.It Bq Er PAM_CONV_ERR
19344269bb5SchristosConversation failure.
19444269bb5Schristos.It Bq Er PAM_CRED_ERR
19544269bb5SchristosFailed to set user credentials.
19644269bb5Schristos.It Bq Er PAM_CRED_EXPIRED
19744269bb5SchristosUser credentials have expired.
19844269bb5Schristos.It Bq Er PAM_CRED_INSUFFICIENT
19944269bb5SchristosInsufficient credentials.
20044269bb5Schristos.It Bq Er PAM_CRED_UNAVAIL
20144269bb5SchristosFailed to retrieve user credentials.
20244269bb5Schristos.It Bq Er PAM_DOMAIN_UNKNOWN
20344269bb5SchristosUnknown authentication domain.
20444269bb5Schristos.It Bq Er PAM_IGNORE
20544269bb5SchristosIgnore this module.
20644269bb5Schristos.It Bq Er PAM_MAXTRIES
20744269bb5SchristosMaximum number of tries exceeded.
20844269bb5Schristos.It Bq Er PAM_MODULE_UNKNOWN
20944269bb5SchristosUnknown module type.
21044269bb5Schristos.It Bq Er PAM_NEW_AUTHTOK_REQD
21144269bb5SchristosNew authentication token required.
21244269bb5Schristos.It Bq Er PAM_NO_MODULE_DATA
21344269bb5SchristosModule data not found.
21444269bb5Schristos.It Bq Er PAM_OPEN_ERR
21544269bb5SchristosFailed to load module.
21644269bb5Schristos.It Bq Er PAM_PERM_DENIED
21744269bb5SchristosPermission denied.
21844269bb5Schristos.It Bq Er PAM_SERVICE_ERR
21944269bb5SchristosError in service module.
22044269bb5Schristos.It Bq Er PAM_SESSION_ERR
22144269bb5SchristosSession failure.
22244269bb5Schristos.It Bq Er PAM_SUCCESS
22344269bb5SchristosSuccess.
22444269bb5Schristos.It Bq Er PAM_SYMBOL_ERR
22544269bb5SchristosInvalid symbol.
22644269bb5Schristos.It Bq Er PAM_SYSTEM_ERR
22744269bb5SchristosSystem error.
22844269bb5Schristos.It Bq Er PAM_TRY_AGAIN
22944269bb5SchristosTry again.
23044269bb5Schristos.It Bq Er PAM_USER_UNKNOWN
23144269bb5SchristosUnknown user.
23244269bb5Schristos.El
23344269bb5Schristos.Sh SEE ALSO
23444269bb5Schristos.Xr openpam 3 ,
2354cb4af11Schristos.Xr pam_acct_mgmt 3 ,
2364cb4af11Schristos.Xr pam_authenticate 3 ,
2374cb4af11Schristos.Xr pam_chauthtok 3 ,
2384cb4af11Schristos.Xr pam_close_session 3 ,
2394cb4af11Schristos.Xr pam_conv 3 ,
2404cb4af11Schristos.Xr pam_end 3 ,
2414cb4af11Schristos.Xr pam_get_data 3 ,
2424cb4af11Schristos.Xr pam_getenv 3 ,
2434cb4af11Schristos.Xr pam_getenvlist 3 ,
2444cb4af11Schristos.Xr pam_get_item 3 ,
2454cb4af11Schristos.Xr pam_get_user 3 ,
2464cb4af11Schristos.Xr pam_open_session 3 ,
2474cb4af11Schristos.Xr pam_putenv 3 ,
2484cb4af11Schristos.Xr pam_setcred 3 ,
2494cb4af11Schristos.Xr pam_set_data 3 ,
2504cb4af11Schristos.Xr pam_set_item 3 ,
2514cb4af11Schristos.Xr pam_start 3 ,
2524cb4af11Schristos.Xr pam_strerror 3
25344269bb5Schristos.Sh STANDARDS
25444269bb5Schristos.Rs
25544269bb5Schristos.%T "X/Open Single Sign-On Service (XSSO) - Pluggable Authentication Modules"
25644269bb5Schristos.%D "June 1997"
25744269bb5Schristos.Re
25844269bb5Schristos.Sh AUTHORS
25944269bb5SchristosThe OpenPAM library and this manual page were developed for the
26044269bb5Schristos.Fx
26144269bb5SchristosProject by ThinkSec AS and Network Associates Laboratories, the
26244269bb5SchristosSecurity Research Division of Network Associates, Inc.\& under
26344269bb5SchristosDARPA/SPAWAR contract N66001-01-C-8035
26444269bb5Schristos.Pq Dq CBOSS ,
26544269bb5Schristosas part of the DARPA CHATS research program.
266e1b25b17Schristos.Pp
267e1b25b17SchristosThe OpenPAM library is maintained by
268a5684d07Swiz.An Dag-Erling Sm\(/orgrav Aq Mt des@des.no .
269