home
·
contact
·
privacy
projects
/
config
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
258962e
)
Improve opendkim setup script.
author
Christian Heller
<c.heller@plomlompom.de>
Fri, 9 Oct 2015 12:37:07 +0000
(14:37 +0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Fri, 9 Oct 2015 12:37:07 +0000
(14:37 +0200)
setup_opendkim.sh
patch
|
blob
|
history
diff --git
a/setup_opendkim.sh
b/setup_opendkim.sh
index cee5ce805a653cdc0dca2e2bd110506620cf1774..a8b5402176c676169cc1db875c04494ef9d8d7a8 100755
(executable)
--- a/
setup_opendkim.sh
+++ b/
setup_opendkim.sh
@@
-9,37
+9,37
@@
if [ ! "$(id -u)" -eq "0" ]; then
exit
fi
exit
fi
-apt-get -y install opendkim opendkim-tools
-cp ~/config/systemfiles/opendkim.conf /etc/opendkim.conf
+apt-get -y install opendkim
-if [ -f /etc/opendkim/dkim.key ]; then
- cp /etc/opendkim/dkim.key /etc/opendkim/dkim.key~
-fi
-
-sed -r -i 's/^#Selector .*$/Selector '$selector'/' /etc/opendkim.conf
-
-mkdir -p /etc/opendkim
if [ -n $file ] || [ ! -f $file ]; then
if [ -n $file ] || [ ! -f $file ]; then
+ apt-get -y install opendkim-tools
opendkim-genkey -d plomlompom.com -s $selector
opendkim-genkey -d plomlompom.com -s $selector
- mv "$selector".private /etc/opendkim/dkim.key
+ apt-get --purge autoremove opendkim-tools
+ set +x
+ echo
+ echo 'Generated key file at '$selector'.private.'
+ echo 'APPLY the content of '$selector'.txt below to your DNS record.'
+ echo 'AFTER the waiting time for DNS propagation RERUN this script with' \
+ 'the key file as SECOND parameter (still use selector as first one).'
+ echo
+ cat $selector.txt
else
else
+ cp ~/config/systemfiles/opendkim.conf /etc/opendkim.conf
+ sed -r -i 's/^#Selector .*$/Selector '$selector'/' /etc/opendkim.conf
+ mkdir -p /etc/opendkim
+ if [ -f /etc/opendkim/dkim.key ]; then
+ cp /etc/opendkim/dkim.key /etc/opendkim/dkim.key~
+ fi
cp $file /etc/opendkim/dkim.key
cp $file /etc/opendkim/dkim.key
-fi
-
-cp ~/config/systemfiles/main.cf /etc/postfix/main.cf
-cat >> /etc/postfix/main.cf << EOF
+ cp ~/config/systemfiles/main.cf /etc/postfix/main.cf
+ cat >> /etc/postfix/main.cf << EOF
# Use opendkim at given port as mail filter.
non_smtpd_milters = inet:localhost:12301
# Use opendkim at given port as mail filter.
non_smtpd_milters = inet:localhost:12301
-smtpd_milters = inet:localhost:12301
EOF
EOF
-service postfix restart
-service opendkim restart
-
-echo 'TAKE NOTE:'
-if [ -f $selector.txt ]; then
- echo 'Apply the content of '$selector'.txt to your DNS record!'
- cat $selector.txt
-else
- echo 'Make sure the DKIM TXT entry in your DNS record matches!'
+ service opendkim restart
+ service postfix restart
+ set +x
+ echo
+ echo 'Ensure the DKIM TXT entry in your DNS record matches!'
fi
fi