Bug 54140 - U@S ACLs slow down - univention-bind-ldap fails to start
U@S ACLs slow down - univention-bind-ldap fails to start
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: LDAP
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 5.0-2-errata
Assigned To: Johannes Königer
Arvid Requate
https://git.knut.univention.de/univen...
:
Depends on: 50662
Blocks: 54108
  Show dependency treegraph
 
Reported: 2021-11-24 23:01 CET by Philipp Hahn
Modified: 2022-09-09 10:56 CEST (History)
7 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?: 5: Blocking further progress on the daily work
User Pain: 0.286
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2021111821000635, 2019121221000845
Bug group (optional): Large environments
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2021-11-24 23:01:28 CET
In a large school environment starting up BIND9-LDAP takes up 6+ minutes.

univention-bind-ldap.service does this:

> LB=$(ucr get ldap/base) DNS=$(ucr get domainname)
> time ldapsearch -x -D "$(ucr get ldap/hostdn) -y /etc/machine.secret -b "zoneName=$DNS,cn=dns,$LB" -s sub "(zoneName=$DNS)" 1.1 | grep -c ^dn
> 54087
> real    41,353s

The slowness seems to be caused by LDAP ACLs as both

> time ldapsearch -x -D "cn=admin,$LB" -y /etc/ldap.secret …
> 55124
> real    0,705s 

and

> time ldapsearch -QY EXTERNAL -H ldapi:/// …
> 55124
> real    0,539s 

are fast; the first ignores all ACLs and the second is allow-listed very early.

+++ This bug was initially created as a clone of Bug #54108 +++
Comment 2 Johannes Königer univentionstaff 2022-07-19 17:31:37 CEST
Proposed changes:
https://git.knut.univention.de/univention/ucsschool/-/merge_requests/128
Also see comments in https://git.knut.univention.de/univention/ucs/-/issues/809 for the possible performance gains.
Comment 3 Johannes Königer univentionstaff 2022-09-06 13:54:27 CEST
MR https://git.knut.univention.de/univention/ucs/-/merge_requests/464 was merged and package univention-ldap was built:

univention-ldap (16.0.7-23)
baf56f9d6638 | Bug #54140: Faster access to DNS-Zone objects for machine account

Scenario specific access directive for acl-master and acl-slave in package univention-ldap, which provides faster read times for DNS-Zone objects. See https://git.knut.univention.de/univention/ucs/-/merge_requests/464 for details.
Comment 4 Arvid Requate univentionstaff 2022-09-06 14:43:53 CEST
Verified:
* Code review
* Package update
* Functional test (just slapd)
* Advisory
Comment 5 Julia Bremer univentionstaff 2022-09-07 08:42:01 CEST
The initial Setup of a DC doesn't work anymore because slapd never starts up. 
the ucr variable ldap/hostdn is not set until the joinscript 
10univention-ldap-server.inst runs. 

This is never reached, well, because the slapd never starts up, packages can't be configured etc. 

The ACL then looks like this
# Bug #54140: There are systems with a large amount (>50000) of DNS-Zone objects,
# the following access directive provides a faster access for services which have to
# read all of them via the machine account (like Bind9 on nodes without samba).
access to dn.children="cn=dns,dc=autotest090,dc=local" filter="(objectClass=dNSZone)"
    by dn="" read
    by * +0 break

And slaptest complains
63183c82 /etc/ldap/slapd.conf: line 208: missing "=" in (or value after) "dn" in by clause


I can see that we solved this before by making the ACL conditional on the existence of that ucr variable something like this in the template
if configRegistry['ldap/hostdn']
Comment 10 Johannes Königer univentionstaff 2022-09-07 15:39:14 CEST
Fixed with MR: https://git.knut.univention.de/univention/ucs/-/merge_requests/504

Commit:

cd2d11815b2 | Bug #54140: Do not use access control entry if ldap/hostdn is not set
Comment 11 Arvid Requate univentionstaff 2022-09-07 16:34:37 CEST
Verified:
* Code is now robust against ldap/hostdn not set
* Package update
* Functional test (also with unset ldap/hostdn)
* Advisory