Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save felag/87c1616a5c2d98c091d0b1172c2413e9 to your computer and use it in GitHub Desktop.
Save felag/87c1616a5c2d98c091d0b1172c2413e9 to your computer and use it in GitHub Desktop.
HOW TO fix openLDAP checksum error on config files
(source : http://injustfiveminutes.com/category/openldap)
How to fix “ldif_read_file: checksum error”
Posted on October 28, 2014
15
Well, in spite of you did read a banner saying “# AUTO-GENERATED FILE – DO NOT EDIT!! Use ldapmodify.” you ignored it and made some manual modifications in any of the LDIF files in /etc/ldap/slapd.d/.
Don’t worry it happened to me too :) When you need to quickly setup an openLDAP server for development it is pretty much easier to tweak these files although the recommended way is to use ldapmodify tool. But if you change the LDIF files in cn=config manually, their contents and checksums won’t match, which is not fatal, but is annoying when using tools such as slapcat:
544f7291 ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={1}monitor.ldif"
544f7291 ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif"
To fix it you have to recalculate their checksums, please follow the following steps:
1. Copy the errant file to an temporary directory (for example olcDatabase={2}hdb.ldif).
# cp /etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif /tmp
2. Remove the first two lines of that file where it is included the old checksum value
# tail -n +3 /tmp/olcDatabase={2}hdb.ldif > fixed.ldif
3. Download the Check CRC tool from http://freecode.com/projects/checkcrc/
4. Extract the downloaded file
# tar xvfz check-4.3-src.tgz
5. Install the zlib development RPM package (or use APT on Debian based systems)
# yum install zlib-dev
6. Compile the check CRC tool:
# cd check-4.3
check4-3# gcc -O3 -Wall -DUSE_ZLIB -I/usr/include -o check check.c -L/usr/lib64 -lz
7. Calculate the new checksum
check-4.3# ./check /tmp/fixed.ldif
fixed.ldif CRC-32 = 61e6182a, size = 582 bytes
8. Replace the new CRC-32 value into the original file using your favourite editor
# vi /etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif
AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.
CRC32 61e6182a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment