LDAP attribute mapping

NethServer Version: 7.9.2009
Module: nethserver-directory
Nethserver LDAP maps:
uid => shortname
cn => full name

When binding to an external LDAP, is it possible to alter those settings?
The external LDAP is a Synology. It has full name in “gecos”,
while cn & uid both hold the shortname.

So I want the full name to be retrieved from gecos instead of cn.

Maybe this helps to clarify my question:
In Nextcloud this setting is in
“LDAP/AD integration” => “Advanced” => “Directory Settings”
and it is called “User Display Name Field”

Here’s another thread about a similar issue:

Maybe we should fix this and add a db prop to disable the default config to make remote LDAP joins more flexible?

As a workaround you could use a custom config (for instance s02 copied from the NethServer one) by adding an event that disables the s01 config used by autoconfiguration.

Create an action script /etc/e-smith/events/actions/nethserver-nextcloud-occ-conf-disable with following content:

occ ldap:set-config s01 ldapConfigurationActive 0

Make it executable:

chmod +x /etc/e-smith/events/actions/nethserver-nextcloud-occ-conf-disable

Add the action to the events by creating symlinks:

ln -s ../actions/nethserver-nextcloud-occ-conf-disable /etc/e-smith/events/nethserver-nextcloud-update/S31nethserver-nextcloud-occ-conf-disable

ln -s ../actions/nethserver-nextcloud-occ-conf-disable /etc/e-smith/events/nethserver-nextcloud-save/S31nethserver-nextcloud-occ-conf-disable

Apply the config:

signal-event nethserver-nextcloud-update

Now config s01 is disabled and your custom config should work if enabled.

This workaround should also work when NC is updated.

If something breaks, just remove the created files and symlinks and run signal-event nethserver-nextcloud-update

2 Likes

THX!
Yes a little bit more flexibility would be great.
Seems to be a tough workaround - I will try that first in a test environment :wink:

2 Likes