slapo-otp_2fa.5 4.62 KB
Newer Older
Ondřej Kuzník's avatar
Ondřej Kuzník committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
.TH PW-TOTP 5 "2018/6/29" "SLAPO-OTP_2FA"
.\" Copyright 2015-2021 The OpenLDAP Foundation.
.\" Portions Copyright 2015 by Howard Chu, Symas Corp. All rights reserved.
.\" Portions Copyright 2018 by Ondřej Kuzník, Symas Corp. All rights reserved.
.\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
.SH NAME
slapo-otp \- Two factor authentication module
.SH SYNOPSIS
.B moduleload
.I otp_2fa.la
.SH DESCRIPTION
The
.B otp_2fa
module allows time-based one-time password, AKA "authenticator-style", and
HMAC-based one-time password authentication to be used in applications that use
LDAP for authentication. In most cases no changes to the applications are
needed to switch to this type of authentication.

With this module, users would use their password, followed with the one-time
password in the password prompt to authenticate.

The password needed for a user to authenticate is calculated based on a counter
(current time in case of TOTP) and a key that is referenced in the user's LDAP
entry. Since the password is based on the time or number of uses, it changes
periodically. Once used, it cannot be used again so keyloggers and
shoulder-surfers are thwarted. A mobile phone application, such as the Google
Authenticator or YubiKey (a
.BR prover ),
can be used to calculate the user's current one-time password, which is
expressed as a (usually six-digit) number.

Alternatively, the value can be calculated by some other application with
access to the user's key and delivered to the user through SMS or some other
channel. When prompted to authenticate, the user merely appends the code
provided by the prover at the end of their password when authenticating.

This implementation complies with
.B RFC 4226 HOTP HMAC-Based One Time Passwords
and
.B RFC 6238 TOTP Time-based One Time Passwords
and includes support for the SHA-1, SHA-256, and SHA-512 HMAC
algorithms.

The HMAC key used in the OTP computation is stored in the oathOTPToken entry referenced in
the user's LDAP entry and the parameters are stored in the oathOTPParams LDAP
entry referenced in the token.

.SH CONFIGURATION
Once the module is configured on the database, it will intercept LDAP simple
binds for users whose LDAP entry has any of the
.B oathOTPUser
derived objectlasses attached to it. The attributes linking the user and the
shared secret are:

.RS
.TP
.B oathTOTPToken: <dn>
Mandatory for
.BR oathTOTPUser ,
indicates that the named entry is designated to hold the time-based one-time
password shared secret and the last password used.
.TP
.B oathHOTPToken: <dn>
Mandatory for
.BR oathHOTPUser ,
indicates that the named entry is designated to hold the one-time password
shared secret and the last password used.
.TP
.B oathTOTPParams: <dn>
Mandatory for
.BR oathTOTPToken ,
indicates that the named entry is designated to hold the parameters to generate
time-based one-time password shared secret: its length and algorithm to use as
well as the length of each time step and the grace period.
.TP
.B oathHOTPParams: <dn>
Mandatory for
.BR oathHOTPToken ,
indicates that the named entry is designated to hold the parameters to generate
one-time password shared secret: its length and algorithm to use as well as the
permitted number of passwords to skip.
.RE

The following parts of the OATH-LDAP schema are implemented.

General attributes:

.RS
.TP
.B oathSecret: <data>
The shared secret is stored here as raw bytes.
.TP
.B oathOTPLength: <length>
The password length, usually 6.
.TP
.B oathHMACAlgorithm: <OID>
The OID of the hash algorithm to use as defined in RFC 8018.
Supported algorithms include SHA1, SHA224, SHA256, SHA384 and SHA512.
.RE

The HOTP attributes:

.RS
.TP
.B oathHOTPLookAhead: <number>
The number of successive HOTP tokens that can be skipped.
.TP
.B oathHOTPCounter: <number>
The order of the last HOTP token successfully redeemed by the user.
.RE

The TOTP attributes:

.RS
.TP
.B oathTOTPTimeStepPeriod: <seconds>
The length of the time-step period for TOTP calculation.
.TP
.B oathTOTPLastTimeStep: <number>
The order of the last TOTP token successfully redeemed by the user.
.TP
122
.B oathTOTPTimeStepWindow: <number>
Ondřej Kuzník's avatar
Ondřej Kuzník committed
123
124
The number of time periods around the current time to try when checking the
password provided by the user.
125
126
127
128
129
.TP
.B oathTOTPTimeStepDrift: <number>
If the client didn't provide the correct token but it still fit with
oathTOTPTimeStepWindow above, this attribute records the current offset to
provide for slow clock drift of the client device.
Ondřej Kuzník's avatar
Ondřej Kuzník committed
130
131
132
133
134
135
136
137
138
139
.RE

.SH "SEE ALSO"
.BR slapd\-config (5).

.SH ACKNOWLEDGEMENT
This work was developed by Ondřej Kuzník and Howard Chu of Symas Corporation
for inclusion in OpenLDAP Software.

This work reuses the OATH-LDAP schema developed by Michael Ströder.