From d9e8accf5f33bdff49edb4ecc9c7e3cd3af81cb9 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Sat, 30 Oct 2021 23:10:32 +1300 Subject: [PATCH] chore: Housekeeping on the 'open-dkim' script (#2267) --- Makefile | 2 -- target/bin/open-dkim | 18 +++++++++--------- test/open_dkim.bats | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index f8636644..bcc61053 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,6 @@ NAME ?= mailserver-testing:ci VCS_REF = $(shell git rev-parse --short HEAD) VCS_VER = $(shell git describe --tags --contains --always) -export CDIR = $(shell pwd) - # ----------------------------------------------- # --- Generic Build Targets --------------------- # ----------------------------------------------- diff --git a/target/bin/open-dkim b/target/bin/open-dkim index caa9f893..b72e9127 100755 --- a/target/bin/open-dkim +++ b/target/bin/open-dkim @@ -139,24 +139,24 @@ then exit 0 fi -while read -r DOMAINNAME +while read -r DKIM_DOMAIN 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 - 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 \ --bits="${KEYSIZE}" \ --subdomains \ - --DOMAIN="${DOMAINNAME}" \ + --domain="${DKIM_DOMAIN}" \ --selector="${SELECTOR}" \ - -D "/tmp/docker-mailserver/opendkim/keys/${DOMAINNAME}" + --directory="/tmp/docker-mailserver/opendkim/keys/${DKIM_DOMAIN}" fi # 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" ]] then echo "Creating DKIM KeyTable" @@ -169,11 +169,11 @@ do fi # write to SigningTable if necessary - SIGNINGTABLEENTRY="*@${DOMAINNAME} ${SELECTOR}._domainkey.${DOMAINNAME}" + SIGNINGTABLEENTRY="*@${DKIM_DOMAIN} ${SELECTOR}._domainkey.${DKIM_DOMAIN}" if [[ ! -f /tmp/docker-mailserver/opendkim/SigningTable ]] then 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 if ! grep -q "${SIGNINGTABLEENTRY}" /tmp/docker-mailserver/opendkim/SigningTable then diff --git a/test/open_dkim.bats b/test/open_dkim.bats index c5e3a630..d687a8f8 100644 --- a/test/open_dkim.bats +++ b/test/open_dkim.bats @@ -21,7 +21,7 @@ function setup_file --name "${CONTAINER_NAME}" \ --cap-add=SYS_PTRACE \ -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 PERMIT_DOCKER=host \ -e DMS_DEBUG=0 \