Bug 54986 - slap tools will not work anymore if /etc/ldap/slapd.d/config.ldif exists
slap tools will not work anymore if /etc/ldap/slapd.d/config.ldif exists
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: LDAP
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 5.0-2-errata
Assigned To: Nikola Radovanovic
Arvid Requate
https://git.knut.univention.de/univen...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-07-14 07:24 CEST by Dirk Schnick
Modified: 2023-02-01 17:24 CET (History)
9 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.171
Enterprise Customer affected?: Yes
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2022071321000212, 2022112821000249
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Schnick univentionstaff 2022-07-14 07:24:41 CEST
As discussed internal we should open a bug for this issue. In the customer environment the directory and config /etc/ldap/slapd.d/ exist (how ever). As this is the OpenLDAP Default, this may happen by inexperienced UCS user or maybe by installing software.
If the situation is in place it was not easy for the support to find the reason slapd was not willing to start any more.

A manual start leeds into:
olcAccess: {19}to dn.regex="^cn=([^,]+),cn=apps,cn=univention,dc=dc0,dc=testenv,dc=de$"  attrs=children,entry,@organizational>>> dnPrettyNormal: <olcDatabase={1}mdb>
=> ldap_bv2dn(olcDatabase={1}mdb,0)
<= ldap_bv2dn(olcDatabase={1}mdb)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(olcDatabase={1}mdb)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(olcDatabase={1}mdb)=0
62cecb7f <<< dnPrettyNormal: <olcDatabase={1}mdb>, <olcDatabase={1}mdb>
62cecb7f >>> dnNormalize: <dc=dc0,dc=testenv,dc=de>
=> ldap_bv2dn(dc=dc0,dc=testenv,dc=intranet,0)
<= ldap_bv2dn(dc=dc0,dc=testenv,dc=de)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=dc0,dc=testenv,dc=de)=0
62cecb7f <<< dnNormalize: <dc=dc0,dc=testenv,dc=de>
62cecb7f >>> dnNormalize: <cn=admin,dc=dc0,dc=testenv,dc=de>
=> ldap_bv2dn(cn=admin,dc=dc0,dc=testenv,dc=intranet,0)
<= ldap_bv2dn(cn=admin,dc=dc0,dc=testenv,dc=de)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=admin,dc=dc0,dc=testenv,dc=de)=0
62cecb7f <<< dnNormalize: <cn=admin,dc=dc0,dc=testenv,dc=de>
62cecb7f <= str2entry: str2ad(olcDbMaxReaders): attribute type undefined
62cecb7f UNKNOWN attributeDescription "OLCDBMAXREADERS" inserted.
62cecb7f <= str2entry: str2ad(olcDbMaxSize): attribute type undefined
62cecb7f UNKNOWN attributeDescription "OLCDBMAXSIZE" inserted.
62cecb7f <= str2entry: str2ad(olcDbRtxnSize): attribute type undefined
62cecb7f UNKNOWN attributeDescription "OLCDBRTXNSIZE" inserted.
62cecb7f >>> dnNormalize: <cn=config>
=> ldap_bv2dn(cn=config,0)
<= ldap_bv2dn(cn=config)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=config)=0
62cecb7f <<< dnNormalize: <cn=config>
62cecb7f >>> dnNormalize: <cn=config>
=> ldap_bv2dn(cn=config,0)
<= ldap_bv2dn(cn=config)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=config)=0
62cecb7f <<< dnNormalize: <cn=config>
62cecb7f <= str2entry(olcDatabase={1}mdb) -> 0x563befded188
62cecb7f : config_add_internal: DN="olcDatabase={1}mdb,cn=config" no structural objectClass in configuration table
62cecb7f config error processing olcDatabase={1}mdb,cn=config:
62cecb7f send_ldap_result: conn=-1 op=0 p=0
62cecb7f send_ldap_result: err=65 matched="" text=""
62cecb7f slapd destroy: freeing system resources.
62cecb7f slapd stopped.
62cecb7f connections_destroy: nothing to destroy.

This was information was the the point we found the reason:
cn=config` is the OpenLDAP configuration database (`/etc/ldap/slapd.d/`), which replaced the file `/etc/ldap/slapd.conf`. We do *NOT* use this in UCS:
`slapd -f /etc/ldap/slapd.conf` should make sure it stays so; make sure this is used.
If you have `/etc/ldap/slapd.d/` make sure there is no `cn=config.ldif` within; otherwise the OpenDLAP tools will default to use that instead of the legacy `slapd.conf`.
Comment 1 Philipp Hahn univentionstaff 2022-07-14 16:03:13 CEST
We explicitly use `slapd -f /etc/ldap/slapd.conf` to start the server, so `/etc/ldap/slapd.d/` does *not* get used even when it exists.

We also use the same option when doing `slapadd` or `slapcat` or `slaptest` as they implement the same logic. Actually this is note the case everywhere.

FYI: management/univention-ldap/01univention-ldap-server-init.inst has code the (re-)move /etc/ldap/slapd.d/cn=config.ldif during join.
Comment 2 Florian Best univentionstaff 2022-07-14 18:43:14 CEST
we should add "-f /etc/ldap/slapd.conf" to the slaptest calls in:
management/univention-ldap/scripts/ldap_setup_index
management/univention-directory-listener/doc.34355/common.sh
Comment 3 Daniel Duchon univentionstaff 2022-11-29 09:16:12 CET
Another customer is affected from this. On one server, the file /etc/ldap/slapd.d/cn=config.ldif wasn't removed at univention-join and caused slapindex to not build the index.

This resulted in students could no longer be searched for in a school environment and exam mode could not be started/finished.

After renaming the file to /etc/ldap/slapd.d/cn=config.ldif.DISABLED, slapindex worked again and students can be found again.
Comment 4 Dirk Wiesenthal univentionstaff 2022-12-16 10:20:26 CET
A simple diagnostic module may suffice
Comment 8 Nikola Radovanovic univentionstaff 2023-01-24 12:54:28 CET
977fa552f1 | slapd will not start anymore if /etc/ldap/slapd.d/config exists
db520a072f | Advisory update
Comment 9 Arvid Requate univentionstaff 2023-01-25 11:36:51 CET
As discussed, doesn't work:
======
root@primary20:~# touch /etc/ldap/slapd.d/cn=config.ldif
root@primary20:~# slapindex 

WARNING!
Runnig as root!
There's a fair chance slapd will fail to start.
Check file permissions!

63c92889 str2entry: entry -1 has no dn
slapindex: bad configuration file!
======



1. The /etc/default/slapd is not considered by the openldap slap* tools
2. management/univention-ldap/conffiles/etc/init.d/slapd already hardcodes SLAPD_CONF

I think we need to go with Nikolas proposal from Comment 7
Comment 11 Nikola Radovanovic univentionstaff 2023-01-27 17:23:13 CET
977fa552f1 | slapd will not start anymore if /etc/ldap/slapd.d/config exists
db520a072f | Advisory update
582624808f | slap tools must also work in case /etc/ldap/slapd.d/cn=config.ldif exists (even if invalid)
3a386a5a70 | workaround for linkcheck blocking work
11db6cc221 | remove advisory for ucs-test
aab45bfd22 | Advisory update
Comment 12 Arvid Requate univentionstaff 2023-01-27 17:57:48 CET
Verified:
* Code review
* Package update
* Advisory

We'll need to release the documentation changes too.
* doc/ext-performance
* doc/ext-domain
* doc/manual