Skip to content

Commit

Permalink
OpenDKIM keys have been moved to the keys folder
Browse files Browse the repository at this point in the history
This is to make it easier to integrate with Kubernetes to be able
to bind a `ConfigMap` to the said folder.
  • Loading branch information
bokysan committed Feb 19, 2019
1 parent afccfdb commit 38d7627
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions README.md
Expand Up @@ -145,16 +145,13 @@ You'll need to create a folder for every domain you want to send through Postfi

```
mkdir -p /host/keys; cd /host/keys
mkdir example.com; cd example.com
opendkim-genkey -s mail -d example.com
cd ..
mkdir example.org; cd example.org
opendkim-genkey -s mail -d example.org
opendkim-genkey -b 2048 -h rsa-sha256 -r -v -s example.com -d example.com
opendkim-genkey -b 2048 -h rsa-sha256 -r -v -s example.org -d example.org
```

`opendkim-genkey` is usually in your favourite distribution provided by installing `opendkim-tools` or `opendkim-utils`.

Add the created `mail.txt` files to your DNS record. Afterwards, just mount `/etc/opendkim/keys` into your image and DKIM
Add the created `<domain>.txt` files to your DNS records. Afterwards, just mount `/etc/opendkim/keys` into your image and DKIM
will be used automatically, e.g.:
```
docker run --rm --name postfix -e "ALLOWED_SENDER_DOMAINS=example.com example.org" -v /host/keys:/etc/opendkim/keys -p 1587:587 boky/postfix
Expand Down
2 changes: 1 addition & 1 deletion opendkim.sh
@@ -1,7 +1,7 @@
#!/bin/sh
if [ ! -d /etc/opendkim/keys ]; then
sleep 9999999999999999999
elif [ -z "$(find /etc/opendkim/keys -type d ! -name .)" ]; then
elif [ -z "$(find /etc/opendkim/keys -type f ! -name .)" ]; then
sleep 9999999999999999999
else
/usr/sbin/opendkim -D -f -x /etc/opendkim/opendkim.conf
Expand Down
4 changes: 2 additions & 2 deletions run.sh
Expand Up @@ -201,7 +201,7 @@ if [ ! -z "$MASQUERADED_DOMAINS" ]; then
fi

DKIM_ENABLED=
if [ -d /etc/opendkim/keys ] && [ ! -z "$(find /etc/opendkim/keys -type d ! -name .)" ]; then
if [ -d /etc/opendkim/keys ] && [ ! -z "$(find /etc/opendkim/keys -type f ! -name .)" ]; then
DKIM_ENABLED=", ${emphasis}opendkim${reset}"
echo -e "$notice Configuring OpenDKIM."
mkdir -p /var/run/opendkim
Expand All @@ -227,7 +227,7 @@ if [ -d /etc/opendkim/keys ] && [ ! -z "$(find /etc/opendkim/keys -type d ! -nam
echo "" >> /etc/opendkim/TrustedHosts
if [ ! -z "$ALLOWED_SENDER_DOMAINS" ]; then
for i in $ALLOWED_SENDER_DOMAINS; do
private_key=/etc/opendkim/keys/$i/mail.private
private_key=/etc/opendkim/keys/$i.private
if [ -f $private_key ]; then
echo -e " ...for domain ${emphasis}$i${reset}"
echo "*.$i" >> /etc/opendkim/TrustedHosts
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 38d7627

Please sign in to comment.