Introduction
I’m creating this post for two reasons:
- To save other users from spending hours trying to solve this surprisingly simple issue (once you know how).
- To request that the project maintainers incorporate this information into the documentation, which to my knowledge, doesn’t currently exist. Or maybe a tooltip or tiniy message on the UI.
Scenario
I created a third user account (user3) in my HestiaCP and a domain for it (domain3.com). When adding the domain, I specified in the form that I wanted to use Let’s Encrypt.
Everything worked fine up to this point. However, no certificate was created for webmail.domain3.com
or mail.domain3.com
, preventing secure access to webmail and the use of SSL certificates for SMTP mail sending, which is problematic.
Diagnosis
I’m not entirely sure what the issue was. One would think that HestiaCP would have created the certificate not only for domain3.com
and www.domain3.com
(which I defined as an alias) but also for webmail.domain3.com
and mail.domain3.com
. However, this didn’t seem to be the case.
I spent about 3-4 hours searching this forum and GitHub, trying to understand what was happening.
Solution
As often happens, persistence pays off. I found the solution in a comment by @sahsanu here: (What is the difference between v-add-letsencrypt-domain and v-add-letsencrypt-host? - #2 by eris). Running this command in the server terminal did the trick:
v-add-letsencrypt-domain user3 domain3.com www.domain3.com yes
It worked on the first try!
Note: If you look at the code on GitHub, this command accepts 4 arguments:
v-add-letsencrypt-domain USERNAME ROOTDOMAIN ALIASDOMAINCOMMALIST MAIL
Where “MAIL” is a boolean that can be “yes” or “no” to generate (or not) the certificate for the MAIL and WEBMAIL subdomains.
Questions for the team
- Aren’t certificates for
mail
andwebmail
supposed to be generated BY DEFAULT when we add a certificate for an existing domain in a user’s account? - Or is there a requirement for this to happen? The existence of some DNS zone in that domain? In my case, I always had MAIL and WEBMAIL as A-type DNS records pointing to the server’s IP. Is an IMAP or SMTP record necessary? (I don’t think so)
- Could it be that if this domain name has NOTHING to do with the hostname defined on the server, it might prevent HestiaCP from automatically generating that certificate for MAIL and WEBMAIL?
Acknowledgments
Whatever the case, thank you all for being here, for this excellent software, and for the great support you provide when those of us with less knowledge are always asking questions that might seem obvious to you.