~ubuntu-branches/ubuntu/natty/pam/natty-security

« back to all changes in this revision

Viewing changes to doc/man/pam_fail_delay.3

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-08-26 00:40:14 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090826004014-qsd46mostuyljeqp
Tags: 1.1.0-1ubuntu1
* Merge from Debian, remaining changes:
  - debian/libpam-modules.postinst: Add PATH to /etc/environment if it's not
    present there or in /etc/security/pam_env.conf. (should send to Debian).
  - debian/libpam0g.postinst: only ask questions during update-manager when
    there are non-default services running.
  - debian/patches-applied/series: Ubuntu patches are as below ...
  - debian/patches-applied/ubuntu-no-error-if-missingok: add a new, magic
    module option 'missingok' which will suppress logging of errors by
    libpam if the module is not found.
  - debian/patches-applied/ubuntu-regression_fix_securetty: prompt for
    password on bad username.
  - debian/patches-applied/ubuntu-rlimit_nice_correction: Explicitly
    initialise RLIMIT_NICE rather than relying on the kernel limits.
  - Change Vcs-Bzr to point at the Ubuntu branch.
  - debian/local/common-password, debian/pam-configs/unix: switch from
    "md5" to "sha512" as password crypt default.
  - Make libpam-modules depend on base-files (>= 5.0.0ubuntu6), to ensure
    run-parts does the right thing in /etc/update-motd.d.
  - debian/patches-applied/pam_motd-legal-notice: display the contents of
    /etc/legal once, then set a flag in the user's homedir to prevent showing
    it again.
  - debian/local/common-{auth,account,password}.md5sums: include the
    Ubuntu-specific intrepid,jaunty md5sums for use during the
    common-session-noninteractive upgrade.
* Dropped changes, superseded upstream:
  - debian/patches-applied/ubuntu-fix_standard_types: Use standard u_int8_t
    type rather than __u8.
  - debian/patches-applied/ubuntu-user_defined_environment: Look at
    ~/.pam_environment too, with the same format as
    /etc/security/pam_env.conf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
.\"     Title: pam_fail_delay
2
 
.\"    Author: 
3
 
.\" Generator: DocBook XSL Stylesheets v1.73.1 <http://docbook.sf.net/>
4
 
.\"      Date: 04/16/2008
 
2
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 
3
.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
 
4
.\"      Date: 03/02/2009
5
5
.\"    Manual: Linux-PAM Manual
6
6
.\"    Source: Linux-PAM Manual
 
7
.\"  Language: English
7
8
.\"
8
 
.TH "PAM_FAIL_DELAY" "3" "04/16/2008" "Linux-PAM Manual" "Linux-PAM Manual"
 
9
.TH "PAM_FAIL_DELAY" "3" "03/02/2009" "Linux-PAM Manual" "Linux-PAM Manual"
 
10
.\" -----------------------------------------------------------------
 
11
.\" * (re)Define some macros
 
12
.\" -----------------------------------------------------------------
 
13
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
14
.\" toupper - uppercase a string (locale-aware)
 
15
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
16
.de toupper
 
17
.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
 
18
\\$*
 
19
.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
 
20
..
 
21
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
22
.\" SH-xref - format a cross-reference to an SH section
 
23
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
24
.de SH-xref
 
25
.ie n \{\
 
26
.\}
 
27
.toupper \\$*
 
28
.el \{\
 
29
\\$*
 
30
.\}
 
31
..
 
32
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
33
.\" SH - level-one heading that works better for non-TTY output
 
34
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
35
.de1 SH
 
36
.\" put an extra blank line of space above the head in non-TTY output
 
37
.if t \{\
 
38
.sp 1
 
39
.\}
 
40
.sp \\n[PD]u
 
41
.nr an-level 1
 
42
.set-an-margin
 
43
.nr an-prevailing-indent \\n[IN]
 
44
.fi
 
45
.in \\n[an-margin]u
 
46
.ti 0
 
47
.HTML-TAG ".NH \\n[an-level]"
 
48
.it 1 an-trap
 
49
.nr an-no-space-flag 1
 
50
.nr an-break-flag 1
 
51
\." make the size of the head bigger
 
52
.ps +3
 
53
.ft B
 
54
.ne (2v + 1u)
 
55
.ie n \{\
 
56
.\" if n (TTY output), use uppercase
 
57
.toupper \\$*
 
58
.\}
 
