Skip to content

Managing users via Directory Synchronization

Attention

This feature currently requires a user with System Administrator privileges. It will become available for other privilege levels in a later release.

ad-connect users from a local user directory can be integrated seamlessly into Kopano Cloud.

Create new sync configuration

A synchronisation configuration defines how the system should synchronise directory information, such as users from an external source, an Active Directory or an LDAP server. To identify a new set of synchronisation configuration settings, start by selecting a name. It is recommended that you choose something unique, such as the name of the synchronisation server.

To add a new synchronisation configuration, please follow the instruction shown below, and on your screen:

Add new synchronization configuration
Adding new synchronization configuration

After inputting all settings, please click on Add synchronization. This will prompt the system to present you both with the Application ID and Secret Token.

Important

Please take note of the secret, as it will only be shown once.

Synchronization configuration overview
Synchronization configuration overview

The synchronisation configuration overview page shown below, provides you a download link for ad-connect, and is able to show whether a client is currently connected or not. The client download archive contains a binary, which includes a sample configuration and a readme file, containing further instructions.

Synchronization configuration settings
Synchronization configuration settings

Configuring ad-connect

To configure ad-connect, please modify the example adc.yaml, to match your environment. An example of this, is shown below:

settings:
  dry-run: true
  no-update: false
  no-create: false
  no-delete: false
  delete-disables: true
  no-update-provider-mismatch: true
  create-as-disabled: false
  no-aliases: false

backend:
  ldap:
    addr: ldap://your-ldap-server.local
    bind_dn: cn=readonly,dc=lg,dc=local
    bind_password: readonly
    base_dn: dc=lg,dc=local
    scope: sub

    domain_map:
      dc=lg,dc=local: ad-connect.local

    sync:
      page_size: 20
      filter: (objectClass=inetOrgPerson)
      username_attribute: uid
      username_append_domain: true
      attributes_map:
        kopanoAliases: mail

    authentication:
      username_attribute: uid
      username_filter_template: (&(objectClass=inetOrgPerson)(uid=%s))
      username_strip_domain: true
      timeout: 5

Without sync.attributes, ad-connect reads a default set of common Active Directory and LDAP attributes. See What kind of information can I import with ad-connect? for how they are used.

A note regarding the settings part in adc.yaml

As defined in the synchronization configuration settings, it is possible to define these settings both on the server, and client side. If the configuration contains values that conflict with one another, the server will override the client's settings. (e.g. If the server only allows dry runs, the client will unable to import users into the server)

Running ad-connect

ad-connect has two modes of operation. 1. When called with the imp parameter, it imports users from the configured LDAP source. 2. When called with the run parameter it connects to Kopano Cloud.

When password delegation is enabled, the client is required to be connected at all times, to allow users to sign in.

Systemd service setup example

To run ad-connect with systemd, there are a few requirements.

First you need to create a new service configuration file called adc.cfg, and save it in /etc/e4a-ad-connect.

The adc.cfg file needs to contain the following:

AD_CONNECT_ADDR=address-of-server:443
AD_CONNECT_AUTH=application-id:secret-token
AD_CONNECT_CONFIG=/etc/e4a-ad-connect/adc.yaml

To create the actual service:

  1. run sudo systemctl edit --force --full systeminfo.service
  2. Then add the following content to the service file:
[Unit]
Description=ad-connect
After=network.target

[Service]
Type=simple
User=nobody
Group=nogroup
WorkingDirectory=/etc/e4a-ad-connect
ExecStart=/usr/local/bin/adc run
EnvironmentFile=/etc/e4a-ad-connect/adc.cfg
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
Restart=always
RestartSec=10
TimeoutStopSec=30
KillMode=process

[Install]
WantedBy=multi-user.target

Note

Installers for Windows and Linux systems and an OCI container, will be made available in a later release.

What kind of information can I import with ad-connect?

Attributes are processed in two steps:

  1. ad-connect reads the attributes listed in sync.attributes from the directory, renames them according to attributes_map and optionally changes their values with attributes_transformer.
  2. Kopano Cloud receives the result and stores the attributes it recognizes. All other attributes are ignored.

Recognized attributes

Attribute names are compared case-insensitively.

Attribute Stored as
the anchor attribute username, see Anchor attribute
cn or displayName display name
title job title
description or info notes
mobile mobile phone number
telephoneNumber phone number
mail aliases, all values

Except for mail, only one value is stored. If an attribute has several values, or a user has both cn and displayName, it is not defined which one is used, so provide only one of them.

Other attributes, such as givenName, sn, company or streetAddress, are currently not stored. To import such information, map it to one of the recognized attributes (see Attribute mapping).

When in the Directory Synchronization Settings the option Sync aliases when users are created, updated or deleted is unchecked, the ldap mail attribute needs to be unique.

Aliases without a domain get the domain of the user. Aliases in a different domain than the user's are skipped.

Anchor attribute

The anchor attribute is set in the synchronization configuration settings and identifies a user uniquely. It must have exactly one value: users with several values are skipped. It is compared to the attribute name after attributes_map has been applied.

The username is always an email address. If the value of the anchor attribute is not one, a domain is added:

  • If sync.username_append_domain is true and sync.username_attribute is the anchor attribute, ad-connect appends the domain of the domain_map entry that the DN of the user ends with. Only one entry is used, so make sure the keys of domain_map do not overlap.
  • Otherwise, Kopano Cloud appends the domain of the synchronization configuration.
backend:
  ldap:
    domain_map:
      dc=lg,dc=local: ad-connect.local
    sync:
      username_attribute: uid
      username_append_domain: true

Users whose domain does not belong to the organization are skipped.

Important

The mail attribute has been the anchor attribute on the server side, up until version 6.1.2. From version 6.2.0 onwards the anchor attribute is uid.

Attribute mapping

attributes_map renames directory attributes before they are sent to Kopano Cloud. In the example below, the values of kopanoAliases are sent as mail, so they are imported as aliases:

backend:
  ldap:
    sync:
      attributes_map:
        kopanoAliases: mail
  • Mapped attributes are read from the directory automatically; they do not need to be listed in attributes.
  • The names on the left are case-sensitive. Spell them as in the directory schema, kopanoAliases, not kopanoaliases.
  • If several attributes end up with the same name, their values are combined. In the example, the values of both mail and kopanoAliases become aliases.
  • Mapping an attribute to an empty name (telephoneNumber: "") stops it from being imported.

Do not map onto the anchor attribute

If a user has both the mapped attribute and the anchor attribute, the anchor attribute gets several values and the user is skipped.

Attribute transformation

attributes_transformer changes attribute values while they are read, for example when the directory stores email addresses in a different domain. The example removes the domain from mail, so Kopano Cloud adds the domain of the user to the resulting aliases:

backend:
  ldap:
    sync:
      attributes_transformer:
        mail: 's/\(.*\)@.*/\1/'
      attributes_transformer_command: "sed --sandbox -e"
  • The names on the left are the names after attributes_map has been applied.
  • attributes_transformer_command defaults to sed --sandbox -e. It is split at spaces; quoting is not supported.
  • The command runs once per value. It receives the value on standard input and the expression as its last argument, and its output becomes the new value. Only the environment variables LDAP_DN, LDAP_ATTRIBUTE_NAME and LDAP_ATTRIBUTE_NAME_MAPPED are set.

Warning

If the command prints nothing, the whole user is skipped. If the command fails, the whole import is aborted. Test the expression with a dry run before you import.