-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathopendkim.sh
44 lines (31 loc) · 1.09 KB
/
opendkim.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
dnf install -y opendkim
cp /etc/opendkim.conf{,.original}
cp /etc/opendkim/KeyTable{,.original}
cp /etc/opendkim/SigningTable{,.original}
cp /etc/opendkim/TrustedHosts{,.original}
#sed -i "39s/v/sv/" /etc/opendkim.conf
sed -i "39s/Mode\t v/Mode\tsv/" /etc/opendkim.conf
sed -i '103s/# KeyTable/KeyTable/' /etc/opendkim.conf
sed -i '108s/# SigningTable/SigningTable/' /etc/opendkim.conf
sed -i '115s/# InternalHosts/InternalHosts/' /etc/opendkim.conf
systemctl enable opendkim
#cp /etc/opendkim.conf{,.original}
mkdir /etc/opendkim/keys/example.com
opendkim-genkey -D /etc/opendkim/keys/example.com/ -d example.com -s default
#/etc/opendkim/keys/example.com/default.private
cat /etc/opendkim/KeyTable
cat >> /etc/opendkim/SigningTable <<EOF
*@example.com default._domainkey.example.com
EOF
cat >> TrustedHosts <<EOF
# your all of server ip address.
EOF
systemctl start opendkim
cat >> /etc/postfix/main.cf <<'EOF'
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_protocol = 2
milter_default_action = accept
EOF
systemctl restart postfix