59
.el \{\
 
60
.nr an-break-flag 0
 
61
.\" if not n (not TTY), use normal case (not uppercase)
 
62
\\$1
 
63
.in \\n[an-margin]u
 
64
.ti 0
 
65
.\" if not n (not TTY), put a border/line under subheading
 
66
.sp -.6
 
67
\l'\n(.lu'
 
68
.\}
 
69
..
 
70
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
71
.\" SS - level-two heading that works better for non-TTY output
 
72
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
73
.de1 SS
 
74
.sp \\n[PD]u
 
75
.nr an-level 1
 
76
.set-an-margin
 
77
.nr an-prevailing-indent \\n[IN]
 
78
.fi
 
79
.in \\n[IN]u
 
80
.ti \\n[SN]u
 
81
.it 1 an-trap
 
82
.nr an-no-space-flag 1
 
83
.nr an-break-flag 1
 
84
.ps \\n[PS-SS]u
 
85
\." make the size of the head bigger
 
86
.ps +2
 
87
.ft B
 
88
.ne (2v + 1u)
 
89
.if \\n[.$] \&\\$*
 
90
..
 
91
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
92
.\" BB/BE - put background/screen (filled box) around block of text
 
93
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
94
.de BB
 
95
.if t \{\
 
96
.sp -.5
 
97
.br
 
98
.in +2n
 
99
.ll -2n
 
100
.gcolor red
 
101
.di BX
 
102
.\}
 
103
..
 
104
.de EB
 
105
.if t \{\
 
106
.if "\\$2"adjust-for-leading-newline" \{\
 
107
.sp -1
 
108
.\}
 
109
.br
 
110
.di
 
111
.in
 
112
.ll
 
113
.gcolor
 
