Difference between revisions of "Integration with UCS/Mail"

From Univention Wiki

Jump to: navigation, search
Line 1: Line 1:
 +
[[Category:App Center Developer Guide]]
 +
 
[[Category:App Center Developer Guide]]
 
[[Category:App Center Developer Guide]]
  
Line 10: Line 12:
  
 
<pre>
 
<pre>
 +
...
 +
. /usr/share/univention-appcenter/joinscripthelper.sh
 +
...
 +
eval "$(univention-config-registry shell)"
 
...
 
...
 
# use the first IMAP server as smtp and imap server
 
# use the first IMAP server as smtp and imap server
eval "$(univention-config-registry shell)"
 
. /usr/share/univention-appcenter/joinscripthelper.sh
 
 
mailserver="$(univention-ldapsearch -LLL univentionService=IMAP cn | grep "^cn: " | sed s/"^cn: "// | head -n1)"
 
mailserver="$(univention-ldapsearch -LLL univentionService=IMAP cn | grep "^cn: " | sed s/"^cn: "// | head -n1)"
 
if [ -n "$mailserver" ]; then
 
if [ -n "$mailserver" ]; then
Line 23: Line 27:
 
...
 
...
 
</pre>
 
</pre>
 +
 +
This snippet searches the UCS LDAP for a host with the service IMAP and sets the FQDN of this host as IMAP, SMTP and SIEVE server in the container.
 +
 +
Best practice IMAP settings:
 +
* TLS
 +
* Port 143
 +
* Authentication is possible for domain users with a mailPrimaryAddress
 +
* Uid or mailPrimaryAddress are both valid for authentication
 +
 +
Best practice SMTP settings:
 +
* TLS
 +
* Port 587 (submission) for authentication
 +
* Auth login or Auth Plain

Revision as of 16:29, 8 November 2016


Use an existing UCS mailstack in Docker Apps

If the App relies on an existing mail infrastructure (IMAP, SMTP), best practice is to set a dependency RequiredAppsInDomain=mailserver in the Apps ini file.

This way the UCS mailstack has to be installed (anywhere in the UCS domain) before the installation of the App is allowed.

Next step is to configure the App to use the UCS IMAP/SMTP server. This should be done in the Apps join script.

...
. /usr/share/univention-appcenter/joinscripthelper.sh
...
eval "$(univention-config-registry shell)"
...
# use the first IMAP server as smtp and imap server
mailserver="$(univention-ldapsearch -LLL univentionService=IMAP cn | grep "^cn: " | sed s/"^cn: "// | head -n1)"
if [ -n "$mailserver" ]; then
        mailserver="$mailserver.$domainname"
        joinscript_run_in_container my-app-setup --config imap="$mailserver"
        joinscript_run_in_container my-app-setup --config smtp="$mailserver"
        joinscript_run_in_container my-app-setup --config sieve="$mailserver"
fi
...

This snippet searches the UCS LDAP for a host with the service IMAP and sets the FQDN of this host as IMAP, SMTP and SIEVE server in the container.

Best practice IMAP settings:

  • TLS
  • Port 143
  • Authentication is possible for domain users with a mailPrimaryAddress
  • Uid or mailPrimaryAddress are both valid for authentication

Best practice SMTP settings:

  • TLS
  • Port 587 (submission) for authentication
  • Auth login or Auth Plain
Personal tools