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