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 If the type value from the list above is prepended with a - character
78 the PAM library will not log to the system log if it is not possible to
79 load the module because it is missing in the system. This can be useful
80 especially for modules which are not always installed on the system and
81 are not required for correct authentication and authorization of the
82 login session.
83
84 The third field, control, indicates the behavior of the PAM-API should
85 the module fail to succeed in its authentication task. There are two
86 types of syntax for this control field: the simple one has a single
87 simple keyword; the more complicated one involves a square-bracketed
88 selection of value=action pairs.
89
90 For the simple (historical) syntax valid control values are:
91
92 required
93 failure of such a PAM will ultimately lead to the PAM-API returning
94 failure but only after the remaining stacked modules (for this
95 service and type) have been invoked.
96
97 requisite
98 like required, however, in the case that such a module returns a
99 failure, control is directly returned to the application. The
100 return value is that associated with the first required or
101 requisite module to fail. Note, this flag can be used to protect
102 against the possibility of a user getting the opportunity to enter
103 a password over an unsafe medium. It is conceivable that such
104 behavior might inform an attacker of valid accounts on a system.
105 This possibility should be weighed against the not insignificant
106 concerns of exposing a sensitive password in a hostile environment.
107
108 sufficient
109 success of such a module is enough to satisfy the authentication
110 requirements of the stack of modules (if a prior required module
111 has failed the success of this one is ignored). A failure of this
112 module is not deemed as fatal to satisfying the application that
113 this type has succeeded. If the module succeeds the PAM framework
114 returns success to the application immediately without trying any
115 other modules.
116
117 optional
118 the success or failure of this module is only important if it is
119 the only module in the stack associated with this service+type.
120
121 include
122 include all lines of given type from the configuration file
123 specified as an argument to this control.
124
125 substack
126 include all lines of given type from the configuration file
127 specified as an argument to this control. This differs from include
128 in that evaluation of the done and die actions in a substack does
129 not cause skipping the rest of the complete module stack, but only
130 of the substack. Jumps in a substack also can not make evaluation
131 jump out of it, and the whole substack is counted as one module
132 when the jump is done in a parent stack. The reset action will
133 reset the state of a module stack to the state it was in as of
134 beginning of the substack evaluation.
135
136 For the more complicated syntax valid control values have the following
137 form:
138
139 [value1=action1 value2=action2 ...]
140
141
142 Where valueN corresponds to the return code from the function invoked
143 in the module for which the line is defined. It is selected from one of
144 these: success, open_err, symbol_err, service_err, system_err, buf_err,
145 perm_denied, auth_err, cred_insufficient, authinfo_unavail,
146 user_unknown, maxtries, new_authtok_reqd, acct_expired, session_err,
147 cred_unavail, cred_expired, cred_err, no_module_data, conv_err,
148 authtok_err, authtok_recover_err, authtok_lock_busy,
149 authtok_disable_aging, try_again, ignore, abort, authtok_expired,
150 module_unknown, bad_item, conv_again, incomplete, and default.
151
152 The last of these, default, implies ´all valueN´s not mentioned
153 explicitly. Note, the full list of PAM errors is available in
154 /usr/include/security/_pam_types.h. The actionN can be: an unsigned
155 integer, n, signifying an action of ´jump over the next n modules in
156 the stack´; or take one of the following forms:
157
158 ignore
159 when used with a stack of modules, the module´s return status will
160 not contribute to the return code the application obtains.
161
162 bad
163 this action indicates that the return code should be thought of as
164 indicative of the module failing. If this module is the first in
165 the stack to fail, its status value will be used for that of the
166 whole stack.
167
168 die
169 equivalent to bad with the side effect of terminating the module
170 stack and PAM immediately returning to the application.
171
172 ok
173 this tells PAM that the administrator thinks this return code
174 should contribute directly to the return code of the full stack of
175 modules. In other words, if the former state of the stack would
176 lead to a return of PAM_SUCCESS, the module´s return code will
177 override this value. Note, if the former state of the stack holds
178 some value that is indicative of a modules failure, this ´ok´ value
179 will not be used to override that value.
180
181 done
182 equivalent to ok with the side effect of terminating the module
183 stack and PAM immediately returning to the application.
184
185 reset
186 clear all memory of the state of the module stack and start again
187 with the next stacked module.
188
189 Each of the four keywords: required; requisite; sufficient; and
190 optional, have an equivalent expression in terms of the [...] syntax.
191 They are as follows:
192
193 required
194 [success=ok new_authtok_reqd=ok ignore=ignore default=bad]
195
196 requisite
197 [success=ok new_authtok_reqd=ok ignore=ignore default=die]
198
199 sufficient
200 [success=done new_authtok_reqd=done default=ignore]
201
202 optional
203 [success=ok new_authtok_reqd=ok default=ignore]
204
205 module-path is either the full filename of the PAM to be used by the
206 application (it begins with a ´/´), or a relative pathname from the
207 default module location: /lib/security/ or /lib64/security/, depending
208 on the architecture.
209
210 module-arguments are a space separated list of tokens that can be used
211 to modify the specific behavior of the given PAM. Such arguments will
212 be documented for each individual module. Note, if you wish to include
213 spaces in an argument, you should surround that argument with square
214 brackets.
215
216 squid auth required pam_mysql.so user=passwd_query passwd=mada \
217 db=eminence [query=select user_name from internet_service \
218 where user_name=´%u´ and password=PASSWORD(´%p´) and \
219 service=´web_proxy´]
220
221
222 When using this convention, you can include `[´ characters inside the
223 string, and if you wish to include a `]´ character inside the string
224 that will survive the argument parsing, you should use `\]´. In other
225 words:
226
227 [..[..\]..] --> ..[..]..
228
229
230 Any line in (one of) the configuration file(s), that is not formatted
231 correctly, will generally tend (erring on the side of caution) to make
232 the authentication process fail. A corresponding error is written to
233 the system log files with a call to syslog(3).
234
235 More flexible than the single configuration file is it to configure
236 libpam via the contents of the /etc/pam.d/ directory. In this case the
237 directory is filled with files each of which has a filename equal to a
238 service-name (in lower-case): it is the personal configuration file for
239 the named service.
240
241 The syntax of each file in /etc/pam.d/ is similar to that of the
242 /etc/pam.conf file and is made up of lines of the following form:
243
244 type control module-path module-arguments
245
246
247 The only difference being that the service-name is not present. The
248 service-name is of course the name of the given configuration file. For
249 example, /etc/pam.d/login contains the configuration for the login
250 service.
251
253 pam(3), PAM(8), pam_start(3)
254
255
256
257Linux-PAM Manual 03/02/2009 PAM.CONF(5)