zdeneksvarc / postal-tls

TLS add-on for the Postal mail delivery platform (HTTPS, StartTLS, implicit TLS)
5 stars 3 forks source link

About

ā— This repository runs with the Postal version 2.1.2. It should be fine for version 2.1.x maybe 2.x

The Postal mail delivery platform does not offer encrypted services in the basic installation. That is certificate management, HTTPS interface, mail submission via oportunistic TLS (StartTLS) and implicit TLS. Deploying this repository via Docker Compose will provide these services.

Components of the deployment:

Pre-requisites

Installed Postal according to the official instructions with working web interface on port 80 and SMTP on port 25. No HTTPS reverse proxy, no certificates management.

Installation procedure

  1. Suppose the directory for installed Postal is /opt/postal. Edit configuration file /opt/postal/config/postal.yml adding FQDN of the Postal host (for example postal.example.com) instead of <HOST> in the smtp_server section:
smtp_server:
  port: 25
  tls_enabled: true
  tls_certificate_path: /caddy-data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/<HOST>/<HOST>.crt
  tls_private_key_path: /caddy-data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/<HOST>/<HOST>.key
  1. Suppose the directory for postal-tls will be /opt/caddy-tls. Change the working directory cd /opt. Fetch the install repository sudo git clone https://github.com/zdeneksvarc/postal-tls.git. Jump to the new working directory cd /opt/postal-tls
  2. Set the FQDN of the Postal host in the files .env and Caddyfile. Also set your e-mail address in the Caddyfile instead of your@email.com which is used to identify the owner of the certificate.
  3. Still in the /opt/postal-tls now run docker compose up https and wait a while until Caddy gets the certificates. Then exit via CTRL-C
  4. Create a symlink sudo ln -s /opt/postal-tls/caddy-data /opt/postal/caddy-data and set permissions of directory sudo find /opt/postal-tls/caddy-data -type d -exec chmod 755 {} + and set permissions of files sudo find /opt/postal-tls/caddy-data -type f -exec chmod 644 {} +
  5. Add the volume with certificates /opt/postal/caddy-data:/caddy-data to the Postal smtp service in /opt/postal/install/docker-compose.yml.
  6. This step is not necessary, but for the sake of clarity we can delete the Caddyfile offered by Postal sudo rm /opt/postal/config/Caddyfile and link a working one sudo ln -s /opt/postal-tls/Caddyfile /opt/postal/config/Caddyfile and remove .git directory sudo rm -r /opt/postal-tls/.git and .gitignore file sudo rm -r /opt/postal-tls/.gitignore
  7. Stop Postal via postal stop and start Postal via postal start, which will now start with StartTLS support on port 25.
  8. Still in the working directory /opt/postal-tls start the postal-tls Docker Compose project via docker compose up -d and you're done šŸŽ‰

Services testing

A few notes