威胁情报源
威胁情报源
简介
威胁源列表是一个动态列表,其中可以包含域名、IPv4/IPv6 地址、地址范围及子网、MAC 地址等。FortiGate 可将其用作防火墙策略、代理策略、Local-in 策略、ZTNA 规则中的源地址或目标地址,DNS Filter 分类、Web Filter 分类等功能中。
威胁源列表有以下几种类型:
- FortiGuard 分类:可以在 WebFilter 中的远程分类中使用。
- IP 地址:IPv4/IPv6 地址、地址范围及子网。可将其用作防火墙策略、代理策略、Local-in 策略、ZTNA 规则中的源地址或目标地址。
- 域名:可将其作为 DNS 过滤配置文件中 "远程类别" 组下的一个类别,用于阻止或监控匹配该类别的域名。
- MAC 地址:可以包含 MAC 地址、MAC 地址范围及 MAC OUI。可将其作为防火墙策略、代理策略及 ZTNA 规则的源。对于透明模式策略或虚拟线对(VWP)策略,MAC 地址威胁源可作为源地址或目标地址使用。
- 恶意软件哈希:FortiGate 获取该列表后,当在 AV 启用 "使用外部恶意软件阻止列表" 功能后,可以选择将其应用于 AV 的文件哈希检查。该功能不需要开启“防病毒扫描”(av-scan)功能。
威胁源列表有两种更新方式:
外部订阅
- 该文件需要以文本文件格式(txt)存储于外部服务器(HTTP/HTTPS),FortiGate 会从外部服务器定期更新该列表。
如果 FortiGate 与外部服务器失去连接,威胁源列表将继续运行。但威胁源列表将不会更新(添加/删除条目),直到与外部服务器重新建立连接。
API 推送(FortiOS 7.2.1 开始支持)
- 通过 Push API 的方式更新威胁源列表。
- 威胁源列表存放在 FortiGate 本地,而不是 HTTP/HTTPS 服务器上。
- Push API 的方法分为三种:add(添加)、remove(删除)、snapshot(覆盖原有全部条目为推送的条目)。
资源格式要求
文件格式
- 外部资源需要使用纯文本格式,其中每个条目独占一行。文件内可通过
#号添加注释,例如:# 这是注释内容。 - 外部资源更新周期可设置为 1 ~ 43200 min。
- 外部威胁源不进行重复条目验证。
- 若外部威胁源内的条目数量超过限制,将显示警告,超出阈值的额外条目将不会被加载。
FortiGuard 分类
可以使用通配符,例如:
*.domain.com。支持 IDN 和 UTF 编码的 URL。
URL 可为 IPv4 或 IPv6 地址。IPv6 URL 必须采用
[ ]格式,如[2100::2]。示例 txt 文本:
# 以下为示例内容 www.fortinet.com *.fortinet.com münchen.de 202.103.1.1 [2001:0db8::eade:27ff:fe04:9a01]
IP 地址
IP 地址可为单个地址、子网地址或地址范围。例如:
192.168.1.1、192.168.10.0/24、192.168.100.1-192.168.100.254。地址可为 IPv4 或 IPv6 格式。
示例 txt 文本:
# 以下为示例内容 192.168.2.100 172.200.1.4/32 172.16.1.0/24 172.16.8.1-172.16.8.100 2001:db8::eade:27ff:fe04:9a00/120 2001:0db8::eade:27ff:fe04:aa01-2001:0db8::eade:27ff:fe04:ab01
域名
域名列表支持通配符,例如:
*.test.com。支持 IDN 格式。
示例 txt 文本:
# 以下为示例内容 *.test.com www.fortinet.com handbook.fortinet.com.cn münchen.de 新华网.cnDNS Filter 引用示例:
config system external-resource edit "fqdn" set type domain set category 193 set resource "https://handbook.fortinet.com.cn/fqdn.txt" next end config dnsfilter profile edit "default" set external-ip-blocklist "fqdn" next end
MAC 地址
MAC 地址可以是单个地址、MAC OUI 或地址范围。如:
01:01:01:01:01:01、8c:aa:b5、01:01:01:01:01:01-01:01:02:50:20:ff。MAC 地址中的十六进制数字必须用
:分隔。示例 txt 文本:
# 以下为示例内容 01:01:01:01:01:01 8c:aa:b5 01:01:01:01:01:01-01:01:02:50:20:ff防火墙策略引用示例:
config system external-resource edit "mac" set type mac-address set resource "https://handbook.fortinet.com.cn/mac.txt" next end config firewall policy edit 2 set srcintf "lan" set dstintf "wan1" set action deny set srcaddr "mac" set dstaddr "all" set schedule "always" set service "ALL" next end
恶意软件哈希
恶意软件哈希列表需遵循严格格式方为有效。每个哈希签名条目必须独占一行。有效签名格式如下:
# 加上hash算法的描述,以空格隔开 aa67243f746e5d76f68ec809355ec234 md5 # 加上hash算法的描述,以空格隔开 a57983cb39e25ab80d7d3dc05695dd0ee0e49766 sha1 # 加上hash算法的描述,以空格隔开 ae9bc0b4c5639d977d720e4271da06b50f7c60d1e2070e9c75cc59ab30e49379 sha256 # 无效条目 7688499dc71b932feb126347289c0b8a_md5_sample2 7614e98badca10b5e2d08f8664c519b7a906fbd5180ea5d04a82fce9796a4b87sha256_sample3AV 配置文件引用示例:
config system external-resource edit "av" set type malware set resource "https://handbook.fortinet.com.cn/av.txt" next end config antivirus profile edit "default" set external-blocklist "av" next end
配置步骤
外部订阅
这里以 IP 地址威胁源为例。进入 FortiGate 的“安全架构 → 外部连接器”页面,点击“新建”按钮。

