chore: Housekeeping on the 'open-dkim' script (#2267)

This commit is contained in:
Brennan Kinney 2021-10-30 23:10:32 +13:00 committed by GitHub
parent ed562a7057
commit d9e8accf5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 12 deletions

View file

@ -4,8 +4,6 @@ NAME ?= mailserver-testing:ci
VCS_REF = $(shell git rev-parse --short HEAD) VCS_REF = $(shell git rev-parse --short HEAD)
VCS_VER = $(shell git describe --tags --contains --always) VCS_VER = $(shell git describe --tags --contains --always)
export CDIR = $(shell pwd)
# ----------------------------------------------- # -----------------------------------------------
# --- Generic Build Targets --------------------- # --- Generic Build Targets ---------------------
# ----------------------------------------------- # -----------------------------------------------

View file

@ -139,24 +139,24 @@ then
exit 0 exit 0
fi fi
while read -r DOMAINNAME while read -r DKIM_DOMAIN
do do
mkdir -p "/tmp/docker-mailserver/opendkim/keys/${DOMAINNAME}" mkdir -p "/tmp/docker-mailserver/opendkim/keys/${DKIM_DOMAIN}"
if [[ ! -f "/tmp/docker-mailserver/opendkim/keys/${DOMAINNAME}/${SELECTOR}.private" ]] if [[ ! -f "/tmp/docker-mailserver/opendkim/keys/${DKIM_DOMAIN}/${SELECTOR}.private" ]]
then then
echo "Creating DKIM private key /tmp/docker-mailserver/opendkim/keys/${DOMAINNAME}/${SELECTOR}.private" echo "Creating DKIM private key /tmp/docker-mailserver/opendkim/keys/${DKIM_DOMAIN}/${SELECTOR}.private"
opendkim-genkey \ opendkim-genkey \
--bits="${KEYSIZE}" \ --bits="${KEYSIZE}" \
--subdomains \ --subdomains \
--DOMAIN="${DOMAINNAME}" \ --domain="${DKIM_DOMAIN}" \
--selector="${SELECTOR}" \ --selector="${SELECTOR}" \
-D "/tmp/docker-mailserver/opendkim/keys/${DOMAINNAME}" --directory="/tmp/docker-mailserver/opendkim/keys/${DKIM_DOMAIN}"
fi fi
# write to KeyTable if necessary # write to KeyTable if necessary
KEYTABLEENTRY="${SELECTOR}._domainkey.${DOMAINNAME} ${DOMAINNAME}:${SELECTOR}:/etc/opendkim/keys/${DOMAINNAME}/${SELECTOR}.private" KEYTABLEENTRY="${SELECTOR}._domainkey.${DKIM_DOMAIN} ${DKIM_DOMAIN}:${SELECTOR}:/etc/opendkim/keys/${DKIM_DOMAIN}/${SELECTOR}.private"
if [[ ! -f "/tmp/docker-mailserver/opendkim/KeyTable" ]] if [[ ! -f "/tmp/docker-mailserver/opendkim/KeyTable" ]]
then then
echo "Creating DKIM KeyTable" echo "Creating DKIM KeyTable"
@ -169,11 +169,11 @@ do
fi fi
# write to SigningTable if necessary # write to SigningTable if necessary
SIGNINGTABLEENTRY="*@${DOMAINNAME} ${SELECTOR}._domainkey.${DOMAINNAME}" SIGNINGTABLEENTRY="*@${DKIM_DOMAIN} ${SELECTOR}._domainkey.${DKIM_DOMAIN}"
if [[ ! -f /tmp/docker-mailserver/opendkim/SigningTable ]] if [[ ! -f /tmp/docker-mailserver/opendkim/SigningTable ]]
then then
echo "Creating DKIM SigningTable" echo "Creating DKIM SigningTable"
echo "*@${DOMAINNAME} ${SELECTOR}._domainkey.${DOMAINNAME}" >/tmp/docker-mailserver/opendkim/SigningTable echo "*@${DKIM_DOMAIN} ${SELECTOR}._domainkey.${DKIM_DOMAIN}" >/tmp/docker-mailserver/opendkim/SigningTable
else else
if ! grep -q "${SIGNINGTABLEENTRY}" /tmp/docker-mailserver/opendkim/SigningTable if ! grep -q "${SIGNINGTABLEENTRY}" /tmp/docker-mailserver/opendkim/SigningTable
then then

View file

@ -21,7 +21,7 @@ function setup_file
--name "${CONTAINER_NAME}" \ --name "${CONTAINER_NAME}" \
--cap-add=SYS_PTRACE \ --cap-add=SYS_PTRACE \
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \ -v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
-v "${CDIR}/test/test-files":/tmp/docker-mailserver-test:ro \ -v "${PWD}/test/test-files":/tmp/docker-mailserver-test:ro \
-e DEFAULT_RELAY_HOST=default.relay.host.invalid:25 \ -e DEFAULT_RELAY_HOST=default.relay.host.invalid:25 \
-e PERMIT_DOCKER=host \ -e PERMIT_DOCKER=host \
-e DMS_DEBUG=0 \ -e DMS_DEBUG=0 \