summaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2024-07-09 15:53:34 -0400
committerMalfurious <m@lfurio.us>2024-07-09 15:53:34 -0400
commitc8b6d74765064d6205f4d03b2051ee37b8943434 (patch)
tree9a673efd6e5d9cea95d40c98d5ff33eaba628731 /Dockerfile
parent02da95230612c5ae7a31587b31eca7a8c9a05ce0 (diff)
parent5d6a5e19976923daccf0464f797b44b6266e6941 (diff)
downloadmailnode-c8b6d74765064d6205f4d03b2051ee37b8943434.tar.gz
mailnode-c8b6d74765064d6205f4d03b2051ee37b8943434.zip
Merge branch 'dkim'
Install and configure OpenDKIM according to the instructions found in the OpenDKIM readme: http://www.opendkim.org/opendkim-README * dkim: opendkim: Start milter service opendkim: Disable syslog opendkim: Configure postfix milter socket opendkim: Generate keys / TXT record opendkim: Configure signing parameters opendkim: Add default config file opendkim: Setup package and data volume
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile24
1 files changed, 23 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
index f79830a..aa7c1ca 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,6 +25,14 @@ RUN useradd \
--skel /dev/null --create-home \
mlmmj
+RUN useradd \
+ --uid 2003 \
+ --shell /usr/sbin/nologin \
+ --home-dir /run/opendkim \
+ opendkim
+
+RUN usermod -aG opendkim postfix
+
# Install packages
RUN apt update \
&& apt full-upgrade --yes \
@@ -32,17 +40,31 @@ RUN apt update \
dovecot-core \
dovecot-imapd \
mlmmj \
+ opendkim \
postfix \
postfix-pcre \
sudo \
&& apt clean
+# Generate OpenDKIM keypair
+# Do this here so we can print the pubkey/dns record to logs during build
+# process. After initial run, a volume should preserve the keys for later
+# runs.
+RUN mkdir -p /opendkim \
+ && chown opendkim:opendkim /opendkim \
+ && opendkim-genkey \
+ --bits=1024 \
+ --directory=/opendkim \
+ --selector=default \
+ && cat /opendkim/default.txt
+
# Install files
COPY dovecot /etc/dovecot/
+COPY opendkim /etc/
COPY postfix /etc/postfix/
COPY userconfig /etc/userconfig/
-RUN find /etc/dovecot /etc/postfix -type f | xargs sed -i \
+RUN find /etc/dovecot /etc/opendkim.conf /etc/postfix -type f | xargs sed -i \
"s/ENV_HOSTNAME/${HOSTNAME}/g; s/ENV_VIRTUAL_DOMAINS/${VIRTUAL_DOMAINS}/g"
EXPOSE 25