OpenLDAP + Blowfish hashes

  |   Source

I have been recently faced to a problem regarding password encryption and support of the encryption in OpenLDAP. Working on an authentication project migration, we have passwords encrypted using Blowfish, we have to migrate them under OpenLdap.


Based on the first article, we understand OpenLDAP can perform authentication with blowfish encrypted passwords using the glibc capabilities and after some investigations, it turns out, slapd deamon is directly using libcrypt shared object to perform the comparison of the hashed passwords.

By doing some more investigations, we have found orignal libcrypt has poor support for password encryption such as Blowfish. Then I found libxcrypt *

libxcrypt is a modern library for one-way hashing of passwords. It supports a wide variety of both modern and historical hashing methods: yescrypt, gost-yescrypt, scrypt, bcrypt, sha512crypt, sha256crypt, md5crypt, SunMD5, sha1crypt, NT, bsdicrypt, bigcrypt, and descrypt.

On Linux-based systems, by default libxcrypt will be binary backward compatible with the shipped as part of the GNU C Library. This means that all existing binary executables linked against glibc’s libcrypt should work unmodified with this library’s

Then I did think about repolacing symbolic link from libcrypt pointing to libxcrypt instead. To achieve that, I did try the package from the disctribution but it did not work due to GLIBC_VERSION. Then, let's compile this library and deploy it:


apt-get install autotools libtool make
    cd /tmp
    tar xzf v4.4.3.tar.gz
    cd libxcrypt-4.4.3/
    ./bootstrap && ./configure && make
    cp .libs/ /lib/x86_64-linux-gnu
    rm /lib/x86_64-linux-gnu/ && ln -s /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/

Be careful, if by chance you screw the link, the linux login will fail. Means, no more sudo or any other tool required by authentication.

Comments powered by Disqus