UP | HOME
niols.fr

How to fix "ldif_read_file: checksum error"

57aaf7bb ldif_read_file: checksum error on "/etc/ldap/slapd.d/cn\=config/olcDatabase\=\{0\}config.ldif"

Haha, guess you decided that the following warning wasn't for you ;)

# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.

Don't worry, I did too… Actually, I still think it's the most convenient way of editing the configuration.

This warning happens because each configuration file comes with a CRC32 checksum. And since we modified the file, the checksum does not match with the content. There is an easy fix: we just have to calculate the new checksum of the file, and replace the old one.

First compute the CRC32 checksum of the annoying file without the first two lines, that should look that way:

# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.
# CRC32 076ce9f1

On Debian, you can get it with the following line (you will need the libarchive-zip-perl package to have the crc32 utility):

crc32 <(cat /etc/ldap/slapd.d/cn=config/olcDatabase={0}config.ldif | tail -n +3)

Replace then the CRC32 value you just obtained in the second line of the file. And you're done!

niols.fr — Copyright © 2017 Nicolas “Niols” Jeannerod