| 1 |
Zimbra |
| 2 |
====== |
| 3 |
|
| 4 |
|image0| |
| 5 |
|
| 6 |
Presentation |
| 7 |
------------ |
| 8 |
|
| 9 |
`Zimbra <http://www.zimbra.com/>`__ is open source server software for |
| 10 |
email and collaboration - email, group calendar, contacts, instant |
| 11 |
messaging, file storage and web document management. The Zimbra email |
| 12 |
and calendar server is available for Linux, Mac OS X and virtualization |
| 13 |
platforms. Zimbra syncs to smartphones (iPhone, BlackBerry) and desktop |
| 14 |
clients like Outlook and Thunderbird. Zimbra also features archiving and |
| 15 |
discovery for compliance. Zimbra can be deployed on-premises or as a |
| 16 |
hosted email solution. |
| 17 |
|
| 18 |
Zimbra can be connected with `SAML protocol <../idpsaml>`__ which is the |
| 19 |
recommended way, but this requires Zimbra Network Edition. |
| 20 |
|
| 21 |
Zimbra can also use a specific `preauthentication |
| 22 |
protocol <http://wiki.zimbra.com/index.php?title=Preauth>`__ to provide |
| 23 |
SSO on its application. This protocol is implemented in an LL::NG |
| 24 |
specific Handler and is available in Zimbra Open Source Edition. |
| 25 |
|
| 26 |
SAML |
| 27 |
---- |
| 28 |
|
| 29 |
On LemonLDAP::NG side |
| 30 |
~~~~~~~~~~~~~~~~~~~~~ |
| 31 |
|
| 32 |
Create a new SAML SP and use this metadata content: |
| 33 |
|
| 34 |
.. code-block:: xml |
| 35 |
|
| 36 |
<?xml version="1.0"?> |
| 37 |
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" |
| 38 |
validUntil="2020-02-28T09:33:56Z" |
| 39 |
cacheDuration="PT604800S" |
| 40 |
entityID="https://zimbrasaml.example.com/service/extension/samlreceiver"> |
| 41 |
<md:SPSSODescriptor AuthnRequestsSigned="true" WantAssertionsSigned="false" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> |
| 42 |
<md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat> |
| 43 |
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" |
| 44 |
Location="https://zimbrasaml.example.com/service/extension/samlreceiver" |
| 45 |
index="1" /> |
| 46 |
</md:SPSSODescriptor> |
| 47 |
</md:EntityDescriptor> |
| 48 |
|
| 49 |
Replace ``zimbrasaml.example.com`` by your ZimbraPublicHostname. |
| 50 |
|
| 51 |
Enable IDP SSO Initiated option. |
| 52 |
|
| 53 |
Create ``Email`` exported attribute, which must return the user email. |
| 54 |
|
| 55 |
Export the SAML signature certificate in a file, for example ``lemonsaml.cert`` that must be copied on Zimbra server. |
| 56 |
|
| 57 |
On Zimbra side |
| 58 |
~~~~~~~~~~~~~~ |
| 59 |
|
| 60 |
Copy the SAML plugin (available only with Zimbra NE): |
| 61 |
|
| 62 |
.. code-block:: console |
| 63 |
|
| 64 |
mkdir /opt/zimbra/lib/ext/saml |
| 65 |
cp /opt/zimbra/extensions-network-extra/saml/samlextn.jar /opt/zimbra/lib/ext/saml/samlextn.jar |
| 66 |
|
| 67 |
Import certificate: |
| 68 |
|
| 69 |
.. code-block:: console |
| 70 |
|
| 71 |
su - zimbra |
| 72 |
cat /tmp/lemonsaml.crt |xargs -0 zmprov md exampledomain.com zimbraMyoneloginSamlSigningCert |
| 73 |
|
| 74 |
Configure SAML properties: |
| 75 |
|
| 76 |
.. code-block:: console |
| 77 |
|
| 78 |
zmprov mcf zimbraCsrfRefererCheckEnabled FALSE |
| 79 |
zmprov md exampledomain.com zimbraWebClientLoginURL "https://auth.example.com/saml/singleSignOn?IDPInitiated=1&sp=https://zimbrasaml.example.com/service/extension/samlreceiver" |
| 80 |
zmprov md exampledomain.com zimbraWebClientLogoutURL "https://auth.example.com/saml/singleLogout" |
| 81 |
zmmailboxdctl restar |
| 82 |
|
| 83 |
To check for errors: |
| 84 |
|
| 85 |
.. code-block:: console |
| 86 |
|
| 87 |
tail -f /opt/zimbra/log/zmmailboxd.ou |
| 88 |
|
| 89 |
Zimbra PreAuth Handler |
| 90 |
---------------------- |
| 91 |
|
| 92 |
.. note:: |
| 93 |
|
| 94 |
This method is no more recommended. |
| 95 |
|
| 96 |
The integration with LL::NG is the following: |
| 97 |
|
| 98 |
- A special URL is declared in application menu (like |
| 99 |
http://zimbra.example.com/zimbrasso) |
| 100 |
- A Zimbra Handler is called |
| 101 |
- Handler build the preauth request and redirect user on Zimbra preauth |
| 102 |
URL |
| 103 |
- Then Zimbra do the SSO by setting a cookie in user's browser |
| 104 |
|
| 105 |
Zimbra preauth key |
| 106 |
~~~~~~~~~~~~~~~~~~ |
| 107 |
|
| 108 |
You need to get a preauth key from Zimbra server. |
| 109 |
|
| 110 |
See `how to do |
| 111 |
this <http://wiki.zimbra.com/index.php?title=Preauth#Preparing_a_domain_for_preauth>`__ |
| 112 |
on Zimbra wiki. |
| 113 |
|
| 114 |
Zimbra application in menu |
| 115 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 116 |
|
| 117 |
Choose for example http://zimbra.example.com/zimbrasso as SSO URL and |
| 118 |
:doc:`set it in application menu<../portalmenu>`. |
| 119 |
|
| 120 |
Zimbra virtual host |
| 121 |
~~~~~~~~~~~~~~~~~~~ |
| 122 |
|
| 123 |
You just have to set "Type: ZimbraPreAuth" in virtualhost options and |
| 124 |
reload configuration in this handler. |
| 125 |
|
| 126 |
Zimbra Handler parameters |
| 127 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 128 |
|
| 129 |
Zimbra parameters are the following: |
| 130 |
|
| 131 |
- **Preauthentication key**: the one you grab from zmprov command |
| 132 |
- **Account session key**: session field used as Zimbra user account |
| 133 |
(by default: uid) |
| 134 |
- **Account type**: for Zimbra this can be name, id or foreignKey (by |
| 135 |
default: id) |
| 136 |
- **Preauthentication URL**: Zimbra preauthentication URL, either with |
| 137 |
full URL (ex: http://zimbra.lan/service/preauth), either only with |
| 138 |
path (ex: /service/preauth) (by default: /service/preauth) |
| 139 |
- **Local SSO URL pattern**: regular expression to match the SSO URL |
| 140 |
(by default: ^/zimbrasso$) |
| 141 |
|
| 142 |
|
| 143 |
.. attention:: |
| 144 |
|
| 145 |
Due to Handler API change in 1.9, you need to set these |
| 146 |
attributes in ``lemonldap-ng.ini`` and not in Manager, for example: |
| 147 |
|
| 148 |
.. code:: ini |
| 149 |
|
| 150 |
[handler] |
| 151 |
zimbraPreAuthKey = XXXX |
| 152 |
zimbraAccountKey = uid |
| 153 |
zimbraBy =id |
| 154 |
zimbraUrl = /service/preauth |
| 155 |
zimbraSsoUrl = ^/zimbrasso$ |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
Multi-domain issues |
| 160 |
~~~~~~~~~~~~~~~~~~~ |
| 161 |
|
| 162 |
Some organizations have multiple zimbra domains: |
| 163 |
|
| 164 |
#. [email protected] |
| 165 |
#. [email protected] |
| 166 |
|
| 167 |
However, the zimbra preauth key is: |
| 168 |
|
| 169 |
- generated for one zimbra domain only |
| 170 |
- declared globally for every LemonLDAP::NG virtual hosts. |
| 171 |
|
| 172 |
Thus, if domain1 has been registered on LemonLDAP::NG, user bar won't be |
| 173 |
able to connect to zimbra because preauth key is different. If you |
| 174 |
accept to have the same preauth key for all zimbra domains, you can set |
| 175 |
the same preauth key using this procedure: |
| 176 |
|
| 177 |
We are going to use the first key (the domain1 one) for every domain. On |
| 178 |
Zimbra machine, generate the keys: |
| 179 |
|
| 180 |
:: |
| 181 |
|
| 182 |
zmprov generateDomainPreAuthKey domain1.com |
| 183 |
preAuthKey: 4e2816f16c44fab20ecdee39fb850c3b0bb54d03f1d8e073aaea376a4f407f0c |
| 184 |
|
| 185 |
zmprov generateDomainPreAuthKey domain2.com |
| 186 |
preAuthKey: 6b7ead4bd425836e8cf0079cd6c1a05acc127acd07c8ee4b61023e19250e929c |
| 187 |
|
| 188 |
Then, connect to your zimbra LDAP server with your favourite tool |
| 189 |
(Apache Directory Studio can do the job). Take care to connect with the |
| 190 |
super admin and password account. |
| 191 |
|
| 192 |
- Expand the branch "dc=com", then click the "dc=domain1" branch |
| 193 |
- Get the value of zimbraPreAuthKey |
| 194 |
- Expand the branch "dc=com", then click the "dc=domain2" branch |
| 195 |
- Replace the value of zimbraPreAuthKey you have previously copied |
| 196 |
- Wait for all Zimbra servers to update, or restart the zcs server |
| 197 |
|
| 198 |
That's it, all zimbra servers will be able to decipher the hmac because |
| 199 |
they share the same key! |
| 200 |
|
| 201 |
.. |image0| image:: /applications/zimbra_logo.png |
| 202 |
:class: align-center |
| 203 |
|