~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« back to all changes in this revision

Viewing changes to contrib/slapd-modules/passwd/sha2/README

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Steve Langasek, Mathias Gug
  • Date: 2009-02-18 18:44:00 UTC
  • mfrom: (1.1.2 upstream) (0.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20090218184400-zw4mjse9eywt5566
Tags: 2.4.14-0ubuntu1
[ Steve Langasek ]
* New upstream version
  - Fixes a bug with the pcache overlay not returning cached entries
    (closes: #497697)
  - Update evolution-ntlm patch to apply to current Makefiles.
  - (tentatively) drop gnutls-ciphers, since this bug was reported to be
    fixed upstream in 2.4.8.  The fix applied in 2.4.8 didn't match the
    patch from the bug report, so this should be watched for regressions.
* Build against db4.7 instead of db4.2 at last!  Closes: #421946.
* Build with --disable-ndb, to avoid a misbuild when libmysqlclient is
  installed in the build environment.
* New patch, no-crlcheck-for-gnutls, to fix a build failure when using
  --with-tls=gnutls.

[ Mathias Gug ]
* Merge from debian unstable, remaining changes:
  - debian/apparmor-profile: add AppArmor profile
  - debian/slapd.postinst: Reload AA profile on configuration
  - updated debian/slapd.README.Debian for note on AppArmor
  - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6
  - debian/control: Conflicts with apparmor-profiles << 2.1+1075-0ubuntu4
    to make sure that if earlier version of apparmour-profiles gets
    installed it won't overwrite our profile.
  - Modify Maintainer value to match the DebianMaintainerField
    speficication.
  - follow ApparmorProfileMigration and force apparmor compalin mode on 
    some upgrades (LP: #203529)
  - debian/slapd.dirs: add etc/apparmor.d/force-complain
  - debian/slapd.preinst: create symlink for force-complain on pre-feisty
    upgrades, upgrades where apparmor-profiles profile is unchanged (ie
    non-enforcing) and upgrades where apparmor profile does not exist.
  - debian/slapd.postrm: remove symlink in force-complain/ on purge
  - debian/patches/fix-ucred-libc due to changes how newer glibc handle
    the ucred struct now.
  - debian/control:
    - Build-depend on libltdl7-dev rather then libltdl3-dev.
  - debian/patches/autogen.sh:
    - Call libtoolize with the --install option to install config.{guess,sub}
      files.
  - Don't use local statement in config script as it fails if /bin/sh
    points to bash (LP: #286063).
  - Disable the testsuite on hppa. Allows building of packages on this
    architecture again, once this package is in the archive.
    LP: #288908.
  - debian/slapd.postinst, debian/slapd.script-common: set correct ownership
    and permissions on /var/lib/ldap, /etc/ldap/slapd.d (group readable) and
    /var/run/slapd (world readable). (LP: #257667).
  - debian/patches/nssov-build, debian/rules: 
    Build and package the nss overlay.
    debian/schema/misc.ldif: add ldif file for the misc schema, which defines
    rfc822MailMember (required by the nss overlay).
  - debian/{control,rules}: enable PIE hardening
  - Use cn=config as the default configuration backend instead of 
    slapd.conf. Migrate slapd.conf  file to /etc/ldap/slapd.d/ on upgrade
    asking the end user to enter a new password to control the access to the
    cn=config tree.
* debian/patches/corrupt-contextCSN: The contextCSN can get corrupted at
  times. (ITS: #5947)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
SHA-512 OpenLDAP support
 
2
------------------------
 
3
 
 
4
  Based on SHA2 implementation by Aaron D. Gifford (http://www.aarongifford.com/), also used in OpenBSD.
 
5
  Adapted for OpenLDAP use by Jeff Turner <jeff@atlassian.com>
 
6
  Distributed under open source BSD license - see code for details.
 
7
 
 
8
 
 
9
slapd-sha2.c provides support for SHA-512, SHA-384 and SHA-256 hashed passwords in
 
10
OpenLDAP. For instance, one could have the LDAP attribute:
 
11
 
 
12
userPassword: {SHA512}vSsar3708Jvp9Szi2NWZZ02Bqp1qRCFpbcTZPdBhnWgs5WtNZKnvCXdhztmeD2cmW192CF5bDufKRpayrW/isg==
 
13
 
 
14
or:
 
15
 
 
16
userPassword: {SHA384}WKd1ukESvjAFrkQHznV9iP2nHUBJe7gCbsrFTU4//HIyzo3jq1rLMK45dg/ufFPt
 
17
 
 
18
or:
 
19
 
 
20
userPassword: {SHA256}K7gNU3sdo+OL0wNhqoVWhr3g6s1xYv72ol/pe/Unols=
 
21
 
 
22
all of which encode the password 'secret'.
 
23
 
 
24
 
 
25
Building
 
26
--------
 
27
 
 
28
1) Obtain the OpenLDAP source, eg. 'apt-get source slapd'.  Really we
 
29
only want the headers, but there doesn't seem to be a Debian package
 
30
with them.
 
31
 
 
32
2) Customize the OPENLDAP variable in Makefile to point to the OpenLDAP
 
33
source root.
 
34
 
 
35
For initial testing you might also want to edit CCFLAGS to define
 
36
SLAPD_SHA2_DEBUG, which enables logging to stderr (don't leave this on
 
37
in production, as it prints passwords in cleartext).
 
38
 
 
39
3) Run 'make' to produce slapd-sha2.so
 
40
 
 
41
4) Copy slapd-sha2.so somewhere permanent.
 
42
 
 
43
4) Edit your slapd.conf (eg. /etc/ldap/slapd.conf), and add:
 
44
 
 
45
moduleload ...path/to/slapd-sha2.so
 
46
 
 
47
5) Restart slapd.
 
48
 
 
49
The {SHA512} scheme should now be recognised.
 
50
 
 
51
Testing
 
52
-------
 
53
 
 
54
A quick way to test whether it's working is to customize the rootdn and
 
55
rootpw in slapd.conf, eg:
 
56
 
 
57
rootdn          "cn=admin,dc=example,dc=com"
 
58
# This encrypts the string 'secret' 
 
59
 
 
60
rootpw  {SHA256}K7gNU3sdo+OL0wNhqoVWhr3g6s1xYv72ol/pe/Unols=
 
61
 
 
62
Then to test, run something like:
 
63
 
 
64
ldapsearch -b "dc=example,dc=com" -D "cn=admin,dc=example,dc=com" -x -w secret
 
65
 
 
66
 
 
67
-- Test hashes:
 
68
 
 
69
Test hashes can be generated with openssl:
 
70
 
 
71
$ echo -n "secret" | openssl dgst -sha256 -binary | openssl enc -base64
 
72
K7gNU3sdo+OL0wNhqoVWhr3g6s1xYv72ol/pe/Unols=
 
73
$ echo -n "secret" | openssl dgst -sha384 -binary | openssl enc -base64
 
74
WKd1ukESvjAFrkQHznV9iP2nHUBJe7gCbsrFTU4//HIyzo3jq1rLMK45dg/ufFPt
 
75
$ echo -n "secret" | openssl dgst -sha512 -binary | openssl enc -base64   
 
76
vSsar3708Jvp9Szi2NWZZ02Bqp1qRCFpbcTZPdBhnWgs5WtNZKnvCXdhztmeD2cm
 
77
W192CF5bDufKRpayrW/isg==
 
78
 
 
79
(join those lines up to form the full hash)
 
80
 
 
81
 
 
82
 
 
83
Alternatively we could modify an existing user's password with
 
84
ldapmodify, and then test binding as that user:
 
85
 
 
86
$ ldapmodify -D "cn=admin,dc=example,dc=com" -x -W
 
87
Enter LDAP Password: 
 
88
dn: uid=jturner,ou=People,dc=example,dc=com
 
89
changetype: modify 
 
90
replace: userPassword
 
91
userPassword: {SHA512}vSsar3708Jvp9Szi2NWZZ02Bqp1qRCFpbcTZPdBhnWgs5WtNZKnvCXdhztmeD2cmW192CF5bDufKRpayrW/isg==
 
92
 
 
93
modifying entry "uid=jturner,ou=People,dc=example,dc=com"
 
94
 
 
95
$ ldapsearch -b "dc=example,dc=com" -D "uid=jturner,ou=People,dc=example,dc=com" -x -w secret
 
96
 
 
97
 
 
98
Debugging
 
99
---------
 
100
 
 
101
To see what's going on, recompile with SLAPD_SHA2_DEBUG (use the
 
102
commented-out CCFLAGS in Makefile), and then run slapd from the console
 
