Skip to content

lsc-project/lsc-james-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

James LSC plugin

Build Status

This a plugin for LSC, using James REST API

Goal

The object of this plugin is to synchronize addresses aliases and users from one referential to a James server.

Address Aliases Synchronization

For example, it can be used to synchronize the aliases stored in the LDAP of an OBM instance to the James Server(s) of a TMail deployment.

Architecture

Given the following LDAP entry:

dn: uid=rkowalsky,ou=users,dc=linagora.com,dc=lng
[...]
mail: [email protected]
mailAlias: [email protected]
mailAlias: [email protected]

This will be represented as the following James address alias:

$ curl -XGET http://ip:port/address/aliases/[email protected]

[
  {"source":"[email protected]"},
  {"source":"[email protected]"}
]

As addresses aliases in James are only created if there are some sources, an LDAP entry without mailAlias attribute won't be synchronized.

The pivot used for the synchronization in the LSC connector is the email address, here [email protected] stored in the email attribute.

The destination attribute for the LSC aliases connector is named sources.

Users Synchronization

For example, it can be used to synchronize the users stored in the LDAP of an OBM instance to the James Server(s) of a TMail deployment.

Architecture

Given the following LDAP entries:

dn: uid=james-user, ou=people, dc=james,dc=org
mail: [email protected]
[...]

dn: uid=james-user2, ou=people, dc=james,dc=org
mail: [email protected]
[...]

dn: uid=james-user3, ou=people, dc=james,dc=org
mail: [email protected]
[...]

This will be represented as the following James users:

$ curl -XGET http://ip:port/users

[
  {"username":"[email protected]"},
  {"username":"[email protected]"}
]

If LDAP entry with the mail attribute exists but not synchronized, the user will be created with choose:

If LDAP entry has no mail attribute corresponding, the user will be deleted.

Expected Result:

- [email protected] -> create
- [email protected] -> nothing happens
- [email protected] -> create
- [email protected] -> delete
$ curl -XGET http://ip:port/users

[
  {"username":"[email protected]"},
  {"username":"[email protected]"},
  {"username":"[email protected]"}
]

The pivot used for the synchronization in LSC connector is email address. For this case, [email protected] is stored in email attribute.

Configuration

The plugin connection needs a JWT token to connect to James. To configure this JWT token, set the password field of the plugin connection as the JWT token you want to use.

The url field of the plugin connection must be set to the URL of James' webadmin.

The username field of the plugin is ignored for now.

Usage

There is an example of configuration in the sample directory. The lsc.xml file describe a synchronization from an OBM LDAP to a James server. The values to configure are:

  • connections.ldapConnection.url: The URL to the LDAP of OBM

  • connections.ldapConnection.username: An LDAP user which is able to read the OBM aliases

  • connections.ldapConnection.password: The password of this user

  • connections.pluginConnection.url: The URL to the James Webadmin

  • connections.pluginConnection.password: the JWT token used to connect the James Webadmin, it must includes an admin claim.

  • tasks.task.ldapSourceService.baseDn: The search base of the users to synchronize.

The domains used in the aliases must have been previously created in James. Otherwise, if a user have a single alias pointing to an unknown domain, none of her aliases will be added.

The jar of the James LSC plugin must be copied in the lib directory of your LSC installation. Then you can launch it with the following command line:

JAVA_OPTS="-DLSC.PLUGINS.PACKAGEPATH=org.lsc.plugins.connectors.james.generated" bin/lsc --config /home/rkowalski/Documents/lsc-james-plugin/sample/ldap-to-james/ --synchronize all --clean all --threads 1

If don't want to delete dangling data, run this command without --clean all parameter.

Packaging

WIP