security-policy
Skill2 starsChanged 3 months agoMITView on GitHub
This skill should be used when the user asks to configure, inspect, or troubleshoot security policies on Huawei USG6000E series firewalls (USG6300E/6500E/6600E/6680E/6712E/6716E). Covers rule creation (source/destination zone, address, service, application, user), default action, policy groups, logging, content security profiles, and policy hit statistics. Applicable platforms USG6000E V600R007C20+ and USG6000/USG9500/NGFW Module V500R005C20+ (CLI syntax identical between versions).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- OBaruch/ai-native-sdlc-templatetheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- OBaruch/ai-native-sdlc-template★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- aaa-auth-configSkill
- attack-defenseSkill
- bgp-configSkill
- ha-hrpSkill
- health-checkSkill
- interface-configSkill
- ipsec-vpnSkill
- mirrorSkill
- nat-configSkill
- ospf-configSkill
- ssl-vpnSkill
- stack-istackSkill
- static-routeSkill
- vlan-configSkill
- vrrpSkill
- wlan-ac-configSkill
The file
Files
华为 USG 安全策略配置技能 (security-policy)
适用平台: USG6000E 系列(USG6300E/6500E/6600E/6680E/6712E/6716E) 适用版本: V600R007C20 及以上 文档来源: HUAWEI USG6000E V600R007C20 产品文档
安全策略是 USG 防火墙的核心功能,控制不同安全区域间流量的转发或阻断。本技能覆盖安全策略的完整生命周期:创建、修改、移动、复制、删除、查看、排错。
触发场景
用户描述以下任一需求时加载此技能:
- "配置安全策略" / "放通某个区域的流量"
- "创建一条安全策略规则"
- "安全策略默认动作" / "default action"
- "查看安全策略命中"
- "安全策略不生效" / "策略排错"
- "策略组" / "policy group"
- "基于用户/应用/地址的安全策略"
不适用: NAT 策略(→ nat-config/)、认证策略(→ auth-policy)、IPS/AV 内容安全配置(→ content-security/,但安全策略中引用 profile 属本技能)
核心概念
安全策略工作流
流量进入 → 匹配源安全区域 → 逐条匹配规则(从上到下)→ 命中 → 执行动作(permit/deny)
→ 未命中 → 执行默认动作(default action)匹配要素(七元组)
| 要素 | 命令 | 说明 |
| 源安全区域 | source-zone | 流量进入的区域 |
| 目的安全区域 | destination-zone | 流量去往的区域 |
| 源地址 | source-address | 源 IP / 地址组 / 地址集 |
| 目的地址 | destination-address | 目的 IP / 地址组 / 地址集 |
| 服务 | service | 协议+端口(HTTP/DNS/自定义等) |
| 应用 | application | 应用层识别(微信/钉钉等) |
| 用户 | user / access-authentication | 基于用户或用户组的策略 |
规则匹配顺序
从上到下,先命中先生效。规则顺序至关重要。
命令参考
1. 进入安全策略视图
system-view
security-policy ← 进入安全策略视图
[sysname-policy-security]2. 创建规则
security-policy
rule name <rule-name> ← 创建/进入规则
source-zone <zone-name> ← 源安全区域(可配多条)
destination-zone <zone-name> ← 目的安全区域
source-address <ip> <mask> ← 源地址(或地址组)
source-address address-set <name>← 源地址集
destination-address <ip> <mask> ← 目的地址
destination-address address-set <name>
service <service-name> ← 服务(可配多条)
service protocol <tcp|udp> source-port <port> destination-port <port>
application <app-name> ← 应用识别
action permit ← 动作:permit 或 deny
description <text> ← 规则描述(可选)
profile <profile-name> ← 引用内容安全 profile(可选)
policy logging ← 开启命中日志
enable ← 启用规则3. 排除地址
rule name <rule-name>
source-address-exclude <ip> <mask> ← 排除源地址
destination-address-exclude <ip> <mask> ← 排除目的地址
service-exclude <service-name> ← 排除服务4. 默认动作
security-policy
default action permit ← 未命中任何规则时允许(慎用)
default action deny ← 未命中任何规则时拒绝(推荐)
default session logging ← 默认动作的会话日志
default policy logging ← 默认动作的策略日志
default traffic logging ← 默认动作的流量日志5. 策略组(批量管理)
security-policy
group name <group-name> ← 创建策略组
rule name <rule-name> ← 组内规则
parent-group <group-name> ← 规则归属组
group name <group-name> from <n> to <m> ← 调整组顺序
group move <group-name> to <position> ← 移动组
group rename <old> <new> ← 重命名组6. 规则操作
security-policy
rule move <rule-name> to <position> ← 移动规则顺序
rule copy <src-rule> name <dst-rule> ← 复制规则
rule rename <old-name> <new-name> ← 重命名7. 查看命令(display)
| 命令 | 用途 |
display security-policy rule all | 查看所有规则 |
display security-policy rule name <name> | 查看指定规则详情 |
display security-policy rule source-zone trust destination-zone untrust | 按区域过滤 |
display security-policy rule source <ip> destination <ip> protocol tcp destination-port 80 | 按五元组过滤 |
display security-policy group | 查看策略组 |
display policy default-action | 查看默认动作 |
display security-policy statistic | 查看策略命中统计 |
8. 重置统计
reset security-policy counter ← 重置命中计数
reset security-policy statistic ← 重置统计9. 全局开关
security-policy
statistic enable ← 开启策略命中统计
policy logging ← 全局策略日志
security-policy accelerate delay <seconds> ← 加速延迟配置前必须遵守
- 进入 system-view 再操作
- 每条命令后读回显,检测 Error / Incomplete command
- 规则顺序:新规则默认添加到末尾,用
rule move调整 - 默认动作:生产环境必须
default action deny,仅放通必要流量 - zone 必须存在:先确认安全区域已创建(
display zone)
典型配置场景
场景 1:放通 Trust→Untrust 基础上网
system-view
security-policy
rule name trust_to_untrust
source-zone trust
destination-zone untrust
source-address 192.168.1.0 255.255.255.0
action permit
enable
default action deny场景 2:放通 DMZ 服务器的 HTTP/HTTPS
security-policy
rule name allow_web_dmz
source-zone untrust
destination-zone dmz
destination-address 10.1.1.100 255.255.255.255
service http https
action permit
policy logging
enable场景 3:基于应用控制(仅允许邮件,阻断其他)
security-policy
rule name allow_mail_only
source-zone trust
destination-zone untrust
application pop3 smtp imap
action permit
enable
rule name deny_other
source-zone trust
destination-zone untrust
action deny
enable场景 4:策略中引用内容安全 Profile
security-policy
rule name allow_with_ips
source-zone trust
destination-zone untrust
action permit
profile ips_default av_default url_default ← 引用 IPS/AV/URL 过滤
enable场景 5:策略组批量管理
security-policy
group name web_services
rule name allow_http
source-zone untrust destination-zone dmz service http action permit enable
rule name allow_https
source-zone untrust destination-zone dmz service https action permit enable
group name web_services from 1 to 2 ← 整组调整到位置 1-2排错指南
策略不生效排查
| 步骤 | 命令 | 检查点 |
| 1. 确认规则存在 | display security-policy rule all | 规则已创建且 enable |
| 2. 确认规则顺序 | display security-policy rule all | 上方无 deny 规则先命中 |
| 3. 确认区域匹配 | display zone | 源/目的区域正确 |
| 4. 确认地址匹配 | display security-policy rule name <name> | 地址范围覆盖流量 |
| 5. 确认默认动作 | display policy default-action | 非预期流量是否被 deny |
| 6. 查看命中统计 | display security-policy statistic | 规则是否有 hit count |
| 7. 查看会话表 | display firewall session table | 流量是否建立会话 |
常见问题
| 问题 | 原因 | 修复 |
| 策略配了但不生效 | 规则未 enable | 规则视图下 enable |
| 规则生效但流量仍不通 | 上方有更宽泛的 deny 规则 | rule move 调整顺序 |
| 特定 IP 不应放通但被放通 | 地址范围过大 | 用 source-address-exclude 排除 |
| 流量匹配了默认动作 | 所有规则都未命中 | 检查 zone/address/service 匹配条件 |
| 策略日志看不到 | 未开 policy logging | 规则视图下 policy logging |
与其他技能的关联
| 关联技能 | 交互点 |
nat-config/ | 安全策略放通后,NAT 策略决定地址转换 |
health-check/ | 巡检时查看策略命中统计、默认动作 |
interface-config/ | 接口加入安全区域(zone) |
attack-defense/ | 安全策略可引用攻击防范 profile |
ipsec-vpn/ | VPN 流量需安全策略放通 |
ha-hrp/ | 双机热备时策略自动同步 |
参考文档
references/security-policy-commands.md— 完整命令速查(含所有参数取值范围)references/security-policy-inspection.md— 策略巡检与排错详细流程- 产品文档:
/root/.openclaw/workspace-ops/refs/usg6000e-v600r007/cli/security-policy.html - 配置案例:
/root/.openclaw/workspace-ops/refs/usg6000e-v600r007/case_firewall/sec_case_policy_0000.html
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

