Changelog
- Jul 25, 2026 (v. 4.0) hook scripts and below documentation completeley reviewed.
- Added a newdehydrated-renewwrapper script to execute certificate renewal and perform service synchronization forSNIonly when one or more certificates have actually changed.
- Introduced a change flag mechanism (dehydrated.changed) to avoid unnecessary service reloads and restarts if any certificate has been actually deployed.
- Consolidated post-renew operations into the newcert_sync()function, providing a single entry point for synchronizingqmail,Dovecot, andApachecertificate configuration after successful renewals. The samecert_sync()can be called via stand-alone script, which doesn't involve thedehydratedrun.
- Reduced unnecessary service interruptions by performing synchronization once per renewal run instead of once per renewed certificate.
-qmailcertificate is built only ifMAKE_MAIL_CERTS=1is set. IfMAKE_MAIL_CERTS=0the hook script only deploys the certificates (use for webserver).
- Server Server Name Indication (SNI) stuff for qmail and dovecot can be disabled by settingENABLE_SNI=0(default).
- ServerName and ServerAlias entries forApacheandSNIdomains can be optionally set withENABLE_APACHE_SNI_CONF=1.
To enable HTTPS on your website, you need to get a certificate (a type of file) from a Certificate Authority (CA). Let’s Encrypt is a CA. In order to get a certificate for your website’s domain from Let’s Encrypt, you have to demonstrate control over the domain. With Let’s Encrypt, you do this using software that uses the ACME protocol which typically runs on your web host.
Upgrading notes
In case you have to replace a working installation of certificates based on certbot, you don't need to take any precautions as they won't be overwritten by the new ones generated by dehydrated. Therefore it is possible to run our tests on the production server itself. Of course it will be good to use a test domain while tinkering with Apache.
dehydrated installation
- github dehydrated page
- AlienBob article (for
Slackwareusers, but the informations are generic)
Dehydrated is a client for signing certificates with an ACME-server (e.g. Let's Encrypt) implemented as a relatively simple (zsh-compatible) bash-script. This client supports both ACME v1 and the new ACME v2 including support for wildcard certificates!
dehydrated is a simple shell program that requires no dependencies, unlike the official certbot program, which needs a very long set of python libraries. Maintaining all this volume of programs proved to be quite time expensive, which is why I decided to switch to dehydrated.
Since your distribution is likely to provide a dehydrated package, you can install it from there. Otherwise download and install the program from the github site.
Here is a short example of a manual installation in /usr/local (modify PREFIX as needed):
VERSION=0.7.2
PREFIX=/usr/local
wget https://github.com/dehydrated-io/dehydrated/releases/download/v${VERSION}/dehydrated-${VERSION}.tar.gz
tar xzf dehydrated-${VERSION}.tar.gz
cd dehydrated-${VERSION}
chown -R root:root .
cp dehydrated $PREFIX/bin/
mkdir -p $PREFIX/man/man1 $PREFIX/share/doc/dehydrated-${VERSION}/docs/examples
cp docs/man/dehydrated.1 $PREFIX/man/man1/
mkdir -p /etc/dehydrated
cp docs/examples/config /etc/dehydrated/config.new # .new just to avoid to overwrite the existing config. Rename to config
cp CHANGELOG* LICENSE* README* /usr/local/share/doc/dehydrated-${VERSION}
cp docs/*.md $PREFIX/share/doc/dehydrated-${VERSION}/docs
cp docs/examples/{domains.txt,hook.sh} $PREFIX/share/doc/dehydrated-${VERSION}/docs/examples
Configuration
Go to the /etc/dehydrated folder, where you can find the configuration file and the directory where the certificates will be installed. /etc/dehydrated/config.d is a path for additional config files containing a '.sh' ending.
First of all enable the following in the config file
CONFIG_D="${BASEDIR}/config.d"
Then save your personal settings in /etc/dehydrated/config.d/local.sh, for example:
CA="letsencrypt-test"
CHALLENGETYPE="http-01"
WELLKNOWN="/var/www/htdocs/dehydrated"
#HOOK="${BASEDIR}/scripts/hook.sh"
HOOK_CHAIN="yes"
KEY_ALGO=rsa
CONTACT_EMAIL=postmaster@mydomain.tld
IP_VERSION=4
CAcontains theURLto theLet's Encryptserver, or a parameter (in this caseletsencrypt-test)that tells the program whichURLto use. While testing let's leaveletsencrypt-testso that the server will not be clogged. We would be banned accordingly if we exceed the limit of invalid attempts. We will change it toCA="letsencrypt"once everything is ok. More info here.CHALLENGETYPE="http-01"As we know, we need to prove to have control over the domains we want to get a certificate for. To do this, access must be tested to a verification file placed on our web server, in a folder whereApachemust have access for each domain to be certified.
There are also otherCHALLENGETYPEs.For exampledns-01is suitable for certifying domains with wildcards such as *.sagredo.eu, but it is necessary to have programs to automatically handle theDNSserver. This part is therefore not covered here.WELLKNOWN="/var/www/htdocs/dehydrated"is the directory wheredehydratedwill install the ‘challenge-tokens’, which will be retrieved viahttpin order to validate the domain.HOOK="${BASEDIR}/scripts/hook.sh"is the script that is launched during the certificate creation operations. It's used to assemble the certificate forqmail, to restart the servers and to notify the administrator via email in case of problems. Commented out during the test phase.HOOK_CHAIN="yes"batches all domain challenges into a single hook execution instead of calling one hook per certificate.KEY_ALGO=rsaspecifies the algorithm to be used for the public key.IP_VERSION=4resolves names to addresses of IPv4 only.
To use dehydrated you need to register an account:
# dehydrated --register --accept-terms # INFO: Using main config file /etc/dehydrated/config + Generating account key... + Registering account key with ACME server... + Fetching account URL... + Done!
The account information is saved in the /etc/dehydrated/accounts directory.
Domains configuration
- More info here
- Read the following before continuing: Server Name Indication (SNI) for qmail and dovecot
Create a domains.txt file where to arrange the domains to be certified separated by a blank space. If a directory named domains.txt.d exists in the same location as domains.txt, the contents of *.txt files in that directory are appended to the list of domains, in alphabetical order of the filenames. This is useful for automation, as it doesn't require editing an existing file to add new domains.
As you know, as soon as you run dehydrated -c, a specific certificate is built for each row in domains.txt. The name of each certificate is the first domain name of the row. The other domains in the same row are alternative names (SAN) for the same certificate. If you plan to add SNI benefits to your setup, you have to put there all domains that clients' wizards will try to guess while configuring the user's mailbox. For example, if you are configuring roberto@sagredo.eu, the wizard will probably look for smtp.sagredo.eu for the SMTP server and imap.sagredo.eu for the IMAP.
Usually domains.txt contains many rows dedicated to SNI purposes and a few other lines for domains having websites:
domain1.tld imap.domain1.tld pop3.domain1.tld smtp.domain1.tld --> qmail DEFAULT certificate domain2.tld imap.domain2.tld pop3.domain2.tld smtp.domain2.tld --> qmail SNI certificate domain3.tld imap.domain3.tld pop3.domain3.tld smtp.domain3.tld --> qmail SNI certificate ..... webmail.mydomain.tld --> other lines used for websites
In this example dehydrated creates several certificates, with the latter only intended for use with Apache sites (the webmail for instance).
If you have hundreds of vpopmail virtual domains, you can extract the domains index with vdominfo -n and then build lines like in the example above for each domain and even for each alias domain. Remember to add lines like these to your name server zones forn each domain:
smtp IN CNAME mail.domain.tld. imap IN CNAME mail.domain.tld. pop3 IN CNAME mail.domain.tld.
Last but not less important thing, I strongly suggest to put all domains for ordinary http sites (webmail.mydomain.tld in the above example) in /etc/dehydrated/domains.txt.d/otherdomains.txt so that no additional qmail certificate will be built, and no Dovecot/apache configuration will be added for these domains.
Apache configuration
Generally, you have to certify many domains (websites or mail domains) each one with its own VirtualHost and DocumentRoot. dehydrated has to save the 'challenge-tokens' in the same directory accessible to all these domains, let's say /var/www/htdocs/dehydrated, which is the one referred by the WELLKNOWN parameter in the configuration file.
Let's create it (you can customize its path below):
mkdir -p /var/www/htdocs/dehydrated
Since you have to include the same code multiple times (one for each VirtualHost) it is convenient to automate everything by saving it in a redirect.conf file to be imported into each VirtualHost. Let's save it to the Apache configuration folder, i.e. /etc/httpd:
# Define or change LOGDIR to where your server saves the logs
LOGDIR=/var/www/error
WELLKNOWN=/var/www/htdocs/dehydrated
cat > /etc/httpd/redirect.conf << __EOF__
Define LOGDIR ${LOGDIR}
Define WELLKNOWN ${WELLKNOWN}
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge
RewriteRule ^(.*) https://%{SERVER_NAME}\$1 [R,L]
</IfModule>
Alias /.well-known/acme-challenge \${WELLKNOWN}
<Directory \${WELLKNOWN}>
Options None
AllowOverride None
Require all granted
</Directory>
CustomLog "\${LOGDIR}/dehydrated_access.log" combined
ErrorLog "\${LOGDIR}/dehydrated.f2b.log"
__EOF__
By doing so, requests for files like /.well-known/acme-challenge/* will be served in the folder /var/www/htdocs/dehydrated, while the rest of the traffic will be redirected (in this example) to the https address with the same domain (SERVER_NAME). As you can see, this assumes that the Apache's mod_rewrite module has been enabled.
Again for matters of order and economy of code, it is best to define some variables in the general configuration file /etc/httpd.conf (or wherever you prefer). For example, you can save there the path of the file to be included and, since you're at it, the file that you will use later to import the SSL certificates and also the folder that will host the certificates:
Define REDIRECT /etc/httpd/redirect.conf Define SSL /etc/httpd/ssl.conf Define CERTDIR /etc/dehydrated/certs
Here is a schema of the virtual host related to a mail domain:
<VirtualHost *:80>
ServerName smtp.domain1.tld
Include ${REDIRECT}
</VirtualHost>
We will see later how to handle ServerAliases entries for SNI domains. Leave only one of your domains as ServerName for the time being. Do not enable the virtual domains on port 443 until the SSL certificate is in place.
Certificates creation
It is now the time to create our certificates:
# dehydrated -c # INFO: Using main config file /etc/dehydrated/config Processing smtp.domain1.tld + Creating new directory /etc/dehydrated/certs/smtp.domain1.tld ... + Signing domains... + Generating private key... + Generating signing request... + Requesting new certificate order from CA... + Received 1 authorizations URLs from the CA + Handling authorization for smtp.domain1.tld + 1 pending challenge(s) + Deploying challenge tokens... + Responding to challenge for smtp.domain1.tld authorization... + Challenge is valid! + Cleaning challenge tokens... + Requesting certificate... + Order is processing... + Checking certificate... + Done! + Creating fullchain.pem... + Done!
You should get a similar result for each requested certificate (one for each line in domains.txt). The certificates are saved in the certs folder, whose address is stored in the CERTDIR variable. Use man or even dehydrated -h to see how to delete or revoke certificates.
Remember that, as long as the certificates are created by the letsencrypt-test authority, the verification will fail. I suggest to continue to use the letsencrypt-test authority until we have tested the hook script.
At this point the certificates are not yet seen neither by the web server, nor by qmail and nor by Dovecot. If you are still testing and have a working certificate in production, use a test domain for the following tests with Apache.
Apache SSL configuration
Configure Apache by creating a file with the SSL settings to import into each VirtualHost:
cat > /etc/httpd/ssl.conf << __EOF__
SSLEngine on
SSLCertificateFile \${CERTDIR}/\${CERTNAME}/fullchain.pem
SSLCertificateKeyFile \${CERTDIR}/\${CERTNAME}/privkey.pem
SSLCertificateChainFile \${CERTDIR}/\${CERTNAME}/fullchain.pem
__EOF__
CERTNAME is the name of the certificate, to pass before including the file, as in the example below. CERTDIR is a variable that you have already defined above in the httpd.conf file.
This is an example of VirtualHost configured to host web pages in https, for example the RoundCube webmail:
<VirtualHost *:80>
ServerName webmail.mydomain.tld
ServerAlias webmail.otherdomain.tld
# used by dehydrated's challenge
Include ${REDIRECT}
</VirtualHost>
<VirtualHost *:443>
# The name of the certificate is the first domain of the line in /etc/dehydrated/domains.txt
Define CERTNAME mydomain.tld
# SSL cannot work until the certificate is in place. Comment it out initially
Include ${SSL}
ServerName webmail.mydomain.tld
ServerAlias webmail.otherdomain.tld
ErrorLog ${LOGDIR}/roundcube_error.log
CustomLog ${LOGDIR}/roundcube_access.log combined
DocumentRoot ${HTDOCS}/roundcube
<Directory ${HTDOCS}/roundcube>
Require all granted
</Directory>
</VirtualHost>
Installing the hook script
hook.shscript- More info on SNI for
qmailandDovecot
dehydrated is able to launch a program of our choice during the creation of the certificate (HOOK="${BASEDIR}/scripts/hook.sh" in the config file). It is used to build the certificate for qmail, to add the SNI settings for Dovecot and Apache, to restart the servers and to notify the administrator via email in case of problems.
The hook.sh script is shipped by dehydrated itself and might be changed by them in the future, so my functions are saved into hook.inc and then imported in hook.sh in order to simplify future upgrades of the main file.
Download and create a symbolic link to the "scripts" dir:
VERSION=4.0
cd /etc/dehydrated
wget https://github.com/sagredo-dev/dehydrated-hook/archive/refs/tags/v${VERSION}.tar.gz
tar xzf v${VERSION}.tar.gz
ln -s dehydrated-hook-${VERSION} scripts
cp hook.conf.template hook.conf
hook.tpl is the template for the email alerts. You may want to customize it by translating to your local language.
The hook.sh script call in the config file is commented out by default to avoid it to change the /var/qmail/control/servercert.pem file during the initial tests. Now it's the time to enable it by uncommenting the "hook" line in /etc/dehydrated/config.d/local.sh:
HOOK="${BASEDIR}/scripts/hook.sh"
You can now customize your hook.conf file. The important options to understand are the following:
- The
qmailcertificate is built only ifMAKE_MAIL_CERTS=1is set. IfMAKE_MAIL_CERTS=0the hook script only deploys the certificates (use for webserver). - Server Name Indication (
SNI) stuff forqmailandDovecotcan be disabled by settingENABLE_SNI=0(default). ServerNameandServerAliasentries forApacheandSNIdomains can be automatically added in the apache'sVirtualDomainwithENABLE_APACHE_SNI_CONF=1(I'll explain it in a moment).
The qmail default certificate ($QMAILDIR/control/servercert.pem file) is the result of the concatenation of the private key and the fullchain. This is where the first certificate (first row in domains.txt) is installed, provided that you have MAKE_MAIL_CERTS=1. Domain-specific SSL certificates for servers that are reachable under different names when the client supports SNI are installed into $QMAILDIR/control/servercerts/<FQDN>/servercert.pem provided that you have ENABLE_SNI=1.
Regarding Dovecot, it is necessary to correctly set the address of the default certificate in your local.conf file:
ssl_server_cert_file = /etc/dehydrated/certs/mx.mydomain.tld/fullchain.pem ssl_server_cert_file = /etc/dehydrated/certs/mx.mydomain.tld/privkey.pem
hook.sh defines additional certificates sni.conf (do not edit manually) to be presented according to the client hostname and the SNI logic. Again, this is disabled if ENABLE_SNI=0.
Concerning Apache, ENABLE_APACHE_SNI_CONF=1 will make the hook.sh script to populate a file with the ServerName and ServerAlias entries for all lines in domains.txt, for example:
ServerName domain1.tld --> 1st domain of 1st line in domains.txt ServerAlias imap.domain1.tld pop3.domain1.tld smtp.domain1.tld --> SAN in 1st line ServerAlias domain2.tld imap.domain2.tld pop3.domain2.tld smtp.domain2.tld --> domains in 2nd line ServerALias domain3.tld imap.domain3.tld pop3.domain3.tld smtp.domain3.tld --> domains in 3rd line ...
To activate the above logic define APACHE_SNI_CONF=/etc/httpd/sni.conf, i.e. the file where to add the ServerName and ServerAlias entries (do not edit manually as it is generated each time you run dehydrated -c based on the domains.txt contents). Now import that file in the apache VirtualHost that is going to handle the dehydrated challenge:
<VirtualHost *:80>
Include /etc/httpd/sni.conf
Include ${REDIRECT}
</VirtualHost>
Deploying the certificates and synchronizing the configuration
You may have noticed those other two executables: cert-sync and dehydrated-renew:
cert-syncserves to synchronizeqmail,Dovecotand (eventually)apacheconfiguration once you modified domains.txt, with no need to wait fordehydrated -cto run. So, if you delete a domain from domains.txt or reorganize the SAN in it, without touching the existing certificates, just run this script.dehydrated-renewis a cron wrapper script ofdehydrated, which in turn callsdehydrated -c -g, synchronizesqmail,DovecotandapacheSNI configuration and finally reloads the servers only when ALL certs are deployed.
It is used in order to avoid to restart the services each time a certificate is deployed (the default behaviour ofdehydrated), which is not funny if you have hundreds of lines in domains.txt. The-goption (--keep-going) is important to keep going after encountering an error while creating/renewing multiple certificates in cron mode.
You are ready to run
/etc/dehydrated/scripts/dehydrated-renew
Check that the certificates for qmail and the SNI configuration files are populated as desired. Then purge your domains.txt file from zombie domains you are no longer an authoritative name server or mx, as those domains are causing alerts and slowing down the deploy process. Make send/receive tests. When everything is ok you can set dehydrated to look for the letsencrypt authority by setting
CA="letsencrypt"
in the /etc/dehydrated/config.d/local.sh file. Then run dehydrated-renew for the last time.
Cronjob setup
Let's Encrypt recommends renewing certificates automatically when they have a third of their total lifetime left. The current certificate lifetime is 90 days, that means renewing 30 days before expiration. Let's set the cronjob so that it runs the script once a month:
cat > /etc/cron.d/dehydrated << __EOF__ 40 2 6 * * root /etc/dehydrated/dehydrated-renew >> /var/log/dehydrated 2>&1 __EOF__
You can now remove the old update_tmprsadh crontab line.
Installing certbot
The documentation concerning certbot is no longer updated as it has been replaced by the one based on dehydrated. It is left intact in case it might still be useful to someone.
More info:
Here is how to install and configure a valid certificate from Let's Encrypt for your qmail and dovecot servers. The installation will be done by certbot.
Certbot is part of EFF’s effort to encrypt the entire Internet. Secure communication over the Web relies on HTTPS, which requires the use of a digital certificate that lets browsers verify the identity of web servers (e.g., is that really google.com?). Web servers obtain their certificates from trusted third parties called certificate authorities (CAs). Certbot is an easy-to-use client that fetches a certificate from Let’s Encrypt—an open certificate authority launched by the EFF, Mozilla, and others—and deploys it to a web server.
Installing the certificate
It needs tons of prerequisites and a python v. 3, but there must be a package for your distribution that will do everything for you. Slackware users should refer to the slackbuild from SBO here (if you don't want to bother to manually install all the dependencies, sbotools is your friend).
The certificate will be provided once you prove to be the owner of the matched domain(s). So certbot has to install an ACME challenge in a directory of your choice and then retrieve it via http. If the challenge is successfull the certificate will be installed in /etc/letsencrypt.
Create the "webroot" dir where the ACME challenge will be stored:
mkdir -p /path/to/webroot
Now set up an apache virtual domain. In this example yourdomain.tld is the domain where you are going to do the smtp connection:
<VirtualHost *:80> ServerName yourdomain.tld DocumentRoot /path/to/webroot <Directory /path/to/webroot> Require all granted </Directory> </VirtualHost>
Prepare a script to install your certs via certbot as /usr/local/bin/my_certbot.sh:
cat > /usr/local/bin/my_certbot.sh << __EOF__
#!/bin/sh
#
CERTBOT=/usr/bin/certbot
DOMAIN=mydomain.tld
\$CERTBOT certonly \\
--webroot \\
--webroot-path /path/to/webroot \\
--preferred-challenges http-01 \\
--key-type rsa \\
-d \${DOMAIN} \\
--email myemail@\${DOMAIN} \\
--renew-by-default \\
--agree-tos \\
--text
# qmail cert
if [ ! -d "/var/qmail/control/certs_backup" ]; then
mkdir -p /var/qmail/control/certs_backup
fi
cp -p /var/qmail/control/*.pem /var/qmail/control/certs_backup/
cat /etc/letsencrypt/live/\${DOMAIN}/privkey.pem /etc/letsencrypt/live/\${DOMAIN}/fullchain.pem > /var/qmail/control/servercert.pem
chown vpopmail:vchkpw /var/qmail/control/*.pem
chmod o-r /var/qmail/control/*.pem
/usr/local/bin/qmailctl restart
# dovecot cert (you have to set the path inside 10-ssl.conf accordingly)
/usr/local/bin/dovecotctl restart
__EOF__
chmod +x /usr/local/bin/my_certbot.sh
mydomain.tld will be used as the certificate's name. To better understand what certbot can do:
certbot --help all
Remember to set the x flag:
chmod +x /usr/local/bin/my_certbot.sh
Now try to run it and hopefully you'll get the certificate with no errors.
Finally set up a cronjob that renew the cert once a month (the certificate remains valid for three months):
15 2 20 * * root /usr/local/bin/my_certbot.sh >> /var/log/cron
Remember to disable the old update_tmprsadh crontab line.
Configuring qmail and dovecot
As far as qmail is concerned the private key and the fullchain must be merged into a single file /var/qmail/control/servercert.pem. This is done by the above script itself.
Concerning dovecot, you just have to adjust your /usr/local/dovecot/etc/dovecot/conf.d/10-ssl.conf file as follows:
#ssl_cert = </etc/ssl/certs/dovecot.pem #ssl_key = </etc/ssl/private/dovecot.pem ssl_cert = </etc/letsencrypt/live/yourdomain.tld/fullchain.pem ssl_key = </etc/letsencrypt/live/yourdomain.tld/privkey.pem
Restart qmail and dovecot to enable the new certificate.


Comments
ECDSA support in qmail
Keng Heng. Chan September 25, 2025 09:11 CET
Hi,
The ECDSA is getting common nowsday. Any possible to patch the qmail to support ECDSA ?
Thanks.
Reply | Permalink
Path Correction in my_dehydrated.sh
Shailendra Shukla March 20, 2025 15:06 CET
Hi Roberto ,
In the guide in the installation section we are doing the following
But in the my_dehydrated.sh script we are calling it at the following location
Just to save the community from reaching you again and again for a small fix thought I will update you .
Cheers
Reply | Permalink
Path Correction in my_dehydrated.sh
Roberto Puzzanghera Shailendra Shukla March 20, 2025 15:26 CET
Hi Shailendra,
/usr/local/bin is the path of the manual installation, but I think that most of us installed it via package in /usr/bin. So the difference was intentional.
Reply | Permalink
Crons syntax
Mike January 10, 2024 10:56 CET
Hi Roberto,
you have typo mistake, I guess your's day also 24h ))
Reply | Permalink
Crons syntax
Roberto Puzzanghera Mike January 10, 2024 11:11 CET
Thank you, corrected
Reply | Permalink
How to try if certificate is working and valid?
Joao Savioli August 31, 2023 19:14 CET
Hi,
Is it to possible to try if qmail smtp certificate is a valid and working?
Thanks
Joao
Reply | Permalink
How to try if certificate is working and valid?
Roberto Puzzanghera Joao Savioli August 31, 2023 19:56 CET
you can do
and look for Verify return code: 0 (ok) after the certificate has been presented
Reply | Permalink
How to try if certificate is working and valid?
Joao Savioli Roberto Puzzanghera September 1, 2023 15:36 CET
Hello Roberto, thank you for replying.
I've trid this command from two servers, and they return different results. How is it possible?
PS: I've changed my host for MY_HOST_SERVER.
FROM SERVER 1:
FROM SERVER 2:
Reply | Permalink
How to try if certificate is working and valid?
Roberto Puzzanghera Joao Savioli September 1, 2023 17:42 CET
The first example shows that after the handshake it didn't get almost anything back, but I don't know why (SSL handshake has read 179 bytes and written 351 bytes).
I'm not an ssl expert, but it seems like the client is sending a request with the SSL3 protocol, which is not accepted by the server, where the renegotiation could be also forbidden. I would try to upgrade the openssl client and retry, or set it not to use ssl3 anymore. Have also a look here https://github.com/openssl/openssl/issues/18291#issuecomment-1123685518
Reply | Permalink
multiple domain certificates
Ivelin Topalov July 21, 2021 23:13 CET
i have a few domains in same machine served by qmail
the script for letsencrypt 1 domain cert for qmail combines priv key and fullchain in servercert
as i having few - how to make 1 servercert for all domains - just cat all one after another like ke1 chain1 ke2 chain2 ... ?
cat /etc/letsencrypt/live/${DOMAIN}/privkey.pem /etc/letsencrypt/live/${DOMAIN}/fullchain.pem > /var/qmail/control/servercert.pemReply | Permalink
multiple domain certificates
Roberto Puzzanghera Ivelin Topalov July 22, 2021 07:31 CET
I'm not sure that merging the domains' certificates will work.
I suggest to create a cumulative certificate (which is valid for all your domains) like this
this will work for sure
Reply | Permalink
update_tmprsadh - Termporary certificates
Marco Varanda June 1, 2021 22:05 CET
Hello Roberto,
Your site is great !
When I was setting up my server, I used update_tmprsadh (crontab) and its PEM, but when I create Let's Encrypt REAL certificate, I changed dovecot, site (apache, webmail) .. .everythink is OK. (I prefer DNS Challenge - djbdns)
But .... Crontab and update_tmprsadh continue running.
Maybe, you can include in this page, after you successful with Certbot (Let's Encrypt), disable crontab line, and delete the files (correcting dovecot /etc/dovecot/conf.d/10-ssl.conf) restart, etc
Thanks again
Varanda
Reply | Permalink
update_tmprsadh - Termporary certificates
Roberto Puzzanghera Marco Varanda June 2, 2021 10:08 CET
Thanks for the hint.. I'll do it as soon as possible
Reply | Permalink
cosmetic error
Marco Varanda April 23, 2020 01:52 CET
Crontab script refers to my_certbot.sh
but we created my_cert.sh script
Reply | Permalink
cosmetic error
Roberto Puzzanghera Marco Varanda April 23, 2020 08:43 CET
Corrected. Thank you
Reply | Permalink
Certbot Error....
Elcio Bortolin October 19, 2018 14:44 CET
I'm trying to use certbot. I installed all dependencies. But an error occurs with zope.interface.
Can you help me?
Reply | Permalink
Certbot Error....
Roberto Puzzanghera Elcio Bortolin October 19, 2018 19:03 CET
it seems like zope.interface is not installed... try "pip install zope.interface"
Reply | Permalink
sacha August 30, 2018 18:59 CET
Hi, I got Apache & qmail (netqmail-1.06) server on 1 ip, 7 domain name managed by SNI, and using for a while letsencrypt for https.
I would like to set up qmail with certificate from Let's Encrypt
I hope you could help me to configure it, as you seems the qmail master.
About qmail, using netqmail-1.06 do I have to patch anything as netqmail-1.06-tls+auth-20151215_20160609.patch or large-dns-response.patch?
As i already got 1 cert by domain for Apache, could I reuse it for qmail?
In this case, should copy .pem file in /control/ as:
Otherwise, how could I specify each .pem file for each Domain?
Best
Reply | Permalink
Roberto Puzzanghera sacha August 30, 2018 19:19 CET
Hi, no patch is needed for qmail. You can use one single cert for all your domain, provided you create your cert with
Be aware that the new letsencrypt provides wildcards to allow subdomains, but a TXT record in your DNS is required.
And no, you can't use your apache's cert as is. You have to combine that cert with the private key, as shown above inside the script.
Reply | Permalink
sacha Roberto Puzzanghera August 30, 2018 20:53 CET
Thanks a lot Roberto for you answer.
Well note about the TXT record
I guess it must be something as:
acme-challenge.mydomain1.com. IN TXT "yB_EQ-w[…]E"
acme-challenge.www.mydomain1.com. IN TXT "yB_EQ-w[…]E"
About cert, if I understood what you said.
I have to create a new certificate only for Qmail, with -d parameter with all domain.
Reply | Permalink
Roberto Puzzanghera sacha August 30, 2018 21:31 CET
Yes to both questions
Reply | Permalink
sacha Roberto Puzzanghera August 31, 2018 07:35 CET
Thanks
Sorry to insist, but if qmail doesn't need any patch to run tls.
For what netqmail-1.06-tls+auth-20151215_20160609.patch is use for?
Reply | Permalink
Roberto Puzzanghera sacha August 31, 2018 15:35 CET
Sorry I thought at first reading that you were asking if modifications were needed to that patch. Of course you need qmail to be patched for tls, so the only patch that makes sense if you want to test letsencrypt certificates is qmail-tls
Reply | Permalink
sacha Roberto Puzzanghera September 1, 2018 14:50 CET
Hi roberto.
No problem, that's my fault.
As I'm french and english isn't my mother tongue I guess my question wasn't clear.
So to get tls on my qmail, I need to patch netqmail with:
Qmail-tls
http://inoa.net/qmail-tls/netqmail-1.06-tls-20160918.patch
or
your patch including smtp-auth + qmail-tls + forcetls
https://notes.sagredo.eu/files/qmail/patches/roberto-netqmail-1.06_auth_tls_force-tls.patch-latest
or you combined patch
https://notes.sagredo.eu/files/qmail/patches/roberto-netqmail-1.06.patch-latest.gz
Is that right?
Reply | Permalink
Roberto Puzzanghera sacha September 1, 2018 15:20 CET
yes, of course one reason to use TLS is securing the auth, that's the reason why I made a package with auth and tls patches together. My big patch includes both.
Reply | Permalink
Let's Encrpyt
Eric June 18, 2018 17:58 CET
Roberto,
Isn't 'DOMAIN=smtp.yourdomain.tld' in the above script (/usr/local/bin/my-cert.sh) supposed to be 'DOMAIN=yourdomain.tld'
Eric
Reply | Permalink
Let's Encrpyt
Roberto Puzzanghera Eric June 18, 2018 21:46 CET
Hi Eric,
it is the domain name that you use to connect to your server.. in my example I'm imaging that there are different servers for smtp imap and so on
Reply | Permalink
Reason 3 aliases needed
Bart Koppers March 25, 2018 13:22 CET
Hi! Usefull post about using the LE certificate for qmail.
I was wondering: is there a specific reason you stated the aliases: smtp, pop3, imap?
IMHO, if it is 1 host, could you not (better) use 1 alias, for example mail.mydomain.mynet ?
regards, Bart
Reply | Permalink
Reason 3 aliases needed
Roberto Puzzanghera Bart Koppers March 25, 2018 13:33 CET
Hi! Because I'm not excluding that the three could live in three separated (virtual) servers
Reply | Permalink