User Tools

Site Tools


postfix_spf_dkim

This is an old revision of the document!


yum install -y postfix
vi /etc/postfix/main.cf

   myhostname = mx.domain.ru
   mydomain = domain.ru
   myorigin = domain.ru
   inet_interfaces = all
   inet_protocols = ipv4
   always_add_missing_headers = yes
   smtpd_milters = inet:localhost:10021
   non_smtpd_milters = inet:localhost:10021

yum install -y opendkim
vi /etc/opendkim.conf

   AlwaysAddARHeader       Yes
   SubDomains              Yes     
   RemoveARAll             Yes
   RemoveOldSignatures     Yes
   SendReports             Yes
   Canonicalization        relaxed/relaxed
   Mode                    sv
   UserID                  opendkim:opendkim
   Syslog                  Yes
   SyslogSuccess           Yes
   LogWhy                  Yes
   KeyTable                /etc/opendkim/KeyTable
   SigningTable            refile:/etc/opendkim/SigningTable
   PidFile                 /run/opendkim/opendkim.pid
   Socket                  inet:10021@localhost
   ReportAddress           "DKIM Error Postmaster" <postmaster@domain.ru>

opendkim-genkey -D /etc/opendkim –domain=domain.ru –selector=key1 chown opendkim:opendkim /etc/opendkim/*.private
chmod 600 /etc/opendkim/*.private
vi /etc/opendkim/KeyTable

   key1 domain.ru:key1:/etc/opendkim/key1.private

vi /etc/opendkim/SigningTable

   @domain.ru key1

systemctl restart opendkim postfix && systemctl status opendkim postfix echo $(cat /etc/opendkim/key1.txt) | sed 's/“ ”g;s/[\(\)]g;s/ *; –.*'
Идём в панель управления DNS и добавляем TXT-запись key1._domainkey со значением, которое указано в кавычках (кавычки вносить не нужно)
host -t txt key1._domainkey.domain.ru Идём в панель управления DNS и добавляем TXT-запись key1._domainkey со значением “v=spf1 a:domain.ru -all” (доверять почте с сервера domain.ru и не доверять остальным)
host -t txt domain.ru 8.8.8.8
netstat -lp4n | grep -E '(:25|:10021)'
echo “This is a test message” | mail -a “From: test@domain.ru” -s test addr@gmail.com

postfix_spf_dkim.1721548508.txt.gz · Last modified: 2024/07/21 07:55 by ryas