Dovecot 无法接收外部邮件,AddressValueError

Dovecot 无法接收外部邮件,AddressValueError

更新后

dovecot-1:2.2.10-7.el7.x86_641:2.2.10-8.el7.x86_64
dovecot-mysql-1:2.2.10-7.el7.x86_641:2.2.10-8.el7.x86_64
鸽舍-鸽洞-1:2.2.10-7.el7.x86_641:2.2.10-8.el7.x86_64

我无法接收来自外部邮件地址的电子邮件。发送邮件和接收来自本地邮件地址的邮件都正常。在 /var/log/maillog 中,我收到以下错误:

Oct 30 15:11:21 hostname postfix/smtpd[28227]: connect from sonic304-22.consmr.mail.ir2.yahoo.com[77.238.179.147]
Oct 30 15:11:21 hostname postfix/smtpd[28227]: Anonymous TLS connection established from sonic304-22.consmr.mail.ir2.yahoo.com[77.238.179.147]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Oct 30 15:11:21 hostname policyd-spf[28530]: Traceback (most recent call last):
Oct 30 15:11:21 hostname policyd-spf[28530]:  File "/usr/libexec/postfix/policyd-spf", line 707, in <module>
Oct 30 15:11:21 hostname policyd-spf[28530]:    instance_dict, configData, peruser)
Oct 30 15:11:21 hostname policyd-spf[28530]:  File "/usr/libexec/postfix/policyd-spf", line 419, in _spfcheck
Oct 30 15:11:21 hostname policyd-spf[28530]:    res = spf.check2(ip, helo_fake_sender, helo, querytime=configData.get('Lookup_Time'))
Oct 30 15:11:21 hostname policyd-spf[28530]:  File "/usr/lib/python2.7/site-packages/spf.py", line 297, in check2
Oct 30 15:11:21 hostname policyd-spf[28530]:    receiver=receiver,timeout=timeout,verbose=verbose,querytime=querytime).check()
Oct 30 15:11:21 hostname policyd-spf[28530]:  File "/usr/lib/python2.7/site-packages/spf.py", line 378, in __init__
Oct 30 15:11:21 hostname policyd-spf[28530]:    self.set_ip(i)
Oct 30 15:11:21 hostname policyd-spf[28530]:  File "/usr/lib/python2.7/site-packages/spf.py", line 405, in set_ip
Oct 30 15:11:21 hostname policyd-spf[28530]:    self.ipaddr = ipaddress.ip_address(i)
Oct 30 15:11:21 hostname policyd-spf[28530]:  File "/usr/lib/python2.7/site-packages/ipaddress.py", line 163, in ip_address
Oct 30 15:11:21 hostname policyd-spf[28530]:    ' a unicode object?' % address)
Oct 30 15:11:21 hostname policyd-spf[28530]: AddressValueError: '77.238.179.147' does not appear to be an IPv4 or IPv6 address. Did you pass in a bytes (str in Python 2) instead of a unicode object?
Oct 30 15:11:21 hostname postfix/spawn[28087]: warning: command /usr/libexec/postfix/policyd-spf exit status 1
Oct 30 15:11:21 hostname postfix/smtpd[28227]: warning: premature end-of-input on private/policy-spf while reading input attribute name

知道错误的原因是什么吗?

答案1

我已经修复了我的问题。如评论所述,相应的 Bug 报告是https://bugs.centos.org/view.php?id=12393

修复程序评论Yohei TOMIYAMA 的作品对我有用。

在修复之前,请确保它是同一个错误。软件包的以下版本必须匹配:

yum list installed | grep pypolicyd-spf
pypolicyd-spf.noarch   1.3.2-2.el7   @epel

yum list installed | grep python-ipaddress
python-ipaddress.noarch   1.0.16-2.el7  @base

python-ipaddress 软件包可能仅由 pypolicyd-spf 需要,否则此修复将破坏其他任何内容。您可以使用以下方法检查

rpm -q --whatrequires python-ipaddress
pypolicyd-spf-1.3.2-2.el7.noarch

现在修复:

rpm -e --nodeps python-ipaddress
vim /usr/libexec/postfix/policyd-spf

在第 40 行将该行修改如下:

- import ipaddress
+ import ipaddr as ipaddress

就是这样。根据邮件提供商的配置,他们会间歇性地重试发送邮件。大约一小时后,大多数丢失的邮件应该会收到。

如上所述,感谢 Yohei TOMIYAMA 提供此修复。

相关内容