]> granicus.if.org Git - linux-pam/blob - doc/man/pam_fail_delay.3
Relevant BUGIDs: none
[linux-pam] / doc / man / pam_fail_delay.3
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\" $Id$
3 .\" Copyright (c) Andrew G. Morgan 1997 <morgan@parc.power.net>
4 .TH PAM_FAIL_DELAY 3 "1997 Jan 12" "Linux-PAM 0.56" "Programmers' Manual"
5 .SH NAME
6
7 pam_fail_delay \- request a delay on failure
8
9 .SH SYNOPSIS
10 .B #include <security/pam_appl.h>
11 .br
12 or,
13 .br
14 .B #include <security/pam_modules.h>
15 .sp
16 .BI "int pam_fail_delay(pam_handle_t " "*pamh" ", unsigned int " "usec" ");"
17 .sp 2
18 .SH DESCRIPTION
19 .br
20 It is often possible to attack an authentication scheme by exploiting
21 the time it takes the scheme to deny access to an applicant user.  In
22 cases of
23 .I short
24 timeouts, it may prove possible to attempt a
25 .I brute force
26 dictionary attack -- with an automated process, the attacker tries all
27 possible passwords to gain access to the system.  In other cases,
28 where individual failures can take measurable amounts of time
29 (indicating the nature of the failure), an attacker can obtain useful
30 information about the authentication process.  These latter attacks
31 make use of procedural delays that constitute a
32 .I covert channel
33 of useful information.
34
35 .br
36 To minimize the effectiveness of such attacks, it is desirable to
37 introduce a random delay in a failed authentication process.
38 .B Linux-PAM
39 provides such a facility.  The delay occurs upon failure of the
40 .BR pam_authenticate "(3) "
41 and
42 .BR pam_chauthtok "(3) "
43 functions.  It occurs
44 .I after
45 all authentication modules have been called, but
46 .I before
47 control is returned to the service application.
48
49 .br
50 The function,
51 .BR pam_fail_delay "(3),"
52 is used to specify a required minimum for the length of the
53 failure-delay; the
54 .I usec
55 argument.  This function can be called by the service application
56 and/or the authentication modules, both may have an interest in
57 delaying a reapplication for service by the user.  The length of the
58 delay is computed at the time it is required.  Its length is
59 pseudo-gausianly distributed about the
60 .I maximum
61 requested value; the resultant delay will differ by as much as 25% of
62 this maximum requested value (both up and down).
63
64 .br
65 On return from
66 .BR pam_authenticate "(3) or " pam_chauthtok "(3),"
67 independent of success or failure, the new requested delay is reset to
68 its default value: zero.
69
70 .SH EXAMPLE
71 .br
72 For example, a
73 .B login
74 application may require a failure delay of roughly 3 seconds. It will
75 contain the following code:
76 .sp
77 .br
78 .B "     pam_fail_delay(pamh, 3000000 /* micro-seconds */ );"
79 .br
80 .B "     pam_authenticate(pamh, 0);"
81 .sp
82 .br
83 if the modules do not request a delay, the failure delay will be
84 between 2.25 and 3.75 seconds.
85
86 .br
87 However, the modules, invoked in the authentication process, may
88 also request delays:
89 .sp
90 .br
91 .RB "  (module #1)   " "pam_fail_delay(pamh, 2000000);"
92 .sp
93 .br
94 .RB "  (module #2)   " "pam_fail_delay(pamh, 4000000);"
95 .sp
96 .br
97 in this case, it is the largest requested value that is used to
98 compute the actual failed delay: here between 3 and 5 seconds.
99
100 .SH "RETURN VALUE"
101 Following a successful call to
102 .BR pam_fail_delay "(3), " PAM_SUCCESS
103 is returned.  All other returns should be considered serious failures.
104
105 .SH ERRORS
106 May be translated to text with
107 .BR pam_strerror "(3). "
108
109 .SH "CONFORMING TO"
110 Under consideration by the X/Open group for future inclusion in the
111 PAM RFC. 1996/1/10
112
113 .SH BUGS
114 .sp 2
115 none known.
116
117 .SH "SEE ALSO"
118
119 .BR pam_start "(3), "
120 .BR pam_get_item "(3) "
121 and
122 .BR pam_strerror "(3). "
123
124 Also, see the three
125 .BR Linux-PAM
126 Guides, for
127 .BR "System administrators" ", "
128 .BR "module developers" ", "
129 and
130 .BR "application developers" ". "