【问题标题】:Is it possible to create a correct SPF and DMARC DNS record when you use a CNAME?使用 CNAME 时是否可以创建正确的 SPF 和 DMARC DNS 记录?
【发布时间】:2018-07-13 11:13:06
【问题描述】:

在我的设置中,我有一个托管在 Heroku 上的网站 (example.app)。

然后,我使用 Sendgrid 从 Heroku 服务器向忘记密码的用户发送电子邮件。该电子邮件是使用 Google 的 Gsuite 注册的。所以我也从 Google 服务器发送电子邮件。

发件人邮箱是:<Appname <noreply@example.app>

所以我认为这些应该是我的 DNS 记录(注意我没有 A 记录):

CNAMES:

example.app CNAME "example.app.herokudns.com" www.example.app CNAME "www.example.app.herokudns.com"

防晒系数:

example.app TXT "v=spf1 a include:_spf.google.com include:sendgrid.net ~all"

Dmarc:

_dmarc TXT v=DMARC1; p=none; rua=mailto:dmarc@example.app; ruf=mailto:dmarc-forensic@example.app; fo=0; adkim=r; aspf=r; rf=afrf; pct=100; ri=86400; sp=none

但是,Dmarc 记录不会验证,因为邮件是从与收件人地址不同的域发送的。我认为电子邮件是从 sendgrid.com 发送的,收件人地址是 example.app。

因此,我认为通过将我的 Heroku DNS 的 IP 地址添加到 SPF 记录中它应该可以工作。

但是,当这些 IP 地址是动态的时,我该怎么做呢?

【问题讨论】:

  • 先解析 CNAME,因此您的 SPF 记录无法访问。
  • 你能澄清一下@Synchro 的意思吗?

标签: heroku sendgrid spf dmarc


【解决方案1】:

“否”by protocol - rfc1912#section-2.4,但如果使用 CNAME flattening.,则“是”

此外,您应该使用您的电子邮件服务器配置您的 SPF 和 DMARC,在您的情况下,sendgrid 而不是 your@example.app

在此处查看有关 Cloudflare 如何处理 CNAME 扁平化的更多信息:https://blog.cloudflare.com/introducing-cname-flattening-rfc-compliant-cnames-at-a-domains-root/

【讨论】:

  • 谢谢它现在有效!我在我的 DNS 上使用 CNAME 扁平化(Cloudflare 的功能)。这样我就可以在我的 SPF 记录中使用 A 记录,而无需指定 A 记录。因为 Cloudflare “模仿”了基于 C 名称的 A 记录。我还使用此文档设置了 Sendgrid 的身份验证标头:sendgrid.com/docs/User_Guide/Settings/Sender_authentication/…
猜你喜欢
  • 2022-07-23
  • 1970-01-01
  • 2023-03-20
  • 2018-03-18
  • 2015-09-06
  • 2016-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多