-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for #39 - Make sure private keys are readable by OpenDKIM
Private keys generated with `DKIM_AUTOGENERATE` were created with the root account and as such were not readable by OpenDKIM. This fix will reown the created files to the `opendkim` user.
- Loading branch information
Showing
4 changed files
with
55 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
ARG ALPINE_VERSION=latest | ||
FROM alpine:${ALPINE_VERSION} | ||
LABEL maintaner="Bojan Cekrlic - https://github.com/bokysan/docker-postfix/" | ||
|
||
FROM alpine:latest | ||
RUN true && \ | ||
apk add --no-cache --upgrade cyrus-sasl cyrus-sasl-plain cyrus-sasl-login && \ | ||
apk add --no-cache postfix && \ | ||
apk add --no-cache opendkim && \ | ||
apk add --no-cache --upgrade ca-certificates tzdata supervisor rsyslog musl musl-utils bash opendkim-utils && \ | ||
(rm "/tmp/"* 2>/dev/null || true) && (rm -rf /var/cache/apk/* 2>/dev/null || true) | ||
RUN apk add --no-cache bash bats && \ | ||
(rm "/tmp/"* 2>/dev/null || true) && (rm -rf /var/cache/apk/* 2>/dev/null || true) | ||
|
||
RUN true && \ | ||
apk add --no-cache bash bats && \ | ||
apk add --no-cache --upgrade cyrus-sasl cyrus-sasl-plain cyrus-sasl-login && \ | ||
apk add --no-cache postfix && \ | ||
apk add --no-cache opendkim && \ | ||
(rm "/tmp/"* 2>/dev/null || true) && (rm -rf /var/cache/apk/* 2>/dev/null || true) | ||
|
||
WORKDIR /code | ||
WORKDIR /code | ||
ENTRYPOINT ["/usr/bin/bats"] | ||
|
||
CMD ["-v"] | ||
CMD ["-v"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bats | ||
|
||
load /code/scripts/common.sh | ||
load /code/scripts/common-run.sh | ||
|
||
mkdir -p /etc/opendkim | ||
cp /code/configs/opendkim.conf /etc/opendkim/opendkim.conf | ||
chown -R opendkim:opendkim /etc/opendkim | ||
|
||
@test "check if private keys are readable by OpenDKIM" { | ||
# Sanity check | ||
su opendkim -s /bin/bash -c 'echo "Hello world"' > /dev/null | ||
|
||
local DKIM_AUTOGENERATE=1 | ||
local ALLOWED_SENDER_DOMAINS=example.org | ||
postfix_setup_dkim | ||
|
||
su opendkim -s /bin/bash -c 'cat /etc/opendkim/keys/example.org.private' > /dev/null | ||
su opendkim -s /bin/bash -c 'cat /etc/opendkim/keys/example.org.txt' > /dev/null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters