summaryrefslogtreecommitdiff
path: root/public/once/opendkim
blob: fb088c86f65a35b66d0ff979830cad5e17ef2ab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

set -eu

smtphost="$1"

if [ -f /etc/dkimkeys/mail.private ]; then
	printf '%s: %s %s\n' "$0"                 \
	"dkim key file /etc/dkimkeys/mail.private" \
	"already exists! Aborting..." >&2
	exit 2
fi

opendkim-genkey -r -S -v -b 2048 -D /etc/dkimkeys -d $smtphost -s mail
chown -R opendkim:opendkim /srv/etc/dkimkeys

mkdir -p -m o-rwx          /var/spool/postfix/opendkim
chown -R opendkim:opendkim /var/spool/postfix/opendkim

usermod --group opendkim --append postfix