docker-postfix/unit-tests/dkim_auto_generate.bats
Bojan Čekrlić 51173d36e0 Fix for #38
The postfix configuration was a bit too permissive with `mynetworks`.

This commit:
- adds `reject` at the end of `*restrictions` list
- adds tests for this feature
2020-10-24 21:24:18 +02:00

23 lines
644 B
Bash

#!/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
postfix check
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
}