************************************** Synchronize posixGroup to groupOfNames ************************************** Presentation ============ In a standard LDAP directory, you can have several kind of groups, each one represented by a specific object class, for example: * ``posixGroup`` * ``groupOfNames`` * ``groupOfUniqueNames`` * ``groupOfURLs`` You may need to have both of them, for example posixGroup and groupOfNames, as posixGroup entries will be used for system authentication (PAM or SSSD) and groupOfNames for web applications authorizations. This tutorial will explain how to sync members between a posixGroup entry and a groupOfNames entry, so you just have to edit one entry to manage membership. Let's go ======== This tutorial is an adaptation of :doc:`Synchronize OpenLDAP groups to Active Directory groups `, with these differences: * We sync posixGroup to groupOfNames instead of groupOfUniqueNames to AD group * There is only one directory (so only one connection), groups can be in different branches or in the same one * We suppose that all users are in ou=users branch, and that the RDN is based on uid attribute Task ---- Create a task ``group`` as a standard LSC task: .. code-block:: XML group org.lsc.beans.SimpleBean ... Services -------- We define here a source service that will read POSIX groups, and a destination service that will manage standard groups: .. code-block:: XML group-source-service ou=groups,dc=example,dc=com cn cn memberUid group-dst-service ou=groups,dc=example,dc=com cn cn member objectClass Properties ---------- We will now define properties: .. code-block:: XML ... Main properties ^^^^^^^^^^^^^^^ We define mainIdentifier and conditions: .. code-block:: XML js:"cn=" + javax.naming.ldap.Rdn.escapeValue(srcBean.getDatasetFirstValueById("cn").toLowerCase()) + ",ou=groups,dc=example,dc=com" ; FORCE true true true true Object Class ^^^^^^^^^^^^ We force the values of objectClass attribute: .. code-block:: XML objectclass KEEP "groupOfNames" "top" member ^^^^^^ We convert uid values into DN: .. code-block:: XML member FORCE Some explanations on this script: - We get uid of members in source in ``membersSrcUid`` - For each value, the corresponding DN is built with a simple concatenation - The DN is inserted into ``membersDstDn`` array - The ``membersDstDn`` array is returned to LSC