devture / exim-relay

🐳 A lightweight non-root Docker image for an Exim mail relay, based on Alpine Linux.
Apache License 2.0
39 stars 34 forks source link

Is it possible to configure DKIM? #1

Closed korggy closed 7 months ago

w-vi commented 2 years ago

Yes, you can mount your own exim.conf file in the container like so:

docker run  \
                 ..... \
                 --mount type=bind,src=/path/to/exim.conf,dst=/etc/exim/exim.conf,ro \
                 --mount type=bind,src=/path/to/dkim key/dkim_private.pem,dst=/etc/exim/dkim_private.pem,ro \
                  docker.io/devture/exim-relay

and in your exim.conf file you need to setup the following section as described:

remote_smtp:
  driver = smtp
  message_size_limit = ${if > {$max_received_linelength}{998} {1}{0}}
  # Set to '*' (auth for all smarthosts)  if the SMTP_PASSWORD secret file or env variable exists, otherwise set to '' (no auth)
  hosts_require_auth = ${if or{ {exists{/run/secrets/SMTP_PASSWORD}} {!eq{${env{SMTP_PASSWORD}{$value}{}}}{}} } {*} {}}
  headers_remove = received
  helo_data = ${env{HOSTNAME}{$value}{$primary_hostname}}
  dkim_domain = "<YOUR DKIM DOMAIN>"
  dkim_selector = "<YOUR DKIM SELECTOR>"
  dkim_private_key = "/etc/exim/dkim_private.pem"
  dkim_canon = relaxed
vecernik87 commented 1 year ago

Although late, I just want to confirm that the mount of exim.conf worked for me. (I needed it for something else, but this issue pointed me in the right direction) Keep in mind the file needs correct permissions otherwise it will end up with error "exim.conf has the wrong owner, group, or mode". Fixed with:

sudo chown root:root exim.conf
sudo chmod 664 exim.conf