选择“外部源”中的“IP 地址”选项。

配置 IP 威胁源列表的名称,更新方法选择“外部进料”,外部资源 URL 填写 HTTP/HTTPS 服务器上的 txt 文本文件链接,按需开启“HTTP 认证”与“客户端认证书认证”,刷新率使用默认的 5min。
重要
- 示例中提供的 URL 仅用于演示目的,并不代表一个维护良好的 IP 地址列表。建议您使用一个信誉良好的外部 IP 地址列表 URL,且该列表应定期更新。
- 为了提高连接的安全性,建议使用 HTTPS 链接,并按需开启“HTTP 认证”与“客户端认证书认证”。

config system external-resource edit "IP_Threat_Feed" set type address set resource "https://handbook.fortinet.com.cn/ip.txt" next end鼠标悬浮至该 IP 威胁源列表上,可以看到该外部源的连接状态(绿色√表示与外部服务器正常连接,红色 × 表示与外部服务器通信中断)、最后更新时间和当前的条目数,点击右上角的刷新按钮可以立刻请求更新。

点击查看条目按钮,可以看到 FortiGate 从外部服务器上获取到的 IP 地址列表,有效状态表示该 IP 格式是否符合 FortiGate 要求。

如果是无法识别的 IP 格式,则会显示红色 ×,如下所示恶意软件哈希外部源获取到的格式为 IP 地址,就会显示无效标记。

创建防火墙策略,在目标地址中引用该 IP 威胁源列表对象,动作选择“拒绝”。
重要
由于示例里的 IP 威胁源列表中同时包含 IPv4 和 IPv6 地址,针对防火墙策略配置:
- 源要同时引用 IPv4 地址对象和 IPv6 地址对象。
- 目的地址要同时引用 IPv4 威胁源和 IPv6 威胁源,FortiGate 获取到“IP 威胁源列表”后,会自动将其中的 IPv4 和 IPv6 地址分别放在两个地址对象中。
- 当然,也可以将此防火墙策略拆分成 2 条,一条 IPv4 的,一条 IPv6 的。

