Offline editing slapd cn=config

This is a simple shell script that recalculates the CRC32 checksum contained in the LDIF files of the dynamic cn=config directory (usually /etc/ldap/slapd.d/).

It can be used (at your own risk) while slapd is down. It is useful in testing environments with a single slapd. Other uses are not encouraged.

basedir=`dirname "$1"`
tmpfile=`mktemp --tmpdir="$basedir"` || exit 1
tail -n +3 "$1" > "$tmpfile"
${EDITOR:-vim} "$tmpfile"
echo -en "# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.\n# CRC32 " > "$1"
crc32 "$tmpfile" >> "$1"
cat "$tmpfile" >> "$1"
rm -fv "$tmpfile"

Trackback URL for this post:


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <br> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <fieldset> <legend> <h6> <span> <img> <div> <p>
  • Lines and paragraphs break automatically.

More information about formatting options

Refresh Type the characters you see in this picture.
Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.