大网数据广告活动
服务器运维问答

Get list of IPs from an SPF record

· 52CE 我爱测

We do SPF checks on our mail server, I have a incident where mail from MimeCast sometimes passes and then others fails the SPF check. The domain in question's spf record states v=spf1 include:spf.protection.outlook.com include:_n…

问题原文

原帖链接 · Sl33py · CC BY-SA 3.0

We do SPF checks on our mail server, I have a incident where mail from MimeCast sometimes passes and then others fails the SPF check.

The domain in question's spf record states

v=spf1 include:spf.protection.outlook.com include:_netblocks.mimecast.com -all

If I do a whois on the IP it is a Mimecast IP

My question is how can I query _netblocks.mimecast.com to get a list of IPs so I can troubleshoot

已采纳解答

原帖链接 · MadHatter · CC BY-SA 3.0

You have discovered that many organisations provide SPF records which are themselves made up of SPF records. When we do dig txt _netblocks.mimecast.com we get

;; ANSWER SECTION:
_netblocks.mimecast.com. 300    IN      TXT     "v=spf1 include:eu._netblocks.mimecast.com include:us._netblocks.mimecast.com include:za._netblocks.mimecast.com include:au._netblocks.mimecast.com ~all"

Each of those can then be looked up similarly, with eg dig txt eu._netblocks.mimecast.com to get the raw IP data:

;; ANSWER SECTION:
eu._netblocks.mimecast.com. 300 IN      TXT     "v=spf1 ip4:195.130.217.0/24 ip4:91.220.42.0/24 ip4:146.101.78.0/24 ip4:207.82.80.0/24 ip4:213.167.81.0/24 ip4:213.167.75.0/24 ip4:185.58.84.0/22 ~all"

Outlook's record is a bit more annoying (there's a surprise) in that it's nested:

[me@risby ~]$ dig txt spf.protection.outlook.com
[...]
spf.protection.outlook.com. 586 IN      TXT     "v=spf1 ip4:207.46.101.128/26 ip4:207.46.100.0/24 ip4:207.46.163.0/24 ip4:65.55.169.0/24 ip4:157.56.110.0/23 ip4:157.55.234.0/24 ip4:213.199.154.0/24 ip4:213.199.180.128/26 include:spfa.protection.outlook.com -all"

spfa in turn includes spfb, but that's the last one there, so you can stop digging.

The bigger problem is that this organisation, whoever it is, is getting perilously close to the ten-lookup limit. I count one for the original record, three for the outlook portion, and five for the mimecast portion; total, nine. If both outlook and mimecast add one more each, this organisation's stuffed. It may well know this, but I find that most organisations are sublimely unaware of the finer points of their own SPF record.

Which brings me to my bigger point: if you are thinking of publishing an SPF record, make sure you control your own email infrastructure. If you outsource it, someone else may well shoot you in the foot sooner or later, and your corporate email will become undeliverable because of a change you didn't make and don't know about. If you don't control all your own email, SPF probably isn't for you.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-11-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。