Current File : //root/panel/modules/authentication/code/dkim.sh |
#!/bin/sh
domain="$1"
yum install opendkim
echo "AutoRestart Yes" >> /etc/opendkim.conf
echo "AutoRestartRate 10/1h" >> /etc/opendkim.conf
echo "UMask 002" >> /etc/opendkim.conf
echo "Syslog yes" >> /etc/opendkim.conf
echo "SyslogSuccess Yes" >> /etc/opendkim.conf
echo "LogWhy Yes" >> /etc/opendkim.conf
echo "Canonicalization relaxed/simple" >> /etc/opendkim.conf
echo "ExternalIgnoreList refile:/etc/opendkim/TrustedHosts" >> /etc/opendkim.conf
echo "InternalHosts refile:/etc/opendkim/TrustedHosts" >> /etc/opendkim.conf
echo "KeyTable refile:/etc/opendkim/KeyTable" >> /etc/opendkim.conf
echo "SigningTable refile:/etc/opendkim/SigningTable" >> /etc/opendkim.conf
echo "Mode sv" >> /etc/opendkim.conf
echo "PidFile /var/run/opendkim/opendkim.pid" >> /etc/opendkim.conf
echo "SignatureAlgorithm rsa-sha256" >> /etc/opendkim.conf
echo "UserID opendkim:opendkim" >> /etc/opendkim.conf
echo "Socket inet:12301@localhost" >> /etc/opendkim.conf
echo "milter_protocol = 2" >> /etc/postfix/main.cf
echo "milter_default_action = accept" >> /etc/postfix/main.cf
echo "smtpd_milters = inet:localhost:12301" >> /etc/postfix/main.cf
echo "non_smtpd_milters = inet:localhost:12301" >> /etc/postfix/main.cf
if [-n "$domain"]; then
if [ -n "$domain" ]; then
echo "Domain argument is not empty"
mkdir /etc/opendkim/keys/$domain
opendkim-genkey -D /etc/opendkim/keys/$domain/ -d $domain -s default
chown -R opendkim: /etc/opendkim/keys/$domain
mv /etc/opendkim/keys/$domain/default.private /etc/opendkim/keys/$domain/default
echo "default._domainkey.$domain $domain:default:/etc/opendkim/keys/$domain/default" >> /etc/opendkim/KeyTable
echo "*@$domain default._domainkey.$domain" >> /etc/opendkim/SigningTable
service opendkim restart
cat /etc/opendkim/keys/$domain/default.txt
echo "\n"
echo "Please add Above Dkim record to backend in DNS Management"
else
echo "Domain Argument is Empty"
fi
service postfix restart
service opendkim restart
service named restart