Migrating the LDAP configuration from application.yml

LDAP providers that are configured in application.yml (or via LDAP_* environment variables) can be moved to the LDAP configuration in the Relution portal →. The provider name is what matters: if it matches the previous name exactly, Relution recognizes the users and groups it has already imported and updates them instead of creating them again.


Prerequisites

The migration requires the following:

  • A paid license with the LDAP UI Connections feature. Providers in application.yml do not need this license, providers in the Relution portal do.
  • Write access to application.yml or the environment variables of the Relution server, and the ability to restart the server.
  • Access to the server log of the last start (see Relution Logs →).
  • An administrator account in the organization the provider is currently assigned to (organizationUniqueName in application.yml), or in the global or a meta organization if the provider distributes objects to several organizations.

Procedure

The migration takes four steps:

  1. Determine the current provider name.
  2. Create the provider in the Relution portal with exactly this name and copy the remaining values.
  3. Remove the provider from application.yml and restart the server.
  4. Verify the result.

The order matters. As long as the provider exists in application.yml, it takes precedence. A provider with the same name in the Relution portal can be saved and tested, but only becomes active once the YAML provider has been removed and the server restarted. If the YAML provider is removed first, LDAP users cannot sign in until the provider has been created in the portal.


Determine the provider name

Relution stores the name of the provider on every imported user and group. During synchronization and sign-in, only objects with exactly this name are assigned to the provider, including upper and lower case and spaces.

If the name in the Relution portal differs, Relution does not find the existing users again. The synchronization reports them as duplicates, the users can no longer sign in, and groups are created a second time. The Provider name cannot be changed after saving.

Name in application.yml

In application.yml, LDAP providers are listed under the ldap key. The name is determined as follows:

  • If the provider has a name property, its value is the name.
  • If name is missing, the provider’s key is the name, i.e. the entry directly under ldap.

In the following example, the first provider is named School North, the second administration:

ldap:
  north:
    name: School North
    ldap_urls:
      - ldaps://dc1.school.local:636
    ldap_base: dc=school,dc=local
  administration:
    ldap_urls:
      - ldap://dc2.administration.local:389
    ldap_base: dc=administration,dc=local

Name when configured via environment variables

The default key is an exception. Relution ships a built-in preset for it that is filled from environment variables (LDAP_URL, LDAP_BASE etc.), for example in Docker installations. This preset sets the name to the value of LDAP_NAME. If LDAP_NAME is not set, the name is <ORGA_NAME> LDAP Configuration, where <ORGA_NAME> is the value of the environment variable of the same name. This also applies if ldap.default appears in a custom application.yml without name.

Check the name in the server log

Regardless of how it is derived, the server log shows the name actually used. At startup, Relution writes a line like this for every provider from application.yml:

Register static LDAP security provider with name "School North" (ContextRefreshedEvent)

The text between the quotation marks is what counts. It is copied to the Relution portal unchanged, including all spaces.


Create the provider in the Relution portal

The new provider is created in the organization the YAML provider is currently assigned to:

  1. Open Settings → LDAP synchronisation and click Add.
  2. Enter the determined name exactly in the Provider name field.
  3. Copy the remaining values from application.yml to the corresponding fields (see table below).
  4. Set When an LDAP user is not found to Disable the user in Relution at most, even if application.yml was configured with delete.
  5. Check the connection with Test network connection and Test authentication, then the imports with Test user import and Test group import.
  6. Save the configuration.

The restriction in step 4 applies to the first synchronization after the migration. If a filter was copied incorrectly, this synchronization does not find some of the users. With Delete the user from Relution, these users and their links would be removed irrevocably; if a later synchronization finds them again, new accounts are created without the previous device and group assignments. Disabled users, on the other hand, are kept with all their links and are enabled again automatically by the next synchronization once the filter is corrected, unless they are locked in the LDAP itself. If a synchronization returns no results at all, Relution always applies Do nothing as a precaution.

Most values can be copied as they are. Keys in application.yml may be written in different styles (ldap_base, ldap-base or ldapBase); the table shows the common form.

