postfix email working with dkim

This commit is contained in:
2019-04-19 15:32:49 +02:00
parent a8bc55e175
commit afe55b0d1f
2 changed files with 64 additions and 34 deletions
+21
View File
@@ -0,0 +1,21 @@
Socket local:/run/opendkim/opendkim.sock
Syslog yes
UMask 002
UserID postfix:postfix
Selector mail
Mode sv
SubDomains yes
AutoRestart yes
Background yes
Canonicalization relaxed/relaxed
DNSTimeout 5
SignatureAlgorithm rsa-sha256
X-Header yes
Logwhy yes
InternalHosts /etc/internalhosts
KeyTable /etc/opendkim/keytable
SigningTable refile:/etc/opendkim/signtable
OversignHeaders From
+43 -34
View File
@@ -22,10 +22,9 @@ if [ ! -d "$_assets" ]; then
fi fi
fi fi
# http://www.sycha.com/lamp-setup-debian-linux-apache-mysql-php#anchor13
sleep 2 sleep 2
apk add mailx postfix apk add postfix mailx
mkdir /var/mail mkdir /var/mail
postmap /etc/postfix/aliases postmap /etc/postfix/aliases
@@ -33,38 +32,48 @@ postmap /etc/postfix/aliases
rc-update add postfix rc-update add postfix
/etc/init.d/postfix start /etc/init.d/postfix start
# https://www.cyberciti.biz/faq/how-to-find-out-the-ip-address-assigned-to-eth0-and-display-ip-only/
_IP=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
_MASK=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f4)
# echo -n "Please provide a bounce email address: "
# read _bounce_email
# DMARC
# dkim spf # reverse dns
# echo "\033[35;1mConfiguring DKIM \033[0m"
# while [ "$installdkim" != "y" ] && [ "$installdkim" != "n" ] # dkim
# do echo "Configuring DKIM"
# echo -n "Should we install dkim for exim4 ? [y|n] "
# read installdkim apk add opendkim opendkim-utils
# done
# if [ "$installdkim" = "y" ]; then mkdir /etc/opendkim/keys
# echo -n "Choose a domain for dkim (same domain as you chose before for exim4): " opendkim-genkey -b 2048 -d "$HOSTNAME" -s "$HOSTNAME".dkim --directory=/etc/opendkim/keys/
# read domain
# selector=$(date +%Y%m%d) chown opendkim:opendkim /etc/opendkim/keys/*
#
# mkdir /etc/exim4/dkim mv /etc/opendkim/opendkim.conf /etc/opendkim/opendkim.conf.back
# openssl genrsa -out /etc/exim4/dkim/"$domain"-private.pem 1024 -outform PEM cp "$_assets"/opendkim/opendkim.conf /etc/opendkim.conf
# openssl rsa -in /etc/exim4/dkim/"$domain"-private.pem -out /etc/exim4/dkim/"$domain".pem -pubout -outform PEM
# chown root:Debian-exim /etc/exim4/dkim/"$domain"-private.pem echo "*@$HOSTNAME $HOSTNAME" > /etc/opendkim/signtable
# chmod 440 /etc/exim4/dkim/"$domain"-private.pem echo "$HOSTNAME $HOSTNAME:mail:/etc/opendkim/keys/$HOSTNAME.dkim.private" > /etc/opendkim/keytable
# echo -e "localhost\n127.0.0.1\n$HOSTNAME\n$_IP/$_MASK" > /etc/internalhosts
# cp "$_assets"/exim4_dkim.conf /etc/exim4/conf.d/main/00_local_macros echo -e "smtpd_milters = unix:/run/opendkim/opendkim.sock\nnon_smtpd_milters = unix:/run/opendkim/opendkim.sock" >> /etc/postfix/main.cf
# sed -i -r "s/DOMAIN_TO_CHANGE/$domain/g" /etc/exim4/conf.d/main/00_local_macros
# sed -i -r "s/DATE_TO_CHANGE/$selector/g" /etc/exim4/conf.d/main/00_local_macros rc-update add opendkim
# service opendkim start
# update-exim4.conf service postfix restart
# systemctl restart exim4 echo "please create a DKIM entry in your dns zone : mail._domainkey.$HOSTNAME \n"
# echo "please create a TXT entry in your dns zone : $selector._domainkey.$domain \n" echo "your public key is : \n"
# echo "your public key is : \n" cat /etc/opendkim/keys/"$HOSTNAME".dkim.txt
# cat /etc/exim4/dkim/"$domain".pem
# echo "press any key to continue." echo -e "SPF"
# read continu echo -e "you should edit an spf entry for $HOSTNAME in your dns zone :"
# else echo -e "v=spf1 a mx ip4:$_IP"
# echo 'dkim not installed'
# fi echo -e "MX"
echo -e "If it does not exists, you should create an mx zone record for $HOSTNAME"
echo "press any key to continue."
read continu