1001 policy network_error ai_generated true

错误 1001:DNS 解析错误。源服务器 IP 地址通过 DNS 记录暴露,绕过了 Cloudflare 代理。

Error 1001: DNS resolution error. The origin server's IP address is exposed via DNS records, bypassing Cloudflare proxy.

ID: policy/cloudflare-origin-ip-exposed-in-dns

其他格式: JSON · Markdown 中文 · English
92%修复率
86%置信度
1证据数
2023-05-12首次发现

版本兼容性

版本状态引入弃用备注
Cloudflare DNS v1 active
Cloudflare API v4 active

根因分析

域名的 DNS 记录在 Cloudflare 中设置为 '仅 DNS'(灰色云)而不是 '已代理'(橙色云),导致流量绕过 Cloudflare 并暴露源 IP,从而导致潜在的 DDoS 和安全策略违规。

English

A DNS record for the domain is set to 'DNS only' (gray cloud) instead of 'Proxied' (orange cloud) in Cloudflare, causing traffic to bypass Cloudflare and expose the origin IP, leading to potential DDoS and security policy violations.

generic

官方文档

https://developers.cloudflare.com/dns/manage-dns-records/reference/proxied-dns-records/

解决方案

  1. 在 Cloudflare 仪表板中将 DNS 记录从 '仅 DNS' 更改为 '已代理'(橙色云)。
    示例:
      # 使用 Cloudflare API:
      curl -X PATCH "https://api.cloudflare.com/client/v4/zones/ZONE_ID/dns_records/RECORD_ID" \
        -H "Authorization: Bearer API_TOKEN" \
        -H "Content-Type: application/json" \
        --data '{"proxied": true}'
  2. 对所有 HTTP/HTTPS 记录使用 Cloudflare 的 '橙色云' 功能,并确保没有 A/AAAA 记录设置为 '仅 DNS'。定期审计所有 DNS 记录。
    示例:
      # 列出所有 DNS 记录并检查代理状态
      curl -s "https://api.cloudflare.com/client/v4/zones/ZONE_ID/dns_records" \
        -H "Authorization: Bearer API_TOKEN" | jq '.result[] | select(.proxied == false) | {name, type}'
  3. 使用 Cloudflare 的 '已验证源拉取' 功能,确保只有 Cloudflare IP 可以连接到源,即使 IP 暴露也无妨。
    示例:
      # 在 Cloudflare 仪表板中启用:SSL/TLS > 源服务器 > 已验证源拉取 > 开启
      # 然后配置您的 Web 服务器拒绝非 Cloudflare 连接

无效尝试

常见但无效的做法:

  1. Adding a new proxied A record without removing the old one 50% 失败

    Adding a new A record with the same IP but proxied will not fix the issue if the original unproxied record is still active; both records will resolve, and the unproxied one will expose the IP.

  2. Changing the origin server IP 70% 失败

    Changing the origin server IP address might temporarily hide the exposed IP, but if the DNS record remains unproxied, the new IP will also be exposed.

  3. Enabling SSL/TLS settings only 80% 失败

    Enabling 'Always Use HTTPS' or other SSL settings does not prevent DNS-level exposure; the record must be proxied.