config firewall policy edit 2 set name "Deny_Threat_IP" set srcintf "lan" set dstintf "wan1" set srcaddr "192.168.100.0/24" set dstaddr "IP_Threat_Feed" set srcaddr6 "all" set dstaddr6 "IP_Threat_Feed" set schedule "always" set service "ALL" set logtraffic all next end内网客户端穿过 FortiGate 访问 IP 威胁源列表中的 IP 地址,访问失败,FortiGate 产生了拦截的防火墙日志。
date=2025-08-26 time=15:28:29 eventtime=1756193309197961159 tz="+0800" logid="0000000013" type="traffic" subtype="forward" level="notice" vd="root" srcip=192.168.100.177 srcport=53915 srcintf="lan" srcintfrole="lan" dstip=17.57.145.25 dstport=5223 dstintf="wan1" dstintfrole="wan" dstthreatfeed="IP_Threat_Feed" srccountry="Reserved" dstcountry="United States" sessionid=392389 proto=6 action="deny" policyid=2 policytype="policy" poluuid="f18e907a-824b-51f0-8704-409b8dba5152" policyname="Deny_Threat_IP" service="tcp/5223" trandisp="noop" appcat="unscanned" duration=0 sentbyte=0 rcvdbyte=0 sentpkt=0 rcvdpkt=0 crscore=30 craction=131072 crlevel="high" srcserver=0在 Local-in 策略中调用 IP 威胁源列表。
config firewall local-in-policy edit 1 set intf "port1" set srcaddr "IP_Threat_Feed" set dstaddr "all" set action deny set service "ALL" set schedule "always" next end在 DNS 过滤器中调用 IP 威胁源列表,可以阻止客户端以 DNS 的方式访问威胁源中的 IP。
config dnsfilter profile
edit "dns_profile"
set external-ip-blocklist "IP_Threat_Feed"
next
end
date=2025-08-26 time=15:06:50 eventtime=1675724810452621179 tz="-0800" logid="1501054400" type="utm" subtype="dns" eventtype="dns-response" level="warning" vd="root" policyid=0 sessionid=555999 srcip=192.168.100.178 srcport=35113 srccountry="Reserved" srcintf="lan" srcintfrole="undefined" dstip=17.57.145.25 dstport=53 dstcountry="Reserved" dstintf="root" dstintfrole="undefined" proto=17 profile="dns_profile" xid=25532 qname="www.fortinet.com" qtype="A" qtypeval=1 qclass="IN" ipaddr="2.2.2.2" msg="Domain was blocked because it is in the domain-filter list" action="redirect" domainfilteridx=0 domainfilterlist="IP_Threat_Feed"API 推送
重要
该功能在 FortiOS 7.2.1 及更高版本支持。
这里以 FortiGuard 威胁源为例。创建 API 用户,赋予 super_admin 权限,并生成 API key。配置方法请参考:系统管理 → 管理员配置 → API 用户章节。
进入 FortiGate 的“安全架构 → 外部连接器”页面,点击“新建”按钮。

选择“外部源”中的“FortiGuard 分类”选项。

配置 FortiGuard 分类威胁源的名称,更新方法选择“推送接口”,点击确认按钮。

config system external-resource edit "Threat_FGD" set update-method push set category 192 next end随后会弹出 API 示例窗口,在此窗口中,可以根据输入的 API 密钥、条目(可以多个,以
,隔开)、推送命令(添加、删除、快照),来即时生成对应的 cURL 请求样本,生成后,点击右侧的复制按钮可以复制 cURL。注意是否需要修改 IP 为设备接受 API 推送的接口 IP,这里以添加 2 个域名为例。
客户端执行该 cURL,结果显示执行成功(如果报 403 错误,可能是 API 用户权限不够)。
# curl -k -X POST -H 'Authorization: Bearer q6G9mhwppNjNns40xN5qp45pzmxHHG' --data '{ "commands": [{ "name": "Threat_FGD", "command": "add", "entries": [ "www.summerice.com", "www.abc.com" ] } ]}' "https://192.168.100.99/api/v2/monitor/system/external-resource/dynamic" {"http_method":"POST","results":[{"name":"Threat_FGD","command":"add","status":"success"}],"vdom":"root","path":"system","name":"external-resource","action":"dynamic","status":"success","serial":"FG101FTK20007637","version":"v7.6.4","build":3596}%GUI 查看该威胁源的条目数为 2。

点击查看条目按钮,可以看到两个域名被成功添加。

失败的 API 更新,可以返回错误原因,如下错误原因为更新方法填写错误。
# curl -k -X POST -H 'Authorization: Bearer q6G9mhwppNjNns40xN5qp45pzmxHHG' --data '{ "commands": [{ "name": "Threat_FGD", "command": "update", "entries": [ "www.summerice.com", "www.abc.com" ] } ]}' "https://192.168.100.99/api/v2/monitor/system/external-resource/dynamic" {"http_method":"POST","results":[{"name":"Threat_FGD","command":"update","error":"Invalid command.","status":"error"}],"vdom":"root","path":"system","name":"external-resource","action":"dynamic","status":"success","serial":"FG101FTK20007637","version":"v7.6.4","build":3596}%在 WebFilter 配置文件中的远程分类中,将上述创建的 FortiGuard 威胁源的动作配置为“屏蔽”。

config webfilter profile
edit "Treat_FGD"
config ftgd-wf
config filters
edit 35
set category 192
set action block
next
end
end
next
end在上网的防火墙策略中调用该 WebFilter 配置文件。
config firewall policy edit 1 set name "to_Internet" set srcintf "lan" set dstintf "wan1" set action accept set srcaddr "all" set dstaddr "all" set schedule "always" set service "ALL" set utm-status enable set ssl-ssh-profile "certificate-inspection" set webfilter-profile "Treat_FGD" set logtraffic all set nat enable next end客户端浏览器通过 FortiGate 访问 FortiGuard 威胁源中的域名,可以正常拦截威胁源中的网址。