114
.nr BW \\n(.lu-\\n(.i
 
115
.nr BH \\n(dn+.5v
 
116
.ne \\n(BHu+.5v
 
117
.ie "\\$2"adjust-for-leading-newline" \{\
 
118
\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
 
119
.\}
 
120
.el \{\
 
121
\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
 
122
.\}
 
123
.in 0
 
124
.sp -.5v
 
125
.nf
 
126
.BX
 
127
.in
 
128
.sp .5v
 
129
.fi
 
130
.\}
 
131
..
 
132
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
133
.\" BM/EM - put colored marker in margin next to block of text
 
134
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
135
.de BM
 
136
.if t \{\
 
137
.br
 
138
.ll -2n
 
139
.gcolor red
 
140
.di BX
 
141
.\}
 
142
..
 
143
.de EM
 
144
.if t \{\
 
145
.br
 
146
.di
 
147
.ll
 
148
.gcolor
 
149
.nr BH \\n(dn
 
150
.ne \\n(BHu
 
151
\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
 
152
.in 0
 
153
.nf
 
154
.BX
 
155
.in
 
156
.fi
 
157
.\}
 
158
..
 
159
.\" -----------------------------------------------------------------
 
160
.\" * set default formatting
 
161
.\" -----------------------------------------------------------------
9
162
.\" disable hyphenation
10
163
.nh
11
164
.\" disable justification (adjust text to left margin only)
12
165
.ad l
13
 
.SH "NAME"
14
 
pam_fail_delay - request a delay on failure
15
 
.SH "SYNOPSIS"
 
166
.\" -----------------------------------------------------------------
 
167
.\" * MAIN CONTENT STARTS HERE *
 
168
.\" -----------------------------------------------------------------
 
169
.SH "Name"
 
170
pam_fail_delay \- request a delay on failure
 
171
.SH "Synopsis"
16
172
.sp
17
173
.ft B
 
174
.fam C
 
175
.ps -1
18
176
.nf
19
 
#include <security/pam_appl\.h>
 
177
#include <security/pam_appl\&.h>
20
178
.fi
 
179
.fam
 
180
.ps +1
21
181
.ft
22
 
.HP 19
 
182
.fam C
 
183
.HP \w'int\ pam_fail_delay('u
23
184
.BI "int pam_fail_delay(pam_handle_t\ *" "pamh" ", unsigned\ int\ " "usec" ");"
 
185
.fam
24
186
.SH "DESCRIPTION"
25
187
.PP
26
188
The
27
189
\fBpam_fail_delay\fR
28
190
function provides a mechanism by which an application or module can suggest a minimum delay of
29
191
\fIusec\fR
30
 
micro\-seconds\. The function keeps a record of the longest time requested with this function\. Should
 
192
micro\-seconds\&. The function keeps a record of the longest time requested with this function\&. Should
31
193
\fBpam_authenticate\fR(3)
32
 
fail, the failing return to the application is delayed by an amount of time randomly distributed (by up to 25%) about this longest value\.
 
194
fail, the failing return to the application is delayed by an amount of time randomly distributed (by up to 25%) about this longest value\&.
33
195
.PP
34
 
Independent of success, the delay time is reset to its zero default value when the PAM service module returns control to the application\. The delay occurs
 
196
Independent of success, the delay time is reset to its zero default value when the PAM service module returns control to the application\&. The delay occurs
35
197
\fIafter\fR
36
198
all authentication modules have been called, but
37
199
\fIbefore\fR
38
 
control is returned to the service application\.
 
200
control is returned to the service application\&.
39
201
.PP
40
202
When using this function the programmer should check if it is available with:
41
203
.sp
 
204
.if n \{\
42
205
.RS 4
 
206
.\}
 
207
.fam C
 
208
.ps -1
43
209
.nf
 
210
.if t \{\
 
211
.sp -1
 
212
.\}
 
213
.BB lightgray adjust-for-leading-newline
 
214
.sp -1
 
215
 
44
216
#ifdef HAVE_PAM_FAIL_DELAY
45
 
    \.\.\.\.
 
217
    \&.\&.\&.\&.
46
218
#endif /* HAVE_PAM_FAIL_DELAY */
47
219
      
 
220
.EB lightgray adjust-for-leading-newline
 
221
.if t \{\
 
222
.sp 1
 
223
.\}
48
224
.fi
 
225
.fam
 
226
.ps +1
 
227
.if n \{\
49
228
.RE
 
229
.\}
50
230
.PP
51
 
For applications written with a single thread that are event driven in nature, generating this delay may be undesirable\. Instead, the application may want to register the delay in some other way\. For example, in a single threaded server that serves multiple authentication requests from a single event loop, the application might want to simply mark a given connection as blocked until an application timer expires\. For this reason the delay function can be changed with the
 
231
For applications written with a single thread that are event driven in nature, generating this delay may be undesirable\&. Instead, the application may want to register the delay in some other way\&. For example, in a single threaded server that serves multiple authentication requests from a single event loop, the application might want to simply mark a given connection as blocked until an application timer expires\&. For this reason the delay function can be changed with the
52
232
\fIPAM_FAIL_DELAY\fR
53
 
item\. It can be queried and set with
 
233
item\&. It can be queried and set with
54
234
\fBpam_get_item\fR(3)
55
235
and
56
236
\fBpam_set_item \fR(3)
57
 
respectively\. The value used to set it should be a function pointer of the following prototype:
 
237
respectively\&. The value used to set it should be a function pointer of the following prototype:
58
238
.sp
 
239
.if n \{\
59
240
.RS 4
 
241
.\}
 
242
.fam C
 
243
.ps -1
60
244
.nf
 
245
.if t \{\
 
246
.sp -1
 
247
.\}
 
248
.BB lightgray adjust-for-leading-newline
 
249
.sp -1
 
250
 
61
251
void (*delay_fn)(int retval, unsigned usec_delay, void *appdata_ptr);
62
252
      
 
253
.EB lightgray adjust-for-leading-newline
 
254
.if t \{\
 
255
.sp 1
 
256
.\}
63
257
.fi
 
258
.fam
 
259
.ps +1
 
260
.if n \{\
64
261
.RE
 
262
.\}
65
263
.sp
66
264
The arguments being the
67
265
\fIretval\fR
70
268
micro\-second delay that libpam is requesting and the
71
269
\fIappdata_ptr\fR
72
270
that the application has associated with the current
73
 
\fIpamh\fR\. This last value was set by the application when it called
 
271
\fIpamh\fR\&. This last value was set by the application when it called
74
272
\fBpam_start\fR(3)
75
273
or explicitly with
76
 
\fBpam_set_item\fR(3)\. Note, if PAM_FAIL_DELAY item is unset (or set to NULL), then no delay will be performed\.
 
274
\fBpam_set_item\fR(3)\&. Note, if PAM_FAIL_DELAY item is unset (or set to NULL), then no delay will be performed\&.
77
275
.SH "RATIONALE"
78
276
.PP
79
 
It is often possible to attack an authentication scheme by exploiting the time it takes the scheme to deny access to an applicant user\. In cases of
 
277
It is often possible to attack an authentication scheme by exploiting the time it takes the scheme to deny access to an applicant user\&. In cases of
80
278
\fIshort\fR
81
279
timeouts, it may prove possible to attempt a
82
280
\fIbrute force\fR
83
 
dictionary attack \-\- with an automated process, the attacker tries all possible passwords to gain access to the system\. In other cases, where individual failures can take measurable amounts of time (indicating the nature of the failure), an attacker can obtain useful information about the authentication process\. These latter attacks make use of procedural delays that constitute a
 
281
dictionary attack \-\- with an automated process, the attacker tries all possible passwords to gain access to the system\&. In other cases, where individual failures can take measurable amounts of time (indicating the nature of the failure), an attacker can obtain useful information about the authentication process\&. These latter attacks make use of procedural delays that constitute a
84
282
\fIcovert channel\fR
85
 
of useful information\.
 
283
of useful information\&.
86
284
.PP
87
 
To minimize the effectiveness of such attacks, it is desirable to introduce a random delay in a failed authentication process\. Preferable this value should be set by the application or a special PAM module\. Standard PAM modules should not modify the delay unconditional\.
 
285
To minimize the effectiveness of such attacks, it is desirable to introduce a random delay in a failed authentication process\&. Preferable this value should be set by the application or a special PAM module\&. Standard PAM modules should not modify the delay unconditional\&.
88
286
.SH "EXAMPLE"
89
287
.PP
90
 
For example, a login application may require a failure delay of roughly 3 seconds\. It will contain the following code:
 
288
For example, a login application may require a failure delay of roughly 3 seconds\&. It will contain the following code:
91
289
.sp
 
290
.if n \{\
92
291
.RS 4
 
292
.\}
 
293
.fam C
 
294
.ps -1
93
295
.nf
 
296
.if t \{\
 
297
.sp -1
 
298
.\}
 
299
.BB lightgray adjust-for-leading-newline
 
300
.sp -1
 
301
 
94
302
    pam_fail_delay (pamh, 3000000 /* micro\-seconds */ );
95
303
    pam_authenticate (pamh, 0);
96
304
    
 
305
.EB lightgray adjust-for-leading-newline
 
306
.if t \{\
 
307
.sp 1
 
308
.\}
97
309
.fi
 
310
.fam
 
311
.ps +1
 
312
.if n \{\
98
313
.RE
 
314
.\}
99
315
.PP
100
 
if the modules do not request a delay, the failure delay will be between 2\.25 and 3\.75 seconds\.
 
316
if the modules do not request a delay, the failure delay will be between 2\&.25 and 3\&.75 seconds\&.
101
317
.PP
102
318
However, the modules, invoked in the authentication process, may also request delays:
103
319
.sp
 
320
.if n \{\
104
321
.RS 4
 
322
.\}
 
323
.fam C
 
324
.ps -1
105
325
.nf
 
326
.if t \{\
 
327
.sp -1
 
328
.\}
 
329
.BB lightgray adjust-for-leading-newline
 
330
.sp -1
 
331
 
106
332
module #1:    pam_fail_delay (pamh, 2000000);
107
333
module #2:    pam_fail_delay (pamh, 4000000);
108
334
    
 
335
.EB lightgray adjust-for-leading-newline
 
336
.if t \{\
 
337
.sp 1
 
338
.\}
109
339
.fi
 
340
.fam
 
341
.ps +1
 
342
.if n \{\
110
343
.RE
 
344
.\}
111
345
.PP
112
 
in this case, it is the largest requested value that is used to compute the actual failed delay: here between 3 and 5 seconds\.
 
346
in this case, it is the largest requested value that is used to compute the actual failed delay: here between 3 and 5 seconds\&.
113
347
.SH "RETURN VALUES"
114
348
.PP
115
349
PAM_SUCCESS
116
350
.RS 4
117
 
Delay was successful adjusted\.
 
351
Delay was successful adjusted\&.
118
352
.RE
119
353
.PP
120
354
PAM_SYSTEM_ERR
121
355
.RS 4
122
 
A NULL pointer was submitted as PAM handle\.
 
356
A NULL pointer was submitted as PAM handle\&.
123
357
.RE
124
358
.SH "SEE ALSO"
125
359
.PP
131
365
.PP
132
366
The
133
367
\fBpam_fail_delay\fR
134
 
function is an Linux\-PAM extension\.
 
368
function is an Linux\-PAM extension\&.