OpenLiteSpeed: mail.<domain>:443 serves the server hostname certificate, Thunderbird shows a security exception during calendar/address book discovery

toktokcity

Verified User
Joined
Apr 29, 2016
Messages
122
Location
The Netherlands
Hi all,

We run DirectAdmin with OpenLiteSpeed (CustomBuild) on several servers and see the same thing with every domain. I would like to know if this is expected, or if there is a supported setting for it.

What happens
When a new account is added in Thunderbird (auto configuration), the account is created fine, mail settings are detected correctly. Then, in the step "Discovering address books and calendars…", Thunderbird shows "Add Security Exception" for mail.example.com with "Wrong site: the certificate belongs to a different site". Cancelling or skipping works, and mail keeps working, but customers find the warning alarming.

What I measured
- mail.example.com resolves to the server (A and AAAA).
- Mail ports are fine. On 993, 995, 465, 587 and 25 the certificate is the Let's Encrypt certificate of example.com, with mail.example.com in the SAN list.
- Port 443 on mail.example.com returns the server hostname certificate (CN=<server hostname>), the same for every connection, so it is not intermittent. https://mail.example.com/.well-known/autoconfig/mail/config-v1.1.xml returns 404.
- The reason seems to be that mail.example.com is not a web host on the server: the OpenLiteSpeed vhost for the domain has vhDomain example.com and vhAliases www.example.com only (generated from openlitespeed_vhost.conf), so the request falls through to the default vhost and its certificate.

Questions
1. Is this the expected behaviour on OpenLiteSpeed? The docs say autodiscover is configured automatically on current licenses and that Thunderbird should work without customisation. Is anything different for OpenLiteSpeed than for Apache, where I see mention of a ProxyPassMatch for the mail/autoconfig path?
2. Is there a supported setting (directadmin.conf or CustomBuild option) that makes mail.<domain> answer on 443 with the domain's own certificate?
3. If not, would the recommended way be a custom copy of openlitespeed_vhost.conf where mail.|SDOMAIN| is added to vhAliases? I would rather not maintain a custom template if there is an official way.

Versions: DirectAdmin 1.714, CustomBuild 2, OpenLiteSpeed 1.9.4, Thunderbird 160.

Thanks!
 
Is the hostname really mail.domain.com? Because that is not really a wise decision to use mail als the servers hostname. In the past that caused some odd behaviour of some things. Amongst which the fact that normally mail.domain.com is used for mail addresses (incoming/outgoing mail) for domains, which is also the reason one can not visit mail.domain.com via https ofcourse.
 
Is the hostname really mail.domain.com? Because that is not really a wise decision to use mail als the servers hostname. In the past that caused some odd behaviour of some things. Amongst which the fact that normally mail.domain.com is used for mail addresses (incoming/outgoing mail) for domains, which is also the reason one can not visit mail.domain.com via https ofcourse.
mail.*customer*.com, it works fine for imap and SMTP etc. with SSL. But in the final step in Thunderbird they try to find :443 certificate for calendar purposes.
 
mail.*customer*.com, it works fine for imap and SMTP etc.
Yes so mail.somedomain.com it's just an example. But as long as you use mail.xxx.xxx as hostname, you have a risk encountering odd issues either now or in the future (or both).
That should not happen but we've seen that a lot in the past.

they try to find :443
Which most likely is also cause of that because the hostname is normally web based, not mail based. So web based ssl port is wrongly used.
I would strongly advise to change the hostname. Then check or re-issue certificates again and I'm almost sure your issues will be gone.
 
Sorry, the server is running a different name. s*.domain.com. When installing an account, customers use mail.*. But because that's only 993 and 465 etc, the calendar check can't find 443 certificate and reads the certificate of s*.domain.com which is not a match and gives an error.
 
I think using the host name will fix the issue, but this is frustrating when an account is replaced to a different server. Than I need to ask the customer to make some changes in local installations, which is not an issue when mail.* is used.
 
Back
Top