Jonathan Abbey wrote:
On Thu, Jan 04, 2007 at 09:55:25PM +0100, Pierangelo Masarati wrote:
| This doesn't look like a MD5 password; the value slapd expects is | something like | | slappasswd -h '{md5}' -s testpw | {MD5}ju4+/d4ets9mOaWISDYr9A== | | Your value looks much like some extension to crypt(3) that allows to use | strong(er) encryption than usual crypt(3) by providing a specially | crafted salt. In that case, assuming you compiled slapd with {CRYPT} | support using the same crypt(3) that generated that hash you should be | able to use that secret by using the {CRYPT} scheme instead of {MD5}. | You need to realize, of course, that this data is not portable.
That's a bit strong. The algorithm in question is the MD5Crypt algorithm, which originated in FreeBSD, and is now supported in FreeBSD, OpenBSD, Linux, Solaris, and Mac OS X, among others, presumably, as well as in Apache (though very slightly mutated in Apache, for no good reason). In addition, there are libraries available in lots of languages which implement this algorithm.
The MD5Crypt algorithm has a couple of nice properties which make it far stronger than simple MD5 usage.
First, it is salted, so as to resist dictionary attacks against leaked hash text.
Second, it incorporates 1000 rounds of md5 so as to try and increase the cpu requirements for a password match, again for the purpose of resisting attack against the hash text. This level of CPU intensity is hardly meaningful in current systems, but it is some small level of protection still.
A good discussion of secure password formats can be found at
http://www.openbsd.org/papers/bcrypt-paper.ps
for those interested.
It's a pity that OpenLDAP does not support MD5Crypt, but for the present purposes, it's probably more a pity that it is so easy for naive users to confuse MD5 hashing with MD5Crypt.
OpenLDAP does support MD5Crypt. For that matter use {crypt} and define a different salt method in your slapd.conf (see password-crypt-salt-format in slapd.conf man page).
Linux and *nix systems that support MD5Crypt usually support and recognize both ciphers out-of-the-box since they are in fact different at plain sight. If using {crypt} you can in fact mix old crypt and md5crypt in your database. The salt method defined in slapd.conf is only used for LDAP password modify extended operations.
Hugo Monteiro.
Jon
| p. | which is base64 encoded; the non-base64 string is expected to be 16 | bytes long (128 bits). | | p. | | Ing. Pierangelo Masarati | OpenLDAP Core Team | | SysNet s.n.c. | Via Dossi, 8 - 27100 Pavia - ITALIA | http://www.sys-net.it | ------------------------------------------ | Office: +39.02.23998309 | Mobile: +39.333.4963172 | Email: pierangelo.masarati@sys-net.it | ------------------------------------------