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