37 lines
1.4 KiB
Bash
37 lines
1.4 KiB
Bash
#!/bin/bash
|
|
|
|
##----------------------------##
|
|
# OpenDKIM Configuration #
|
|
##----------------------------##
|
|
|
|
gpasswd -a postfix opendkim
|
|
|
|
wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/beta/config/dkim/opendkim.conf -O /etc/opendkim.conf
|
|
mkdir -p /etc/opendkim
|
|
mkdir -p /etc/opendkim/keys
|
|
chown -R opendkim:opendkim /etc/opendkim
|
|
chmod go-rw /etc/opendkim/keys
|
|
|
|
echo "*@$domonly default._domainkey.$domonly" >> /etc/opendkim/signing.table
|
|
echo "default._domainkey.$domonly $domonly:default:/etc/opendkim/keys/$domonly/default.private" >> /etc/opendkim/key.table
|
|
echo "127.0.0.1" >> /etc/opendkim/trusted.hosts
|
|
echo "localhost" >> /etc/opendkim/trusted.hosts
|
|
echo "" >> /etc/opendkim/trusted.hosts
|
|
echo "*.$domonly" >> /etc/opendkim/trusted.hosts
|
|
|
|
mkdir -p /etc/opendkim/keys/$domonly
|
|
opendkim-genkey -b $dhparam -d $domonly -D /etc/opendkim/keys/$domonly -s default -v
|
|
chown opendkim:opendkim /etc/opendkim/keys/$domonly/default.private
|
|
|
|
##---------------------------##
|
|
# Postfix Configuration #
|
|
##---------------------------##
|
|
|
|
mkdir -p /var/spool/postfix/opendkim
|
|
chown opendkim:postfix /var/spool/postfix/opendkim
|
|
|
|
echo "# Milter configuration" >> /etc/postfix/main.cf
|
|
echo "milter_default_action = accept" >> /etc/postfix/main.cf
|
|
echo "milter_protocol = 6" >> /etc/postfix/main.cf
|
|
echo "smtpd_milters = local:/opendkim/opendkim.sock" >> /etc/postfix/main.cf
|
|
echo 'non_smtpd_milters = $smtpd_milters' >> /etc/postfix/main.cf |