postfix 与 opendkim 的连接被拒绝

postfix 与 opendkim 的连接被拒绝

我正在尝试从我的 ubuntu (17.04) 服务器向 gmail、hotmail 发送邮件,但邮件被发送到垃圾邮件文件夹。我检查了 /var/log/mail.log,发现那里有关于 opendkim 的警告:

7 月 25 日 15:12:31 francooro postfix/cleanup[21233]: 警告:连接到 Milter 服务 inet:localhost:12301:连接被拒绝

我试图禁用 chroot 检查,我的防火墙已禁用,opendkim 服务已启动,但它似乎没有监听任何端口,因此我尝试添加另一个端口,但两个端口的连接都被拒绝。

我的配置是:

/etc/postfix/main.cf

    # See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file=/etc/letsencrypt/live/mail.x-pole-israel.org/cert.pem
smtpd_tls_CAfile=/etc/letsencrypt/live/mail.x-pole-israel.org/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/mail.x-pole-israel.org/privkey.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = x-pole-israel.org
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, x-pole-israel.org, francooro, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all


smtp_tls_security_level = may
smtpd_tls_security_level = may
milter_protocol = 6
milter_default_action = accept
#smtpd_milters = unix:/spamass/spamass.sock, inet:localhost:12301
#non_smtpd_milters = unix:/spamass/spamass.sock, inet:localhost:12301
smtpd_milters = inet:localhost:12301
non_smtpd_milters = $smtpd_milters

/etc/opendkim.conf

TrustAnchorFile       /usr/share/dns/root.key

AutoRestart             Yes
AutoRestartRate         10/1h
UMask                   0002
Syslog                  yes
SyslogSuccess           Yes
LogWhy                  Yes

Canonicalization        relaxed/simple

ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts
InternalHosts           refile:/etc/opendkim/TrustedHosts
KeyTable                refile:/etc/opendkim/KeyTable
SigningTable            refile:/etc/opendkim/SigningTable

Mode                    sv
PidFile                 /var/run/opendkim/opendkim.pid
SignatureAlgorithm      rsa-sha256

UserID                  opendkim:opendkim

Socket                  inet:12301@localhost

/etc/默认/opendkim

SOCKET="inet:12301@localhost"

我的 chroot 现在是打开的,但我尝试禁用它,但没有帮助

我对密钥的权限如下:

drwxr-xr-x 2 root     root     4096 Jul 24 15:59 ./
drwxr-xr-x 3 root     root     4096 Jul 24 15:09 ../
-rw------- 1 opendkim opendkim 1679 Jul 24 15:09 mail.private
-rw------- 1 root     root      507 Jul 24 15:09 mail.txt

sudo netstat -ltnp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1443/sshd           
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      21779/master        
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      5904/mysqld         
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      1371/systemd-resolv 
tcp6       0      0 :::22                   :::*                    LISTEN      1443/sshd           
tcp6       0      0 :::25                   :::*                    LISTEN      21779/master        
tcp6       0      0 :::443                  :::*                    LISTEN      14402/apache2       
tcp6       0      0 :::5355                 :::*                    LISTEN      1371/systemd-resolv 
tcp6       0      0 :::80                   :::*                    LISTEN      14402/apache2

答案1

我在您的 /etc/opendkim.conf 中找不到三件事,例如:

Domain   example.com
KeyFile  /etc/opendkim/keys/example.com/dkim.private
Selector dkim 

否则看起来与我的运行设置非常相似。

相关内容