用途:批量查询阿里云 WAF 3.0 实例下所有基于 CNAME 的域名配置,生成结构化 Excel,用于配置审计、交付文档和巡检报告。
主要能力:按区域分别导出,中国内地实例(RegionId cn-hangzhou,Endpoint wafopenapi.cn-hangzhou.aliyuncs.com)与非中国内地实例(ap-southeast-1,wafopenapi.ap-southeast-1.aliyuncs.com)各生成一个工作表,共 18 列,涵盖域名、CNAME、状态、HTTP/HTTPS 端口、后端与备用后端、负载均衡、TLS 版本、HTTP/2、证书 ID、SNI、SNI Host、连接/读取/写入超时、强制 HTTP 后端、资源组。
使用方式:先确认 Aliyun CLI 版本不低于 3.3.3,执行 aliyun configure set --auto-plugin-install true 与 aliyun plugin update,并安装 pip install openpyxl==3.1.5。凭据须在会话外配置,仅用 aliyun configure list 检查状态,不得读取或回显 AK/SK。国际站需单独配置 profile(如 aliyun configure --profile intl)。执行前启用 AI 模式:aliyun configure ai-mode enable 与 aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-cname-config-export"。流程为:无条件同时查询两个区域的 describe-instance;用 describe-domains 分页(PageSize 50)拉取域名;对每个域名调用 describe-domain-detail;最后运行捆绑脚本 python scripts/alibabacloud_waf_cname_config_export.py 生成 Excel,不得自行重写导出逻辑。退出前须执行 aliyun configure ai-mode disable。
权限:需要 yundun-waf:DescribeInstance、DescribeDomains、DescribeDomainDetail,建议附加 AliyunYundunWAFReadOnlyAccess;权限失败时按 references/ram-policies.md 处理并等待用户确认授权。
限制:所有用户可自定义参数须先确认;不创建资源,无需清理;非 CNAME 域名 CNAME 字段可能为空;请求间建议加至少 200ms 延迟防限流。其他细节暂未提供。