Caddy docker and stalwart-mail, where are the certs stored?

1. The problem I’m having:

I try to setup caddy with stalwart-mail. The service already has a valid caddy cert, the admin panel runs perfectly over ssl. But mail services require additional use of ssl certs.

After learning about macros in Stalwart (An example using Stalwart using Docker + Traefik, Caddy, etc · stalwartlabs/mail-server · Discussion #206 · GitHub) I wrote a line like this:

certificate.default.cert = "%{file:/etc/letsencrypt/live/mail.example.org/fullchain.pem}%"

But since my caddy configuration runs in docker, I am not aware where my certs are stored

2. Error messages and/or full log output:

there are no error messages

3. Caddy version:

Docker Compose version v2.27.0 with caddy:latest tag

4. How I installed and ran Caddy:

services:
  caddy_reverse_proxy:
    image: caddy:latest
    restart: unless-stopped
    container_name: caddy_proxy
    ports:
      - 80:80
      - 443:443
      - 443:443/udp
    volumes:
      - .Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
      - caddy_config:/config
    networks:
      - caddy_net
volumes:
  caddy_data: null
  caddy_config: null
networks:
  caddy_net: null

a. System environment:

Debian 12

d. My complete Caddy config:

nothing more than the usual:

sub.domain.com {
    reverse_proxy 192.168.1.10:8080
}

The certs/keys are in this volume.

But using them is somewhat more complicated with Caddy, because the directory they’re in depends on the ACME issuer Caddy uses. Caddy may use either Let’s Encrypt or ZeroSSL; if one is having problems, it’ll fallback to the other.

So because of that, the way to set it up reliably is to either set up events which is a bit complicated, or turn off one issuer (which somewhat downgrades reliability due to no longer having an issuer to fall back to).

1 Like