Debian12.5 ; Let's Encrypt, WEB/Mail Server SSL

1. Obtain a certificate (Let's Encrypt)

1.1 advance preparation

Enable mod_ssl

Install client tool to obtain Let's Encrypt certificate

1.2 Obtaining a Let's Encrypt Certificate

It is assumed that a web server such as Apache httpd or Nginx is running.
If the Web server is not running on the server where the work is to be performed, follow the steps ※ below.
It is also assumed that the server on which the work is to be performed (the server with the FQDN from which you want to obtain the certificate) is accessible from the Internet at port 80.

#Use the directory under the public directory of the running Web server as a temporary area for authentication by specifying [--webroot].
# -w [document root] -d [FQDN from which you want to obtain a certificate] # FQDN (Fully Qualified Domain Name) : Hostname. Domain name without abbreviation
#Document root is the one for the appropriate host definition if there are multiple host definitions in the virtual host
# Registration of e-mail address and agreement to terms of use are required for the first time only.
# Specify an email address to receive

Success when displaye "Congratulations! Your certificate and chain have been saved."
# The following certificate is obtained under [/etc/letsencrypt/live/<FQDN>/] as described in the message

# cert.pem ⇒ SSL server certificate (including public key)
# chain.pem ⇒ intermediate certificate
# fullchain.pem ⇒ File containing cert.pem and chain.pem combined
# privkey.pem ⇒ private key

※ Obtaining a Let's Encrypt certificate when the web server is not running

# Renew all certificates with an expiration date of less than 30 days
# If you want to renew regardless of the number of days remaining on the expiration date, specify [--force-renewal] as well

Renewing certificates already obtained
# Renew all certificates with an expiration date of less than 30 days
# If you want to renew regardless of the number of days remaining on the expiration date, specify [--force-renewal] as well

2. SSL/TLS (Let's Encrypt) configuration for Apache2

Edit Apache2 SSL-related configuration files

Reflecting and activating the configuration file

http to https redirect

One of the following methods

Reflection of settings and startup

3. SSL/TLS (Let's Encrypt) settings on the mail server

3.1 Obtaining a certificate for the mail server

Obtain a certificate for the mail server, but it cannot be obtained in the same way as above, so the following with the "--standalone" option fails.

If I stop the web server once and then do it, it succeeds as follows

3.2 Postfix Configuration

3.3 Dovecot Settings

Allow Port 587 in UFW

3.4 Thunderbird Settings

Receiving server

Port  :  143
Connection security   :  STARTTLS
Authentication method  :  Normal password

Sending server

Port   :  587
Connection security   :  STARTTLS
Authentication method  :  Normal password

Copied title and URL