PAM_FAIL_DELAYSection: Programmers' Manual (3)Updated: 1997 Jan 12 |
PAM_FAIL_DELAYSection: Programmers' Manual (3)Updated: 1997 Jan 12 |
pam_fail_delay - request a delay on failure
int pam_fail_delay(pam_handle_t *pamh, unsigned int usec);
To minimize the effectiveness of such attacks, it is desirable to
introduce a random delay in a failed authentication process.
Linux-PAM
provides such a facility. The delay occurs upon failure of the
pam_authenticate(3)
and
pam_chauthtok(3)
functions. It occurs
after
all authentication modules have been called, but
before
control is returned to the service application.
The function,
pam_fail_delay(3),
is used to specify a required minimum for the length of the
failure-delay; the
usec
argument. This function can be called by the service application
and/or the authentication modules, both may have an interest in
delaying a reapplication for service by the user. The length of the
delay is computed at the time it is required. Its length is
pseudo-gausianly distributed about the
maximum
requested value; the resultant delay will differ by as much as 25% of
this maximum requested value (both up and down).
On return from
pam_authenticate(3) or pam_chauthtok(3),
independent of success or failure, the new requested delay is reset to
its default value: zero.
pam_fail_delay(pamh, 3000000 /* micro-seconds */ );
pam_authenticate(pamh, 0);
if the modules do not request a delay, the failure delay will be
between 2.25 and 3.75 seconds.
However, the modules, invoked in the authentication process, may
also request delays:
(module #1) pam_fail_delay(pamh, 2000000);
(module #2) pam_fail_delay(pamh, 4000000);
in this case, it is the largest requested value that is used to
compute the actual failed delay: here between 3 and 5 seconds.
none known.
pam_start(3), pam_get_item(3) and pam_strerror(3).
Also, see the three Linux-PAM Guides, for System administrators, module developers, and application developers.