Blame public/once/opendkim

root@culturestrings 065c23
#!/bin/sh
root@culturestrings 065c23
root@culturestrings 065c23
set -eu
root@culturestrings 065c23
root@culturestrings 065c23
smtphost="$1"
root@culturestrings 065c23
root@culturestrings 065c23
if [ -f /etc/dkimkeys/mail.private ]; then
root@culturestrings 065c23
	printf '%s: %s %s\n' "$0"                 \
root@culturestrings 065c23
	"dkim key file /etc/dkimkeys/mail.private" \
root@culturestrings 065c23
	"already exists! Aborting..." >&2
root@culturestrings 065c23
	exit 2
root@culturestrings 065c23
fi
root@culturestrings 065c23
root@culturestrings 065c23
opendkim-genkey -r -S -v -b 2048 -D /etc/dkimkeys -d $smtphost -s mail
root@culturestrings 065c23
chown -R opendkim:opendkim /srv/etc/dkimkeys
root@culturestrings 065c23
root@culturestrings 065c23
mkdir -p -m o-rwx          /var/spool/postfix/opendkim
root@culturestrings 065c23
chown -R opendkim:opendkim /var/spool/postfix/opendkim
root@culturestrings 065c23
root@culturestrings 065c23
usermod --group opendkim --append postfix