即使定义了SPF记录,也始终获得None(没有SPF记录)

时间:2019-04-05 14:31:50

标签: email dns postfix-mta spf

我正在尝试为我的域创建SPF记录,并使我的邮件服务器能够对其进行评估。我在邮件服务器上使用Postfix,并使用policyd-spf(Python)评估记录。目前,我已经在我的专用DNS服务器上为我的域发布了SPF记录,您可以使用nslookup命令在服务器上查看该记录。

我当前遇到的问题是无论我发布的SPF记录如何,policy-spf都会在电子邮件标题中返回“无(无SPF记录)” 。我正在寻找通过或失败的情况,以便我可以相应地修复记录,但目前似乎还没有对它进行评估。任何帮助将不胜感激!

我已经尝试以几种不同的格式(如下所示)为web1和mail.example.com发布(在不同的时间)几个不同的记录,但是我认为这是一个配置问题。 IP地址“ XXX.XX.XX.XXX”指向“ web1”主机,地址“ YYY.YY.YY.YY”指向“ mail.example.com”主机,即邮件服务器。

  

mail.example.com。在TXT中,“ v = spf1 include:mail.example.com -all”

     

mail.example.com。在TXT中“ v = spf2.0 / pra include:mail.example.com -all”

     

mail.example.com。在TXT中“ v = spf1一个ip4:XXX.XX.XX.XXX-全部”

     

mail.example.com。在TXT中“ v = spf2.0 / pra ip4:XXX.XX.XX.XXX -all”

     

example.com。在TXT“ v = spf1 -all”

     

mail.example.com。在TXT“ v = spf1 a include:web1 -all”

     

mail.example.com。在TXT中“ v = spf1 a ip4:YYY.YY.YY.YY -all”

这是我尝试发送电子邮件时的日志输出:

Apr  5 09:17:33 mail postfix/smtpd[9114]: connect from web1[XXX.XX.XX.XXX]
Apr  5 09:17:33 mail policyd-spf[9119]: Starting
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "request=smtpd_access_policy"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "protocol_state=RCPT"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "protocol_name=ESMTP"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "client_address=XXX.XX.XX.XXX"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "client_name=web1"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "reverse_client_name=web1"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "helo_name=web1"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "sender=noreply@mail.example.com"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "recipient=bowser@mail.example.com"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "recipient_count=0"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "queue_id="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "instance=239a.5ca7556d.9e4db.0"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "size=0"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "etrn_domain="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "stress="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "sasl_method="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "sasl_username="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "sasl_sender="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "ccert_subject="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "ccert_issuer="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "ccert_fingerprint="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "encryption_protocol="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "encryption_cipher="
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: "encryption_keysize=0"
Apr  5 09:17:33 mail policyd-spf[9119]: Read line: ""
Apr  5 09:17:33 mail policyd-spf[9119]: Found the end of entry
Apr  5 09:17:33 mail policyd-spf[9119]: Config: {'Mail_From_reject': 'Fail', 'Void_Limit': 2, 'Lookup_Time': 20, 'HELO_reject': 'Fail', 'Header_Type': 'SPF', 'defaultSeedOnly': 1, 'PermError_reject': 'False', 'debugLevel': 4, 'skip_addresses': '127.0.0.0/8,::ffff:127.0.0.0/104,::1', 'TempError_Defer': 'False'}
Apr  5 09:17:33 mail policyd-spf[9119]: Cached data for this instance: []
Apr  5 09:17:43 mail policyd-spf[9119]: spfcheck: pyspf result: "['None', '', 'helo']"
Apr  5 09:17:43 mail policyd-spf[9119]: None; identity=helo; client-ip=XXX.XX.XX.XXX; helo=web1; envelope-from=noreply@mail.example.com; receiver=bowser@mail.example.com
Apr  5 09:17:43 mail policyd-spf[9119]: Header type: SPF; Authres ID (for AR): None
Apr  5 09:17:43 mail policyd-spf[9119]: spfcheck: pyspf result: "['None', '', 'mailfrom']"
Apr  5 09:17:43 mail policyd-spf[9119]: None; identity=mailfrom; client-ip=XXX.XX.XX.XXX; helo=web1; envelope-from=noreply@mail.example.com; receiver=bowser@mail.example.com
Apr  5 09:17:43 mail policyd-spf[9119]: Header type: SPF; Authres ID (for AR): None
Apr  5 09:17:43 mail policyd-spf[9119]: Action: prepend: Text: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=XXX.XX.XX.XXX; helo=web1; envelope-from=noreply@mail.example.com; receiver=bowser@mail.example.com
Apr  5 09:17:43 mail postfix/smtpd[9114]: CBCB723ADE: client=web1[XXX.XX.XX.XXX]
Apr  5 09:17:43 mail postfix/cleanup[9133]: CBCB723ADE: message-id=<310009219.518.1554470379582@web1>
Apr  5 09:17:43 mail postfix/qmgr[9111]: CBCB723ADE: from=<noreply@mail.example.com>, size=3718, nrcpt=1 (queue active)
Apr  5 09:17:43 mail postfix/smtpd[9114]: disconnect from web1[XXX.XX.XX.XXX]
Apr  5 09:17:43 mail postfix/local[9134]: CBCB723ADE: to=<bowser@mail.example.com>, relay=local, delay=10, delays=10/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
Apr  5 09:17:43 mail postfix/qmgr[9111]: CBCB723ADE: removed

这是我的postconf -n输出:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost
mydomain = example.com
myhostname = mail.example.com
mynetworks = YYY.YY.YY.YY, 127.0.0.0/8 [::1]/128
mynetworks_style = subnet
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access
smtpd_recipient_restrictions = check_policy_service unix:private/policyd-spf,   permit_sasl_authenticated,      reject_unauth_destination,      warn_if_reject
unknown_local_recipient_reject_code = 550

这是我的policyd-spf.conf文件:

#  For a fully commented sample config file see policyd-spf.conf.commented

debugLevel = 4
defaultSeedOnly = 1

HELO_reject = Fail
Mail_From_reject = Fail

PermError_reject = False
TempError_Defer = False

skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1

1 个答案:

答案 0 :(得分:0)

  1. 我是spf的新手,但是第一行会创建一个endlessloop,因为它包括自身。

mail.example.com。在TXT中,“ v = spf1 include:mail.example.com -all”

  1. 我很好奇:

    include:web1

web1不是FQDN,但必须包含FQDN IIRC吗?

PS:会有更多人找到您的帖子,因此请发布或删除您的解决方案,以便人们找到有用的信息,而不是孤立的问题