-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for DN's to have {x} prefix on first RDN #5450
Conversation
recheck |
Co-authored-by: Felix Fontein <felix@fontein.de>
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and it doesn't break for me. Would be great if someone with better LDAP knowledge could also review this :)
@rekup since you're also interested in the LDAP modules, maybe you can take a look here? |
Co-authored-by: Felix Fontein <felix@fontein.de>
If nobody complains, I'll merge this tomorrow. |
@mrvanes thanks for your contribution! |
) * Allow for DN's to have {x} prefix on first RDN * Update changelogs/fragments/5450-allow-for-xordered-dns.yaml Co-authored-by: Felix Fontein <felix@fontein.de> * Assign attrs to throw-away var * Update plugins/module_utils/ldap.py Co-authored-by: Felix Fontein <felix@fontein.de> * Escape DN before creating filter Co-authored-by: Felix Fontein <felix@fontein.de>
) * Allow for DN's to have {x} prefix on first RDN * Update changelogs/fragments/5450-allow-for-xordered-dns.yaml Co-authored-by: Felix Fontein <felix@fontein.de> * Assign attrs to throw-away var * Update plugins/module_utils/ldap.py Co-authored-by: Felix Fontein <felix@fontein.de> * Escape DN before creating filter Co-authored-by: Felix Fontein <felix@fontein.de>
SUMMARY
Allow for DN's to have {x} prefix on first RDN.
This is an extension to #5385
ISSUE TYPE
COMPONENT NAME
ldap
ADDITIONAL INFORMATION
It turns out that in OpenLDAP's
cn=config
, DN's can be ordered as well and configuring OpenLDAP through ansible therefor is quite cumbersome.See the following example:
Suppose I want to enable slapd monitoring via
cn=config
. I would need to addback_monitor
tocn=module{0},cn=config
which is now correctly handled by #5385. However, I would also need to add a DN:This entry, however will show up in
cn=config
asolcDatabase={2}monitor.ldif
and subsequent runs will fail because a monitor database can only be added once here.This problem can be solved by explicitly specifying the
{2}
prefix in the task, but I think it would be nice to let users add the bare DN and not have to think about the consequences of ordering.The change tries to find the DN by searching
ONELEVEL
below the superior RDN for the first RDN. It goes at length to be backwards compatible by falling back to the original configured DN if anything unexpected happens. Only if searching results in one and only one result, the newly found DN is returned, possibly updating the bare version with the ordered prefix one.