1PAM.CONF(5) Linux-PAM Manual PAM.CONF(5)
2
3
4
6 pam.conf, pam.d - PAM configuration files
7
9 When a PAM aware privilege granting application is started, it
10 activates its attachment to the PAM-API. This activation performs a
11 number of tasks, the most important being the reading of the
12 configuration file(s): /etc/pam.conf. Alternatively, this may be the
13 contents of the /etc/pam.d/ directory. The presence of this directory
14 will cause Linux-PAM to ignore /etc/pam.conf.
15
16 These files list the PAMs that will do the authentication tasks
17 required by this service, and the appropriate behavior of the PAM-API
18 in the event that individual PAMs fail.
19
20 The syntax of the /etc/pam.conf configuration file is as follows. The
21 file is made up of a list of rules, each rule is typically placed on a
22 single line, but may be extended with an escaped end of line: `\<LF>'.
23 Comments are preceded with `#' marks and extend to the next end of
24 line.
25
26 The format of each rule is a space separated collection of tokens, the
27 first three being case-insensitive:
28
29 service type control module-path module-arguments
30
31 The syntax of files contained in the /etc/pam.d/ directory, are
32 identical except for the absence of any service field. In this case,
33 the service is the name of the file in the /etc/pam.d/ directory. This
34 filename must be in lower case.
35
36 An important feature of PAM, is that a number of rules may be stacked
37 to combine the services of a number of PAMs for a given authentication
38 task.
39
40 The service is typically the familiar name of the corresponding
41 application: login and su are good examples. The service-name, other,
42 is reserved for giving default rules. Only lines that mention the
43 current service (or in the absence of such, the other entries) will be
44 associated with the given service-application.
45
46 The type is the management group that the rule corresponds to. It is
47 used to specify which of the management groups the subsequent module is
48 to be associated with. Valid entries are:
49
50 account
51 this module type performs non-authentication based account
52 management. It is typically used to restrict/permit access to a
53 service based on the time of day, currently available system
54 resources (maximum number of users) or perhaps the location of the
55 applicant user -- 'root' login only on the console.
56
57 auth
58 this module type provides two aspects of authenticating the user.
59 Firstly, it establishes that the user is who they claim to be, by
60 instructing the application to prompt the user for a password or
61 other means of identification. Secondly, the module can grant group
62 membership or other privileges through its credential granting
63 properties.
64
65 password
66 this module type is required for updating the authentication token
67 associated with the user. Typically, there is one module for each
68 'challenge/response' based authentication (auth) type.
69
70 session
71 this module type is associated with doing things that need to be
72 done for the user before/after they can be given service. Such
73 things include the logging of information concerning the
74 opening/closing of some data exchange with a user, mounting
75 directories, etc.
76
77 The third field, control, indicates the behavior of the PAM-API should
78 the module fail to succeed in its authentication task. There are two
79 types of syntax for this control field: the simple one has a single
80 simple keyword; the more complicated one involves a square-bracketed
81 selection of value=action pairs.
82
83 For the simple (historical) syntax valid control values are:
84
85 required
86 failure of such a PAM will ultimately lead to the PAM-API returning
87 failure but only after the remaining stacked modules (for this
88 service and type) have been invoked.
89
90 requisite
91 like required, however, in the case that such a module returns a
92 failure, control is directly returned to the application. The
93 return value is that associated with the first required or
94 requisite module to fail. Note, this flag can be used to protect
95 against the possibility of a user getting the opportunity to enter
96 a password over an unsafe medium. It is conceivable that such
97 behavior might inform an attacker of valid accounts on a system.
98 This possibility should be weighed against the not insignificant
99 concerns of exposing a sensitive password in a hostile environment.
100
101 sufficient
102 success of such a module is enough to satisfy the authentication
103 requirements of the stack of modules (if a prior required module
104 has failed the success of this one is ignored). A failure of this
105 module is not deemed as fatal to satisfying the application that
106 this type has succeeded. If the module succeeds the PAM framework
107 returns success to the application immediately without trying any
108 other modules.
109
110 optional
111 the success or failure of this module is only important if it is
112 the only module in the stack associated with this service+type.
113
114 include
115 include all lines of given type from the configuration file
116 specified as an argument to this control.
117
118 For the more complicated syntax valid control values have the following
119 form:
120
121 [value1=action1 value2=action2 ...]
122
123
124 Where valueN corresponds to the return code from the function invoked
125 in the module for which the line is defined. It is selected from one of
126 these: success, open_err, symbol_err, service_err, system_err, buf_err,
127 perm_denied, auth_err, cred_insufficient, authinfo_unavail,
128 user_unknown, maxtries, new_authtok_reqd, acct_expired, session_err,
129 cred_unavail, cred_expired, cred_err, no_module_data, conv_err,
130 authtok_err, authtok_recover_err, authtok_lock_busy,
131 authtok_disable_aging, try_again, ignore, abort, authtok_expired,
132 module_unknown, bad_item and default.
133
134 The last of these, default, implies 'all valueN's not mentioned
135 explicitly. Note, the full list of PAM errors is available in
136 /usr/include/security/_pam_types.h. The actionN can be: an unsigned
137 integer, n, signifying an action of 'jump over the next n modules in
138 the stack', or take one of the following forms:
139
140 ignore
141 when used with a stack of modules, the module's return status will
142 not contribute to the return code the application obtains.
143
144 bad
145 this action indicates that the return code should be thought of as
146 indicative of the module failing. If this module is the first in
147 the stack to fail, its status value will be used for that of the
148 whole stack.
149
150 die
151 equivalent to bad with the side effect of terminating the module
152 stack and PAM immediately returning to the application.
153
154 ok
155 this tells PAM that the administrator thinks this return code
156 should contribute directly to the return code of the full stack of
157 modules. In other words, if the former state of the stack would
158 lead to a return of PAM_SUCCESS, the module's return code will
159 override this value. Note, if the former state of the stack holds
160 some value that is indicative of a modules failure, this 'ok' value
161 will not be used to override that value.
162
163 done
164 equivalent to ok with the side effect of terminating the module
165 stack and PAM immediately returning to the application.
166
167 reset
168 clear all memory of the state of the module stack and start again
169 with the next stacked module.
170
171 Each of the four keywords: required; requisite; sufficient; and
172 optional, have an equivalent expression in terms of the [...] syntax.
173 They are as follows:
174
175 required
176 [success=ok new_authtok_reqd=ok ignore=ignore default=bad]
177
178 requisite
179 [success=ok new_authtok_reqd=ok ignore=ignore default=die]
180
181 sufficient
182 [success=done new_authtok_reqd=done default=ignore]
183
184 optional
185 [success=ok new_authtok_reqd=ok default=ignore]
186
187 module-path is either the full filename of the PAM to be used by the
188 application (it begins with a '/'), or a relative pathname from the
189 default module location: /lib/security/ or /lib64/security/, depending
190 on the architecture.
191
192 module-arguments are a space separated list of tokens that can be used
193 to modify the specific behavior of the given PAM. Such arguments will
194 be documented for each individual module. Note, if you wish to include
195 spaces in an argument, you should surround that argument with square
196 brackets.
197
198 squid auth required pam_mysql.so user=passwd_query passwd=mada \
199 db=eminence [query=select user_name from internet_service \
200 where user_name='%u' and password=PASSWORD('%p') and \
201 service='web_proxy']
202
203
204 When using this convention, you can include `[' characters inside the
205 string, and if you wish to include a `]' character inside the string
206 that will survive the argument parsing, you should use `\['. In other
207 words:
208
209 [..[..\]..] --> ..[..]..
210
211
212 Any line in (one of) the configuration file(s), that is not formatted
213 correctly, will generally tend (erring on the side of caution) to make
214 the authentication process fail. A corresponding error is written to
215 the system log files with a call to syslog(3).
216
217 More flexible than the single configuration file is it to configure
218 libpam via the contents of the /etc/pam.d/ directory. In this case the
219 directory is filled with files each of which has a filename equal to a
220 service-name (in lower-case): it is the personal configuration file for
221 the named service.
222
223 The syntax of each file in /etc/pam.d/ is similar to that of the
224 /etc/pam.conf file and is made up of lines of the following form:
225
226 type control module-path module-arguments
227
228
229 The only difference being that the service-name is not present. The
230 service-name is of course the name of the given configuration file. For
231 example, /etc/pam.d/login contains the configuration for the login
232 service.
233
235 pam(3), PAM(8), pam_start(3)
236
237
238
239Linux-PAM Manual 01/16/2007 PAM.CONF(5)