An OpenLDAP administration tool to audit, sanitize, and fix the slapd.d configuration directory
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Benjamin Renard 674bdb44a3
All checks were successful
Run tests / test-precommit (push) Successful in 1m48s
Upgrade pre-commit ruff hook
2026-07-13 20:09:54 +02:00
.forgejo/workflows CI: use nfpm to build Debian package 2026-07-13 20:09:53 +02:00
.chglog.yml CI: use nfpm to build Debian package 2026-07-13 20:09:53 +02:00
.gitignore CI: use nfpm to build Debian package 2026-07-13 20:09:53 +02:00
.pre-commit-config.yaml Upgrade pre-commit ruff hook 2026-07-13 20:09:54 +02:00
.pylintrc Implement check & fix gaps in numbered lines, line length errors & non-ASCII characters presence 2026-07-13 19:56:35 +02:00
.yamllint.yml Upgrade pre-commit hooks & switch to my custom pylint pre-commit hook 2026-07-03 10:48:32 +02:00
check_slapdd CI: use nfpm to build Debian package 2026-07-13 20:09:53 +02:00
nfpm.yaml CI: use nfpm to build Debian package 2026-07-13 20:09:53 +02:00
README.md Rename project as check_slapdd and update README file 2026-07-13 20:09:52 +02:00
setup.cfg Implement check & fix gaps in numbered lines, line length errors & non-ASCII characters presence 2026-07-13 19:56:35 +02:00

check_slapdd

An OpenLDAP administration tool to audit, sanitize and fix the slapd.d configuration directory.

This script ensures your OpenLDAP configuration files remain structurally valid, compliant with official specifications and perfectly indexed.

Features

  • CRC32 Verification & Fixing: Validates the native OpenLDAP checksum headers (# CRC32 ...) and recalculates them accurately.
  • Line Length Compliance: Detects physical lines exceeding a configurable maximum character limit (default: 78 characters). It automatically unfolds continuations for safe processing and refolds lines cleanly using the leading-space standard upon writing.
  • ASCII Integrity Enforcement: Ensures files contain only pure ASCII characters. Malformed or non-ASCII content trigger an alert and normalize.
  • RDN & Filename Alignment: Aligns internal RDN attribute values with the actual filename and its structural index.
  • Re-indexing multi-valued attributes & numbered configuration files and directories:
    • Fixes internal index gaps for multi-valued attributes (e.g., olcAccess).
    • Fixes sequence gaps and duplicates for numbered configuration files and directories (e.g., cn={1}cosine.ldif) with cascading DN updates.

Requirements

This script only requires common python3 core modules (no additional packages to install on Debian-based systems).

Installation

git clone https://gitea.zionetrix.net/bn8/check_slapdd.git /usr/local/src/check_slapdd
ln -s /usr/local/src/check_slapdd/check_slapdd /usr/local/sbin/check_slapdd

Usage

usage: check_slapdd [-h] [-d] [-v] [-l LOG_FILE] [-C] [-f] [-p SLAPDD_PATH]
                    [-m MAX_LINE_LENGTH]

Tool to detect & fix errors in OpenLDAP slapd.d directory (version: dev)

options:
  -h, --help            show this help message and exit
  -d, --debug           Show debug messages
  -v, --verbose         Show verbose messages
  -l, --log-file LOG_FILE
                        Log file path
  -C, --console         Also log on console (even if log file is provided)
  -f, --fix             Fix errors detected in LDIF files
  -p, --path SLAPDD_PATH
                        Default slapd.d directory path or a unique file path
                        (default: /etc/ldap/slapd.d)
  -m, --max-line-length MAX_LINE_LENGTH
                        Default line max length of LDIF files (default: 78)

Copyright (c) 2014-2026 Benjamin Renard

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.