foxcpp / maddy

✉️ Composable all-in-one mail server.
https://maddy.email
GNU General Public License v3.0
4.99k stars 240 forks source link

Documentation for TLS certificates managed by Caddy #296

Open skyfaller opened 3 years ago

skyfaller commented 3 years ago

Use case

I use Caddy to manage my certificates. The documentation mentions how to work with Let's Encrypt and certbot and ACME.sh, but I don't use those and don't know how to use those.

Your idea for a solution

Could we please write some documentation on how to work with TLS certificates managed by Caddy? I'd be willing to help test the instructions as a clueless noob.

foxcpp commented 3 years ago
  1. Hard-link certificates from caddy's directory (CADDY_ROOT/certificates/acme-v02.api.letsencrypt.org-directory/DOMAIN) into some directory that is accessible for maddy (e.g. /etc/maddy). Using hard-links of symlinks simplifies step 2.
  2. Ensure that maddy can read the certificate file. Either using extended ACLs (setfacl -m u:maddy:r /etc/maddy/tls.key) or by running maddy under caddy's group (probably www-data).
  3. Set paths to hard-linked certs in maddy.conf: tls /etc/maddy/tls.crt /etc/maddy/tls.key
Kinrany commented 3 years ago

Is it possible in theory/in practice for maddy to delegate dealing with certificates to caddy, the same way one can use HTTPS between caddy and outside world and HTTP between caddy and local containers?

foxcpp commented 3 years ago

caddy would need to implement SMTP and IMAP proxy functionality with support for some reverse proxy indication (e.g. HAProxy PROXY or Postfix's XCLIENT extensions). maddy would need to support the latter.

foxcpp commented 3 years ago

Generic TLS/TCP reverse proxy is not enough for server-server SMTP.

cypx commented 3 years ago

Maybe you could have a look to Traefik Iit share a lot of commonalities with Caddy (Go, native let's encrypt support, API, docker integration, easy to use....) but also provide generic TCP (and UDP) support and not only HTTP. I use it as a reverse proxy for a Postfix/Dovecot/RoundCube server which i consider to migrate to Maddy (but for now the lack of IMAP support made me wait)

foxcpp commented 3 years ago

Traefik supports HAProxy's PROXY protocol for TCP proxy.