使用CNAME时是否可以创建正确的SPF和DMARC DNS记录? [英] Is it possible to create a correct SPF and DMARC DNS record when you use a CNAME?

查看:175
本文介绍了使用CNAME时是否可以创建正确的SPF和DMARC DNS记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In my setup I have a website (example.app) hosted on Heroku.

然后,我使用Sendgrid将来自Heroku服务器的电子邮件发送给忘记密码的用户.该电子邮件是使用Google的Gsuite注册的.因此,我也从Google服务器发送电子邮件.

Then, I use Sendgrid to send emails from the Heroku server to our users that forget their password. The email is registered using Google's Gsuite. So I also send emails from the Google servers.

发件人电子邮件为:<Appname <noreply@example.app>

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

So I thought these should be my DNS records (note I don't have an A-record):

CNAMES:

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

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

SPF:

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.

However, the Dmarc record doesn't validate as mail is send from a different domain then the To address. I think the email is send from sendgrid.com and the to-address is example.app.

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

Hence, I think by adding the IP-addresses of my Heroku DNS into the SPF record it should work.

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

But how do I do this, when these IP-addresses are dynamic?

推荐答案

否" 根据协议-rfc1912#section-2.4 ,但如果使用 CNAME展平.

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

Also, you should configure your SPF and DMARC using your email servers, in your case, sendgrid not your@example.app

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

Check more about how Cloudflare deals with CNAME flattening here: https://blog.cloudflare.com/introducing-cname-flattening-rfc-compliant-cnames-at-a-domains-root/

这篇关于使用CNAME时是否可以创建正确的SPF和DMARC DNS记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