威胁情报源
威胁情报源
简介
威胁源列表是一个动态列表,其中可以包含域名、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) | 128 | 64 | 32 |
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,无论是匹配原有会话的流量还是新创建的流量,重新评估为新会话。