cURL 中也可以在 commands 字段中包含多个威胁源,执行不同的动作,如下所示,分别对多个威胁源连接器进行更新,以
,隔开。# curl -k -X POST -H 'Authorization: Bearer q6G9mhwppNjNns40xN5qp45pzmxHHG' --data '{ "commands": [{ "name": "Threat_FGD", "command": "add", "entries": [ "www.summerice.com", "www.abc.com" ]} , {"name":"ip","command":"delete","entries":["10.10.10.3/32","10.10.10.4/32"]}, {"name":"domain","command":"snapshot","entries":["www.baidu.com","www.sina.com.cn"]}]}' "https://192.168.100.99/api/v2/monitor/system/external-resource/dynamic"
CLI 相关
查看威胁源已获取并保存在 FortiGate 上的列表内容。
FortiGate # diagnose sys external-resource list IP_Threat_Feed Dump external resource address table 'IP_Threat_Feed': 167.3.182.140 225.60.62.231/24 31.158.227.180-31.158.228.166 52.231.72.77/24 152.39.145.129/8 ...... FortiGate # diagnose sys external-resource list Threat_FGD Dump external resource category 'Threat_FGD': www.abc.com www.summerice.com查看外部威胁源列表的统计信息。
FortiGate # diagnose sys external-resource stats name: IP_Threat_Feed; uuid_idx: 662; type: address table; update_method: feed; total lines: 200; valid lines: 200; error lines: 0; used: yes; buildable: 200; total in count file: 200; ranges: 151; name: Threat_FGD; uuid_idx: 667; type: category; update_method: push; total lines: 2; valid lines: 2; error lines: 0; used: yes; buildable: 2; total in count file: 2;通过 FortiGate 的 CLI 对 Push API 类型的威胁源进行更新(add、remove、snapshot)。
diagnose sys external-resource {push-add | push-remove | push-snapshot} <feed_name> <entry> FortiGate # diagnose sys external-resource push-remove Threat_FGD www.abc.com Command result: { "name": "Threat_FGD", "command": "remove", "status": "success" } FortiGate # diagnose sys external-resource list Threat_FGD Dump external resource category 'Threat_FGD': www.summerice.com通过 FortiGate 的 CLI 对威胁源进行更新(使用 json command 格式,可以对多个威胁源执行不同的动作)。
FortiGate # diagnose sys external-resource push-api-json-commands '{"commands": [{"name":"ip","command":"add","entries":["10.10.10.1","10.10.10.2"]}, {"name":"Threat_FGD","command":"snapshot","entries":["www.fortinet.com","www.sina.com.cn"]}]}' Returned json: [ { "name":"ip", "command":"add", "status":"success" }, { "name":"Threat_FGD", "command":"snapshot", "status":"success" } ] FortiGate # diagnose sys external-resource list ip Dump external resource address table 'ip': 10.10.10.2/32 10.10.10.1 10.10.10.2 10.10.10.1/32 FortiGate # diagnose sys external-resource list Threat_FGD Dump external resource category 'Threat_FGD': www.fortinet.com www.sina.com.cn
配置规格
外部资源文件的最大容量和条目数量受设备型号限制。
外部资源个数的配置规格可以使用
print tablesize查看system.external-resource部分,如下所示,此 FortiGate 的全局限制为 512 个,每个虚拟域 VDOM 的限制为 256 个。FortiGate # print tablesize ... system.external-resource: 0 256 512 0 ...每种外部威胁源文件中的最大条目数及每种型号的文件大小限制如下(入门型号、中端型号、高端!)型号的具体型号可以参考:系统管理 → 固件与配置管理 → 固件版本管理 → 固件下载章节):
外部威胁源类型 入门型号 中端型号 高端型号 FortiGuard 分类 150 000 300 000 2 000 000 IP 地址 300 000 1 000 000 5 000 000 域名 1 000 000 3 000 000 5 000 000 MAC 地址 1 000 000 1 000 000 1 000 000 文件大小限制(MB) 32 64 128
ext-resource-session-check
外部威胁源对象(如 IP、域名、Web 分类等)的内容发生变化后,相关会话的 dirty 状态变化会根据 ext-resource-session-check 配置决定。
重要
会话 dirty 的机制请参考:策略与对象 → 会话 dirty 机制章节。
config system settings
set fqdn-session-check { enable | disable }
enddisable(默认):现有会话不会被标记为dirty,而是被标记为persistent,原有匹配该会话的流量也不会被重新评估(直至该会话老化),仅检查新创建的流量。enable:现有相关会话被标记为dirty,无论是匹配原有会话的流量还是新创建的流量,重新评估为新会话。