Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dimitar Stoychev
OpenLDAP
Commits
e8c03ba5
Commit
e8c03ba5
authored
4 years ago
by
Ondřej Kuzník
Committed by
Quanah Gibson-Mount
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ITS
#7786
Document cn=config recovery options
parent
2ddcb121
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/guide/admin/slapdconf2.sdf
+82
-0
82 additions, 0 deletions
doc/guide/admin/slapdconf2.sdf
with
82 additions
and
0 deletions
doc/guide/admin/slapdconf2.sdf
+
82
−
0
View file @
e8c03ba5
...
...
@@ -34,6 +34,8 @@ Note: Although the {{slapd-config}}(5) system stores its configuration
as (text-based) LDIF files, you should {{1:never}} edit any of
the LDIF files directly. Configuration changes should be performed via LDAP
operations, e.g. {{ldapadd}}(1), {{ldapdelete}}(1), or {{ldapmodify}}(1).
For offline modifications (when the server is not running), use {{slapadd}}(8)
and {{slapmodify}}(8).
Note: You will need to continue to use the older {{slapd.conf}}(5)
...
...
@@ -1117,3 +1119,83 @@ if you are not using the default directory path.
Note: When converting from the slapd.conf format to slapd.d format, any
included files will also be integrated into the resulting configuration
database.
H2: Recovering from a broken configuration
If the server using {{cn=config}} does not start, either because the
configuration does not represent the current version or because it has been
corrupted, these actions are available, in the order of decreasing preference.
Make sure you have made a backup of the "broken" version before you attempt any
of these:
H3: Generate an ldif version of the configuration database and reload from that
Most of the time, the configuration can be parsed and a text version generated
with {{slapcat}}(8):
> slapcat -F /usr/local/etc/openldap/slapd.d -n0 -l extracted_config.ldif
After you have backed up and removed the old configuration database contents,
this output ldif can be hand-edited to adjust or remove the offending entries
and imported again:
> slapadd -F /usr/local/etc/openldap/slapd.d -l updated_config.ldif
> slaptest -F /usr/local/etc/openldap/slapd.d
H3: Modify config in-place
If the configuration can be parsed and you know exactly what you need to do,
you can use {{slapmodify}}(8) to effect the required changes directly:
> slapmodify -F /usr/local/etc/openldap/slapd.d
> dn: ..., cn=config
> changetype: ...
> ...
H3: Recover with plain back-ldif
If the configuration contains items that {{slapd}}(8) cannot process as a
{{cn=config}} database at all, the last resort is to disable schema checking
and operate on it as a regular back-ldif database. This might cease to work
with future versions of OpenLDAP without notice, attempt this only when all of
the above fail.
First, create a directory to serve as the hosting DB and create the structure:
> mkdir ./recovery ./recovery/cn=recovery
> cp /usr/local/etc/openldap/slapd.d/cn=config.ldif ./recovery/cn=recovery
> cp -r /usr/local/etc/openldap/slapd.d/cn=config ./recovery/cn=recovery
Or, if you have already backed up your old configration, you can symlink it
into place:
> mkdir ./recovery
> ln -s /usr/local/etc/openldap/slapd.d ./recovery/cn=recovery
Next, create a trivial {{slapd.conf}}(5) to access the new database:
> database ldif
> suffix cn=recovery
> directory ./recovery/
Note the change of suffix, {{EX:cn=config}} is hardcoded to correspond to an
active config database, so we have to home it one level deeper - at
{{EX:cn=config,cn=recovery}}.
Now you can use {{slapmodify}}(8) to modify the database, it is most likely you
will need to run with schema checking disabled:
> slapmodify -f ./recovery.conf -s
You can test the validity of your config with {{slaptest}}(8):
> slaptest -F ./recovery/cn=recovery
And generate a full ldif with {{slapcat}}(8):
> slapcat -F ./recovery/cn=recovery -n0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment