Debian Codegraph @

servers/slapd/pwmods/README.argon2

raw
1 Argon2 OpenLDAP support
2 ----------------------
3
4 argon2.c provides support for ARGON2 hashed passwords in OpenLDAP. For
5 instance, one could have the LDAP attribute:
6
7 userPassword: {ARGON2}$argon2i$v=19$m=4096,t=3,p=1$c2FsdHNhbHQ$DKlexoEJUoZTmkAAC3SaMWk30El9/RvVhlqGo6afIng
8
9 or:
10
11 userPassword: {ARGON2}$argon2i$v=19$m=4096,t=3,p=1$c2FsdHNhbHRzYWx0$qOCkx9nMeFlaGOO4DUmPDgrlUbgMMuO9T1+vQCFuyzw
12
13 Both hash the password "secret", the first using the salt "saltsalt", the second using the salt "saltsaltsalt"
14
15 Building
16 --------
17
18 This module is now part of regular OpenLDAP build process and enabled if
19 libsodium or libargon2 library and the corresponding development headers are
20 present. You can also choose the library to build against if you prefer by
21 passing --enable-argon2=<libsodium|libargon2> to your configure invocation.
22
23 Configuring
24 -----------
25
26 Load the argon2 module (e.g. with olcModuleLoad or moduleload) and the
27 {ARGON2} password scheme should now be recognised.
28
29 You can also tell OpenLDAP to use one of this scheme when processing LDAP
30 Password Modify Extended Operations, thanks to the password-hash option in
31 slapd.conf:
32
33 password-hash {ARGON2}
34
35
36 Testing
37 -------
38
39 A quick way to test whether it's working is to customize the rootdn and
40 rootpw in slapd.conf, eg:
41
42 rootdn "cn=admin,dc=example,dc=com"
43
44 # This hashes the string 'secret', with a random salt
45 rootpw {ARGON2}$argon2i$v=19$m=4096,t=3,p=1$uJyf0UfB25SQTfX7oCyK2w$U45DJqEFwD0yFaLvTVyACHLvGMwzNGf19dvzPR8XvGc
46
47
48 Then to test, run something like:
49
50 ldapsearch -b "dc=example,dc=com" -D "cn=admin,dc=example,dc=com" -x -w secret
51
52
53 -- Test hashes:
54
55 Test hashes can be generated with argon2:
56 $ echo -n "secret" | argon2 "saltsalt" -e
57 $argon2i$v=19$m=4096,t=3,p=1$c2FsdHNhbHQ$DKlexoEJUoZTmkAAC3SaMWk30El9/RvVhlqGo6afIng
58
59 $ echo -n "secret" | argon2 "saltsaltsalt" -e
60 $argon2i$v=19$m=4096,t=3,p=1$c2FsdHNhbHRzYWx0$qOCkx9nMeFlaGOO4DUmPDgrlUbgMMuO9T1+vQCFuyzw
61
62 $ echo -n "secretsecret" | argon2 "saltsalt" -e
63 $argon2i$v=19$m=4096,t=3,p=1$c2FsdHNhbHQ$U0Pd/wEsssZ9bHezDA8oxHnWe01xftykEy+7ehM2vic
64
65 $ echo -n "secretsecret" | argon2 "saltsaltsalt" -e
66 $argon2i$v=19$m=4096,t=3,p=1$c2FsdHNhbHRzYWx0$fkvoOwKgVtlX9ZDqcHFyyArBvqnAM0Igca8SScB4Jsc
67
68
69
70 Alternatively we could modify an existing user's password with
71 ldappasswd, and then test binding as that user:
72
73 $ ldappasswd -D "cn=admin,dc=example,dc=com" -x -W -S uid=jturner,ou=People,dc=example,dc=com
74 New password: secret
75 Re-enter new password: secret
76 Enter LDAP Password: <cn=admin's password>
77
78 $ ldapsearch -b "dc=example,dc=com" -D "uid=jturner,ou=People,dc=example,dc=com" -x -w secret
79
80
81
82 ---
83
84 This work is part of OpenLDAP Software <http://www.openldap.org/>.
85
86 Copyright 2017-2024 The OpenLDAP Foundation.
87 All rights reserved.
88
89 Redistribution and use in source and binary forms, with or without
90 modification, are permitted only as authorized by the OpenLDAP
91 Public License.
92
93 A copy of this license is available in the file LICENSE in the
94 top-level directory of the distribution or, alternatively, at
95 <http://www.OpenLDAP.org/license.html>.
96
97 ---