Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".

Ubuntu Server 20.04 : Apache, Mail and FTP server SSL (Let's Encrypt)

1. Certificate Acquisition (Let's Encrypt)

1.1 advance preparation

①Enable mod_ssl

②Install client tool to obtain Let's Encrypt certificate

③Obtaining Certificates
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, perform step ④.
It is also assumed that the server on which the work is to be performed (the server with the FQDN from which the certificate is to be obtained) 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 for a 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 ""Successfully received certificate"

# 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
It is a prerequisite that access to port 80 of the server is available.

#Use the simple Web server function by specifying [--standalone].
# -d [FQDN from which you want to obtain a certificate] # FQDN (Fully Qualified Domain Name) : Hostname. Domain name without abbreviation
# If there are multiple FQDNs for which you want to obtain certificates, specify multiple -d [FQDNs for which you want to obtain certificates

⑤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. Configuring SSL/TLS (Let's Encrypt) in Apache2

①Editing the SSL-related configuration files for Apache2

②Reflection and activation of the configuration file

③http to https redirection

1.How to create an .htaccess file
Create a .htaccess file in /var/www/html/hoge.com/ and fill in the following

2.How to fill in /vhost-hoge.com.conf

④Configuration and start-up

3. Setting up SSL/TLS (Let's Encrypt) on your mail server

3.1 Setting up a virtual host and obtaining a certificate

①Configuring mail hosts on Apache virtual hosts

Under the virtual host settings for web services, add the following virtual host settings for mail

②Create a mail.hoge.com directory in /var/www/html/.

③Obtaining a letsencrypt SSL certificate for your mail server

3.2 Postfix Configuration

④Fix Postfix configuration file.
Configure SSL/TLS for encrypted communication.
SMTPS uses 465/TCP, POP3S uses 995/TCP and IMAPS uses 993/TCP.

Check that the settings are correct (if nothing appears, it's OK)
⑤Postfix startup, auto-start configuration

3.3 Configure Dovecot

①Modify the Dovecot configuration file

Enable imaps and pop3s, which use encryption, and disable imap and pop3, which communicate in plaintext, by setting "port = 0".
・Authentication method setting *Allows plain text passwords, but this is not a problem as they are encrypted using SSL/TLS
・Specify mailbox location
・Change log output destination
・Create log output destination
② Starting Dovecot and configuring auto-start

③Check that the authentication socket file has been created

4. Configure SSL/TLS (Let's Encrypt) for FTP Vsftpd

① Modify the Vsftpd configuration file

② Firewall settings
Allows a fixed PASV port other than the ftp port.
タイトルとURLをコピーしました