Renew certificate for mail

try accessing it from the outside:
http://your.sitename/.well-known/acme-challenge/test.txt ( your.sitename = mydomain)
ping to www.mydomain.com is not accesible, the domain not have a public ip asociated, I suposse that the web server is not functionaly.

netstat -pant | grep 443

tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 813/apache2
tcp 0 0 192.168.1.125:443 192.168.1.3:58299 FIN_WAIT2 -

just replace "your.sitename" with your sites domain name.

That doesn't make any sense... it is running HTTP and HTTPS...
How is it accessed from the Internet?

Also re-check:
grep -i servername /etc/apache2/sites-enabled/*
grep -i serveralias /etc/apache2/sites-enabled/*

AND PLEASE DONT REPLACE YOUR REAL DOMAIN NAME WITH "MYDOMAIN.COM"

Yes, I replaced form my domain: estudioines.com

grep -i servername /etc/apache2/sites-enabled/*

/etc/apache2/sites-enabled/000-default.conf: # The ServerName directive sets the request sch eme, hostname and port that
/etc/apache2/sites-enabled/000-default.conf: # redirection URLs. In the context of virtual h osts, the ServerName
/etc/apache2/sites-enabled/000-default.conf: #ServerName www.example.com

This makes things unnecessarily difficult.
I need sleep
good night

Good nigh my friend. Thanks for now, I will wait for instructions to solve the case. Thanks again

With certbot, generally the way to get a certificate that’s valid for multiple domain names (no matter which plugin you use - webroot, apache, manual, etc) is to specify all the domains using the -d option. For example:

certbot certonly --apache -d smtp.estudioines.com,imap.estudioines.com,mail.estudioines.com

If that works you’ll get a single certificate that’s valid for all 3 subdomains. You probably want to cover any valid subdomain that might be used in the Outlook configuration etc, so you could also add webmail.estudioines.com if you feel that’s appropriate.

If --apache won’t work for you, you could also try --webroot (as @rg305 has been suggesting) or --manual. I personally find --apache to be the easiest in most cases, but YMMV. --manual is by far the hardest to automate so consider it a last resort. If you want to use --webroot, your web root is probably /var/www/html.

Then you need to edit the postfix and dovecot configuration files and make sure they are pointing to that certificate, and reload them.

ok, we go in parts, I have a debian server, which has a public ip address which is with the domain webmail.estudioines.com (I just discovered it)
then following his subject:

certbot certonly --apache -d smtp.estudioines.com -d imap.estudioines.com -d mail.estudioines.com Saving debug log to /var/log/letsencrypt/letsencrypt.log

Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org


You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/mail.estudioines.com.conf)

It contains these names: mail.estudioines.com

You requested these names for the new certificate: smtp.estudioines.com,
imap.estudioines.com, mail.estudioines.com.

Do you want to expand and replace this existing certificate with the new
certificate?

(E)xpand/(C)ancel: e
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for smtp.estudioines.com
tls-sni-01 challenge for imap.estudioines.com
tls-sni-01 challenge for mail.estudioines.com

We were unable to find a vhost with a ServerName or Address of smtp.estudioines.com.
Which virtual host would you like to choose?
(note: conf files with multiple vhosts are not yet supported)

1: default-ssl.conf | | HTTPS | Enabled
2: estudio.conf | www.estudioines.com | |
3: analaura.conf | www.analauraquintana. | | Enabled
4: 000-default.conf | | | Enabled
5: velarcrsn.com.conf | www.velacrsn.com | | Enabled
6: klmsui.conf | | HTTPS |

Select the appropriate number [1-6] then [enter] (press 'c' to cancel):
which is the correct option?

I’d go with 1, or 4 should also work i think

ok , chose option 1:
but the outlook error continue…

Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for smtp.estudioines.com
tls-sni-01 challenge for imap.estudioines.com
tls-sni-01 challenge for mail.estudioines.com

We were unable to find a vhost with a ServerName or Address of smtp.estudioines.com.
Which virtual host would you like to choose?
(note: conf files with multiple vhosts are not yet supported)

1: default-ssl.conf | | HTTPS | Enabled
2: estudio.conf | www.estudioines.com | |
3: analaura.conf | www.analauraquintana. | | Enabled
4: 000-default.conf | | | Enabled
5: velarcrsn.com.conf | www.velacrsn.com | | Enabled
6: klmsui.conf | | HTTPS |

Select the appropriate number [1-6] then [enter] (press ‘c’ to cancel): 1

We were unable to find a vhost with a ServerName or Address of imap.estudioines.com.
Which virtual host would you like to choose?
(note: conf files with multiple vhosts are not yet supported)

1: default-ssl.conf | | HTTPS | Enabled
2: estudio.conf | www.estudioines.com | |
3: analaura.conf | www.analauraquintana. | | Enabled
4: 000-default.conf | | | Enabled
5: velarcrsn.com.conf | www.velacrsn.com | | Enabled
6: klmsui.conf | | HTTPS |

Select the appropriate number [1-6] then [enter] (press ‘c’ to cancel): 1

We were unable to find a vhost with a ServerName or Address of mail.estudioines.com.
Which virtual host would you like to choose?
(note: conf files with multiple vhosts are not yet supported)

1: default-ssl.conf | | HTTPS | Enabled
2: estudio.conf | www.estudioines.com | |
3: analaura.conf | www.analauraquintana. | | Enabled
4: 000-default.conf | | | Enabled
5: velarcrsn.com.conf | www.velacrsn.com | | Enabled
6: klmsui.conf | | HTTPS |

Select the appropriate number [1-6] then [enter] (press ‘c’ to cancel): 1
Waiting for verification…
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0028_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0028_csr-certbot.pem

IMPORTANT NOTES:

  • Congratulations! Your certificate and chain have been saved at
    /etc/letsencrypt/live/mail.estudioines.com/fullchain.pem. Your cert
    will expire on 2018-03-03. To obtain a new or tweaked version of
    this certificate in the future, simply run certbot again. To
    non-interactively renew all of your certificates, run “certbot
    renew”

  • If you like Certbot, please consider supporting our work by:

    Donating to ISRG / Let’s Encrypt: https://letsencrypt.org/donate
    Donating to EFF: https://eff.org/donate-le

Right, so far so good. Now you have a certificate for all those domain names, you need to make sure postfix and dovecot are using it.

Try this:

grep -r letsencrypt /etc/{postfix,dovecot}

Hopefully that should give you an idea of which files need to be updated. You want them all to point to the files in /etc/letsencrypt/live/mail.estudioines.com as that’s where the newly expanded certificate is.

grep -r letsencrypt / etc / {postfix, dovecot}
/lib/systemd/system/certbot.service:Documentation=https://letsencrypt.readthedoc s.io/en/latest/
/etc/dovecot/conf.d/10-ssl.conf:ssl_cert = </etc/letsencrypt/live/imap.estudioin es.com/fullchain.pem
/etc/dovecot/conf.d/10-ssl.conf:ssl_key = </etc/letsencrypt/live/imap.estudioine s.com/privkey.pem
/etc/postfix/main.cf:smtpd_tls_cert_file=/etc/letsencrypt/live/mail.estudioines. com/fullchain.pem
/etc/postfix/main.cf:smtpd_tls_key_file=/etc/letsencrypt/live/mail.estudioines.c om/privkey.pem
/etc/apache2/conf-available/roundcube.conf:SSLCertificateFile /etc/letsencrypt/l ive/webmail.estudioines.com/fullchain.pem
/etc/apache2/conf-available/roundcube.conf:SSLCertificateKeyFile /etc/letsencryp t/live/webmail.estudioines.com/privkey.pem

/etc/letsencrypt/renewal/mail.estudioines.com.conf:cert = /etc/letsencrypt/live/ mail.estudioines.com/cert.pem
/etc/letsencrypt/renewal/mail.estudioines.com.conf:privkey = /etc/letsencrypt/li ve/mail.estudioines.com/privkey.pem
/etc/letsencrypt/renewal/mail.estudioines.com.conf:chain = /etc/letsencrypt/live /mail.estudioines.com/chain.pem
/etc/letsencrypt/renewal/mail.estudioines.com.conf:fullchain = /etc/letsencrypt/ live/mail.estudioines.com/fullchain.pem
/etc/letsencrypt/renewal/mail.estudioines.com.conf:archive_dir = /etc/letsencryp t/archive/mail.estudioines.com
/etc/letsencrypt/renewal/imap.estudioines.com.conf:cert = /etc/letsencrypt/live/ imap.estudioines.com/cert.pem
/etc/letsencrypt/renewal/imap.estudioines.com.conf:privkey = /etc/letsencrypt/li ve/imap.estudioines.com/privkey.pem
/etc/letsencrypt/renewal/imap.estudioines.com.conf:chain = /etc/letsencrypt/live /imap.estudioines.com/chain.pem
/etc/letsencrypt/renewal/imap.estudioines.com.conf:fullchain = /etc/letsencrypt/ live/imap.estudioines.com/fullchain.pem
/etc/letsencrypt/renewal/webmail.estudioines.com.conf:cert = /etc/letsencrypt/li ve/webmail.estudioines.com/cert.pem
/etc/letsencrypt/renewal/webmail.estudioines.com.conf:privkey = /etc/letsencrypt /live/webmail.estudioines.com/privkey.pem
/etc/letsencrypt/renewal/webmail.estudioines.com.conf:chain = /etc/letsencrypt/l ive/webmail.estudioines.com/chain.pem
/etc/letsencrypt/renewal/webmail.estudioines.com.conf:fullchain = /etc/letsencry pt/live/webmail.estudioines.com/fullchain.pem
/etc/letsencrypt/renewal/smtp.estudioines.com.conf:cert = /etc/letsencrypt/live/ smtp.estudioines.com/cert.pem
/etc/letsencrypt/renewal/smtp.estudioines.com.conf:privkey = /etc/letsencrypt/li ve/smtp.estudioines.com/privkey.pem
/etc/letsencrypt/renewal/smtp.estudioines.com.conf:chain = /etc/letsencrypt/live /smtp.estudioines.com/chain.pem
/etc/letsencrypt/renewal/smtp.estudioines.com.conf:fullchain = /etc/letsencrypt/ live/smtp.estudioines.com/fullchain.pem
/etc/letsencrypt/renewal/smtp.estudioines.com.conf:archive_dir = /etc/letsencryp t/archive/smtp.estudioines.com

Okay, so postfix seems to be good already. The file you need to edit for dovecot is:

/etc/dovecot/conf.d/10-ssl.conf

and you need to change these lines:

ssl_cert = </etc/letsencrypt/live/imap.estudioines.com/fullchain.pem
ssl_key = </etc/letsencrypt/live/imap.estudioines.com/privkey.pem

to:

ssl_cert = </etc/letsencrypt/live/mail.estudioines.com/fullchain.pem
ssl_key = </etc/letsencrypt/live/mail.estudioines.com/privkey.pem

Then reload both postfix and dovecot.

Yes, I was do it, but the problem continue…
I not understand, in the outlook configuration, smtp server is: stmp.estudio… and the imap/pop3 server is: mail.estudio…
but the error says imap.estudio…

Yeah, I can see that dovecot is still using the imap-only certificate.

Are you sure you reloaded dovecot as well as postfix?

Or maybe you have to actually restart it rather that just reload?

yes, the server was reboot completly.
sudo reboot

Can you run the grep command again please?

grep -r letsencrypt / etc / {postfix, dovecot}? yes, of course

…and post the results here, yes :slight_smile:

(btw, you seem to have added in some spaces; the command I meant for you to run was:

grep -r letsencrypt /etc/{postfix,dovecot}

noting that there are only 3 spaces in total. It doesn’t matter much, but the correct version will probably run a lot faster :wink: )

Sorry for the delay, I was very busy.
After you asked me to do the grep command, I saw that I had made a mistake, had a backup of the 10-ssl.conf file, called 10-ssl2.con, deleted that file and reconfigured 10-ssl.conf, restart the server and everything started to work. Thanks for the time and help of everyone who participated.