Key in application.ymlField in the Relution portalDescription
name or keyProvider nameCopy exactly, see Determine the provider name
ldap_urlsLDAP Server URLsEnter each URL separately and confirm with Enter
ldap_userDnBind DN or userUnchanged
_ldap_passwordBind passwordUnchanged. The portal has no ldap_password_url; the password is entered directly
ldap_baseBase DNUnchanged
trustAllCertificatesTrust all certificatesEnabled by default in application.yml, but not in the portal. For LDAPS, store the server certificate under Trusted server certificates
user_searchBase, user_searchFilterTemplateUser search base, User search filterUnchanged
user_searchScopeUser search scope0 = Object, 1 = One level, 2 = Subtree
manual_user_mapping, user_attribute_*Manual user attribute mappingAttribute names unchanged, especially user_attribute_foreignKey
sync_users, sync_intervalPeriodic user import, Synchronization timeThe portal synchronizes once a day at a fixed time instead of at an interval
sync_users_action_when_missingWhen an LDAP user is not foundnone = Do nothing, disable = Disable the user in Relution, delete = Delete the user from Relution
group_syntheticGroupSynthetic groupSee Synthetic groups
group_useGroupsImport groups of imported usersUnchanged
sync_groupsPeriodic group importTime as for users
group_searchBase, group_searchFilterTemplate, group_searchScopeGroup search base, Group search filter, Group search scopeUnchanged
manual_group_mapping, group_attribute_*Manual group attribute mappingAttribute names unchanged
edu_*, sync_edu_objectsEducation sectionSearch bases, filters and search scopes unchanged
organization*FiltersMap objects to organizationsOnly in the global or a meta organization, filters per target organization

Some options of application.yml have no equivalent in the Relution portal and are dropped during the migration:

  • Filter-based synthetic groups (syntheticGroup_<Name>, syntheticGroup_json) and additional group assignments via groupRoles_json (see Synthetic groups).
  • Synchronization intervals (sync_interval, sync_groups_interval); there is only the daily time.
  • ldap_password_url, connection timeouts, user_acl/group_acl and the configuration-template for several organizations. For the template, a separate provider is created per organization, or the distribution is set up via Map objects to organizations.

Synthetic groups

The Relution portal supports only one synthetic group per provider: the group that all users imported through the provider are added to. It corresponds to group_syntheticGroup in application.yml.

  • Value present: The same value is entered in the Synthetic group field, without the organization prefix. group_syntheticGroup: LDAP Users becomes LDAP Users, and the existing group MYORG LDAP Users is kept.
  • No value present: The field is prefilled with LDAP in the portal and is cleared. Otherwise the first synchronization creates a new group MYORG LDAP.

Filter-based synthetic groups (syntheticGroup_<Name>: <LDAP filter>) and assignments via groupRoles_json are not supported by the portal. These groups are deleted in Relution by the first successful synchronization after the migration, together with the roles and permissions assigned to them. This cannot be turned off. Required groups are created in the LDAP instead and imported via group synchronization. Roles and permissions previously attached to such a group are then assigned to the imported LDAP group.

Before the migration, create the groups in the LDAP, add their members and note the roles and permissions of the previous synthetic groups. Once the groups have been deleted, these assignments can no longer be traced in Relution.

Remove the YAML configuration

application.yml is only read when the server starts. For the provider from the Relution portal to become active, the YAML provider is removed and the server restarted:

  1. Delete the provider’s section under ldap from application.yml. When configured via environment variables, remove the LDAP_* variables, at least LDAP_BASE: without a base DN, Relution does not register the default provider.
  2. Restart the Relution server.

If the YAML provider remains, Relution writes a warning to the log at startup, and the provider with the same name in the portal stays inactive:

Cannot register dynamic security provider "School North" (…), conflicts with an existing static provider

Later changes to the provider in the Relution portal take effect immediately; no restart is required.


Verify the result

After the restart, the migration is verified as follows:

  1. The server log no longer contains a line Register static LDAP security provider for the provider, and no warning conflicts with an existing static provider.
  2. Under Settings → LDAP synchronisation, select the provider and click Start synchronization.
  3. On the provider’s detail page, the synchronization result shows updated users and groups, but no errors such as “could not be synced because it is a duplicate of”.
  4. An LDAP user signs in to the Relution portal or a Relution app as a test.

If the result is correct, When an LDAP user is not found can be switched to Delete the user from Relution if required.

If the synchronization reports duplicates, the Provider name does not match the previous name. Since the name cannot be changed, the provider is deleted in the portal and created again with the correct name.


How helpful was this article?