103
to see stderr:
 
104
 
 
105
$ sudo /etc/init.d/slapd stop
 
106
Stopping OpenLDAP: slapd.
 
107
$ sudo /usr/sbin/slapd -f /etc/ldap/slapd.conf -h ldap://localhost:389 -d 256
 
108
@(#) $OpenLDAP: pkg/ldap/contrib/slapd-modules/passwd/sha2/README,v 1.1.2.1 2009/01/26 21:07:06 quanah Exp $
 
109
        buildd@palmer:/build/buildd/openldap2.3-2.4.9/debian/build/servers/slapd
 
110
/etc/ldap/slapd.conf: line 123: rootdn is always granted unlimited privileges.
 
111
/etc/ldap/slapd.conf: line 140: rootdn is always granted unlimited privileges.
 
112
slapd starting
 
113
...
 
114
Validating password
 
115
  Password to validate: secret
 
116
  Hashes to: K7gNU3sdo+OL0wNhqoVWhr3g6s1xYv72ol/pe/Unols=
 
117
  Stored password scheme: {SHA256}
 
118
  Stored password value: K7gNU3sdo+OL0wNhqoVWhr3g6s1xYv72ol/pe/Unols=
 
119
  -> Passwords match
 
120
conn=0 op=0 BIND dn="cn=admin,dc=example,dc=com" mech=SIMPLE ssf=0
 
121
conn=0 op=0 RESULT tag=97 err=0 text=
 
122
conn=0 op=1 SRCH base="dc=example,dc=com" scope=2 deref=0 filter="(objectClass=*)"
 
123
conn=0 fd=12 closed (connection lost)
 
124
 
 
125
 
 
126
 
 
127
Origin
 
128
------
 
129
 
 
130
Based on code maintained at:
 
131
http://confluence.atlassian.com/display/JIRAEXT/OpenLDAP+support+for+SHA-2+(SHA-256%2C+SHA-384%2C+SHA-512)+and+atlassian-sha1+passwords