Mail Resolver deprecated

Resolving OX users

Overview

When a Guard user sends an email to a recipient, Guard must be able to determine if the recipient is an OX user, or if that person uses a different email service. If the recipient is an OX user, Guard must be able to determine the user's ID and context. This is done through the OX App Suite Middleware by default, which in turn looks up the email address using the default login2context table. Guard can, however, be configured to use a different URL for third party or custom handlers.

Default Handler

By default, Guard will try to resolve the email address against the OX App Suite Middleware. The OX App Suite Middleware first looks up the domain of the email address in the login lookup tables. If a context is defined as a default login, the context must also be defined with the domains that exist within.

For example, if you created a default context (say context 1) using

/opt/open-xchange/sbin/createcontext -A oxadminmaster -P admin_master_password -c 1 \
-u oxadmin -d "Context Admin" -g Admin -s User -p admin_password -L defaultcontext ...

You must add the domain (substitute for example.com) for that context using

./changecontext -A oxadminmaster -P secret -c 1 -L example.com

You can add multiple domains to the context at the same time, separating by ”,”

Lookup if the domain is not mapped

If the login lookup tables do not resolve the email address, the property

com.openexchange.mailmapping.lookUpByDomain

decides how the OX App Suite Middleware continues. With the default value false, the OX App Suite Middleware searches for the email address in all user databases. With the value true, the OX App Suite Middleware treats the email address as external, and Guard creates a guest account for the recipient. In this case, email domains must not span multiple contexts.

The search in all user databases can have an impact on performance in bigger installations. Complete login lookup tables avoid the search.

Custom Mail Resolver

If you have a custom authentication / login system, Guard will need to be configured to access your custom mail Resolver, and your custom system will need to provide the information required for Guard to process the recipient.

Set the custom URL with the property com.openexchange.guard.mailResolverUrl

com.openexchange.guard.mailResolverUrl=https://resolver.example.com/resolve/?email=

Guard will be adding the URL-encoded email address to be resolved at the end of the URL.

Guard calls the custom mail resolver with the REST API credentials. The following properties set separate credentials for the custom mail resolver:

com.openexchange.guard.mailResolverUrl.basicAuthUsername=
com.openexchange.guard.mailResolverUrl.basicAuthPassword=

Guard will expect a JSON response. If the user is not an OX user, then a blank JSON should be returned ”{}”

If the user exists, a JSON response should be returned in the following format:

{
 "tester@example.com":
   {"uid":4,"user":
     {"language":"en_US","displayName":"Tester, OX"},
    "cid":1}
 }

If the user does not exist, a blank JSON should be returned

{}

Email address should be the identifier, followed by the uid (user id), cid (the context Id), and user data including language and display name.

Optionally, the entry may carry a boolean "ambiguous". Set it to true when the address belongs to more than one user, for example a mailing list provisioned as an alias that several users carry, so that the returned uid is only one of several owners. Guard then refuses to encrypt to that address and tells the sender that the address is used by several people, instead of encrypting the mail for one arbitrary member; a key uploaded for the address or published for it (Autocrypt, WKS, HKP) is still used. The OX middleware's own resolver sends this flag; a resolver that omits it is treated as if it were false. Any value other than the JSON boolean true reads as false, and Guard does not create a guest account for an address marked ambiguous.

{
 "sales@open-xchange.com":
   {"uid":4,"user":
     {"language":"en_US","displayName":"Tester, OX"},
    "cid":1,
    "ambiguous":true}
 }

Note: If there are multiple OX App Suite Middleware installations served by this mail resolver, then only the user information to which Guard has access should be provided. The mailResolver should not provide userid/contextid information for a database that Guard doesn't have access to.

Most probably, the OX CID is already available in one of your existing LDAP / databases systems, to map your customer/contract-IDs to the corresponding OX App Suite tenant/context ID. Then you need to lookup the userid + language + displayname of this email address, if it's an App Suite email address.

We recommend that you do a loadtest against your custom resolver endpoint. E.g via JMETER + CSV input for random email addresses.

Note: A custom mailresolver can also be implemented as an OSGi plugin for the OX App Suite Middleware. Please contact us for more information or an offer for custom implementation.