18-WEB防护命令
本章节下载: 18-WEB防护命令 (277.75 KB)
1.2.1 web-defend log { limited | unlimited }
1.6.4 ip { belong | unbelong }
1.6.6 url {contain | uncontain | regular-match}
1.6.7 referer { equal | unequal }
1.6.8 referer {contain | uncontain | regular-match}
1.6.9 {cookie | user-agent} {contain | uncontain | regular-match}
1.6.10 args {equal | unequal | contain | uncontain | regular-match}
1.7.1 anti-steal-link { enable | disable }
1.7.4 anti-stealing-link file-extension
1.7.5 anti-stealing-link white-list
1.7.6 anti-stealing-link action
1.8.1 csrf-defend { enable | disable }
1.9.1 cc-defend {enable|disable}
1.9.4 cc-defend interval <30-3600>
1.10.1 application-hide {enable|disable}
1.10.2 application-hide {server | x-powered-by}
1.10.3 application-hide replace
1.11.1 anti-tamper start-url URL
1.11.2 anti-tamper exception-url
1.11.3 anti-tamper {enable|disable}
web-defend session limit max命令用来配置WEB防护会话劫持流条数。
web-defend session expired set命令用来设置时间,在此时间内会话劫持流未有后续报文,则删除此条流。
【命令】
web-defend session limit max <1000-100000>
web-defend session expired set <10-600>
【缺省情况】
缺省情况下,默认会话劫持流条数是100000,老化时间为60分钟。
【视图】
配置视图
【参数】
<1000-100000>:会话劫持流条数。
<10-600>:设置时间,在此时间内会话劫持流未有后续报文,单位为分钟。
【使用指导】
会话劫持规格配置,建议默认即可,无需更改。
【举例】
# 修改会话劫持配置规格,配置会话劫持流条数为1000条。
host# configure terminal
host(config)# web-defend session limit max 1000
web-defend log limited命令用来配置WEB防护日志限制。
web-defend log unlimited命令用来删除WEB防护日志限制。
【命令】
web-defend log { limited | unlimited }
【缺省情况】
缺省情况下,默认是限制的。
【视图】
配置视图
【参数】
limited:限制产生日志:4G及以上的盒子1秒记录1条日志,4G以下的盒子3秒记录一条,其中应用隐藏、CC、防盗链、防篡改按整体日志限制,CSRF、精确访问控制按单条策略日志限制。
unlimited:不限制产生日志。
【使用指导】
为了避免日志风暴,默认进行日志限制,若在对外测试中可通过命令放开限制。
【举例】
# 关闭WEB防护日志限制
host# configure terminal
host(config)# web-defend log unlimited
web-defend policy命令用来配置WEB防护策略。
no Web-defend policy命令用来删除WEB防护策略。
【命令】
web-defend policy NAME source-address server-address SERVER_PORT [DOMAIN]
no web-defend policy NAME
【视图】
配置视图
【参数】
NAME:WEB防护策略名称。
source-address:WEB防护策略匹配的源IP地址,可以引用某地址对象或者地址组,any表示源地址为任意地址。
server-address:WEB防护策略匹配的服务器地址,可以引用某个地址对象或者地址组,any表示源地址为任意地址。
SERVER_PORT:WEB防护策略匹配的服务端口。
DOMAIN:WEB防护策略匹配的域名。
【使用指导】
出入接口、源目的ip地址、服务、应用、用户、时间等匹配条件除了any或者always外,需要配置具体的对象,才能被安全策略引用。
【举例】
# 创建一条服务端口是80,其余匹配条件为any的WEB防护策略
host# configure terminal
host(config)# web-defend policy test any any 80
enable 命令用来启用WEB防护策略。
disable命令用来禁用WEB防护策略。
【命令】
enable
disable
【缺省情况】
缺省情况下,WEB防护策略是启用的。
【视图】
Web防护策策略视图
【举例】
# 禁用WEB防护策略test。
host# configure terminal
host(config)#web-defend policy test
host(config-web-defend-policy)# disable
web-defend policy move命令用来将WEB防护策略移到某条策略之后或者之前。
【命令】
web-defend policy move NAME { before | after } NAME
【视图】
配置视图
【参数】
NAME(第一个name):被移动的WEB防护策略名称。
before:将策略移到参考策略之前。
after:将策略移到参考策略之前。
NAME(第一个name):参考WEB防护策略名称。
【举例】
# 将WEB防护策略test1移到WEB防护策略test2之后。
host# configure terminal
host(config)# web-defend policy move test1 after test2
access-control { enable | disable } 启用/禁用精确访问控制。
【命令】
access-control { enable | disable }
【缺省情况】
缺省情况下,默认是禁用的。
【视图】
WEB防护配置视图
【参数】
enable命令用来启用WEB防护策略的精确访问控制功能。
disable命令用来禁用WEB防护策略的精确访问控制功能。
【举例】
# 开启WEB防护策略test的精确访问控制功能。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control enable
access-control rule 创建精确访问控制规则。
no access-control rule 删除精确访问控制规则
【命令】
access-control rule <1-32>
no access-control rule <1-32>
【缺省情况】
无
【视图】
WEB防护配置视图
【参数】
<1-32>:规则ID
【举例】
# WEB防护策略test下创建一条id为1的精确访问控制规则。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
ip { equal | unequal } 配置精确访问控制ip相等或者不等的匹配条件。
no ip { equal | unequal } 删除精确访问控制ip相等或者不等的匹配条件。
【命令】
ip { equal | unequal } A.B.C.D
no ip { equal | unequal } A.B.C.D
【缺省情况】
无
【视图】
精确访问控制配置视图
【参数】
equal :等于
Unequal:不等于
A.B.C.D:IP地址
【举例】
# id为1的精确访问控制规则设置匹配条件ip等于1.1.1.1。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)#ip equal 1.1.1.1
ip { belong | unbelong } 配置精确访问控制ip属于或者不属于的匹配条件。
no ip { belong | unbelong } 删除精确访问控制ip属于或者不属于的匹配条件。
【命令】
ip { belong | unbelong } A.B.C.D/M
no ip { belong | unbelong } A.B.C.D/M
【缺省情况】
无
【视图】
精确访问控制配置视图
【参数】
belong :属于
unbelong:不属于
A.B.C.D/M:IP地址网断
【举例】
# id为1的精确访问控制规则设置匹配条件ip属于1.1.1.1/24。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)#ip belong 1.1.1.1/24
url { equal | unequal } 配置精确访问控制url相等或者不等的匹配条件。
no url { equal | unequal } 删除精确访问控制url相等或者不等的匹配条件。
【命令】
url { equal | unequal } content
no url { equal | unequal } content
【缺省情况】
无
【视图】
精确访问控制配置视图
【参数】
equal :等于
unequal:不等于
content:输入内容关键字
【使用指导】
URL中可能包含?号,直接在命令行配不下去,所以采用交互方式配置。
【举例】
# id为1的精确访问控制规则设置匹配条件url等于www.qq.com。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)#url equal content
Please input the content to match, length scope is 1-127. It is case insensitive, can not include space and should start with "/": /www.qq.com
url {contain | uncontain | regular-match} 配置精确访问控制URL包含或不包含,或正则匹配某段内容。
no url {contain | uncontain | regular-match} 删除精确访问控制URL包含或不包含,或正则匹配某段内容相关配置。
【命令】
url {contain | uncontain | regular-match} content
no ip url {contain | uncontain | regular-match} content
【缺省情况】
无
【视图】
精确访问控制配置视图
【参数】
contain :包含
uncontain :不包含
regular-match:正则匹配
【举例】
# id为1的精确访问控制规则设置匹配条件url包含.exe。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)#url contain content
Please input the content to match, length scope is 1-127. It is case insensitive and can not include space: .exe
referer { equal | unequal } 配置精确访问控制referer 相等或者不等的匹配条件。
no referer { equal | unequal } 删除精确访问控制referer 相等或者不等的匹配条件。
【命令】
referer { equal | unequal } content
no referer { equal | unequal } content
【缺省情况】
无
【视图】
精确访问控制配置视图
【参数】
equal :等于
Unequal:不等于
【举例】
# id为1的精确访问控制规则设置匹配条件referer等于http://www.qq.com。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)# referer equal content
Please input the content to match, maximum length is 127. It is case insensitive, can not include space and should start with "http://": http://www.qq.com
referer {contain | uncontain | regular-match} 配置精确访问控制referer 包含或不包含,或正则匹配某段内容。
no referer {contain | uncontain | regular-match} 删除精确访问控制referer 包含或不包含,或正则匹配某段内容相关配置。
【命令】
referer {contain | uncontain | regular-match} content
no referer {contain | uncontain | regular-match} content
【缺省情况】
无
【视图】
精确访问控制配置视图
【参数】
contain :包含
uncontain :不包含
regular-match:正则匹配
【举例】
# id为1的精确访问控制规则设置匹配条件referer包含163.com。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)# referer contain content
Please input the content to match, length scope is 1-127. It is case insensitive and can not include space: 163.com
{cookie | user-agent} {contain | uncontain | regular-match} 配置精确访问控制cookie或ua包含或不包含,或正则匹配某段内容。
no {cookie | user-agent} {contain | uncontain | regular-match} 删除精确访问控制cookie或ua包含或不包含,或正则匹配某段内容相关配置。
【命令】
cookie {contain | uncontain | regular-match} CONTENT
no cookie {contain | uncontain | regular-match} [CONTENT]
user-agent {contain | uncontain | regular-match} CONTENT
no ip user-agent {contain | uncontain | regular-match} [CONTENT]
【缺省情况】
无
【视图】
精确访问控制配置视图
【参数】
contain :包含
uncontain :不包含
regular-match:正则匹配
CONTENT:匹配内容
【举例】
# id为1的精确访问控制规则设置匹配条件cookie 包含12345。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)# cookie contain 12345
args {equal | unequal | contain | uncontain | regular-match} 配置精确访问控制args等于或不等于,包含或不包含,或正则匹配某段内容。
no args {equal | unequal | contain | uncontain | regular-match} 删除精确访问控制args等于或不等于,包含或不包含,或正则匹配某段内容相关配置。
【命令】
args {contain | uncontain | regular-match} CONTENT
no args {contain | uncontain | regular-match} [CONTENT]
【缺省情况】
无
【视图】
精确访问控制配置视图
【参数】
equal :等于
unequal:不等于
contain :包含
uncontain :不包含
regular-match:正则匹配
CONTENT :匹配条件
【举例】
# id为1的精确访问控制规则设置匹配条件args包含 bin。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)# args contain bin
{url | method | referer | user-agent | cookie | args} {length-less | length-equal | length-greater} <1-5000> 命令用来设置各字段的匹配长度。
【命令】
{url | method | referer | user-agent | cookie | args} {length-less | length-equal | length-greater} <1-5000>
no {url | method | referer | user-agent | cookie | args} {length-less | length-equal | length-greater} [<1-5000>]
【缺省情况】
无
【视图】
精确访问控制配置视图
【参数】
length-less:长度小于
length-equal:长度等于
length-greater:长度大于
<1-5000>:匹配长度值,范围为1-5000。
【举例】
# id为1的精确访问控制规则设置url的长度小于254。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)#url length-less 254
action { permit | permit-all | deny } 配置精确访问控制规则的动作。
【命令】
action { permit | permit-all | deny }
【缺省情况】
缺省情况下,默认是permit。
【视图】
精确访问控制配置视图
【参数】
Permit:允许。
Deny:拒绝。
Permit-all:允许并且当前流不再继续匹配WEB防护的其它功能。
【举例】
# id为1的精确访问控制规则设置匹配动作为permit。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#access-control rule 1
host(config-web-defend-policy-access-control)#action permit
anti-steal-link { enable | disable } 启用/禁用防盗链功能。
【命令】
anti-steal-link {enable | disable}
【缺省情况】
缺省情况下,默认是禁用的。
【视图】
WEB防护配置视图
【参数】
enable:启用。
disable: 禁用。
【举例】
# 开启WEB防护策略test的防盗链功能。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#anti-steal-link enable
anti-steal-link type 防盗链方式配置。
【命令】
anti-steal-link type { site | url | file }
【缺省情况】
缺省情况下,默认是site。
【视图】
WEB防护配置视图
【参数】
site:全站防盗链。
url:对指定的url防盗链。
file:对指定的文件类型防盗链。
【举例】
# WEB防护策略test的防盗链方式配置成指定文件类型的防盗链。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#anti-steal-link type file
anti-steal-link url 配置需要防盗链的URL
no anti-steal-link url 删除需要进行防掉链的URL
【命令】
anti-steal-link url content
no anti-steal-link url [ content ]
【视图】
WEB防护策略视图
【参数】
content:url关键字,no命令不配置表示删除全部。
【使用指导】
URL中可能包含?号,直接在命令行配不下去,所以采用交互方式配置
【举例】
# WEB防护策略test的防盗链方式配置成指定文件类型的防盗链。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy}anti-steal-link url content
Please input the url, length scope is 1-127. It is case insensitive, can not include space and shold start with "/": /192.168.24.26
anti-stealing-link file-extension 配置需要防盗链的文件后缀名
no anti-stealing-link file-extension 删除需要防盗链的文件后缀名
【命令】
anti-stealing-link file-extension EXTENSION
no anti-stealing-link file-extension [EXTENSION]
【视图】
WEB防护策略视图
【参数】
EXTENSION:文件后缀名。
【使用指导】
可以配置多个,以逗号分隔。
【举例】
# WEB防护策略test的需要防盗链的文件后缀名为.txt。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy}anti-steal-link file-extension .txt
anti-stealing-link white-list 配置允许盗链的站点白名单
no anti-stealing-link white-list 删除允许盗链的站点白名单
【命令】
anti-stealing-link white-list content
no anti-stealing-link white-list [content]
【视图】
WEB防护策略视图
【参数】
content:站点白名单关键字,no命令不配置表示删除全部。
【使用指导】
URL中可能包含?号,直接在命令行配不下去,所以采用交互方式配置
【举例】
# WEB防护策略test的防盗链方式允许盗链的站点白名单设置为*.baidu.com。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy} anti-steal-link white-list content
Please input the white-list, length scope is 1-127. It is case insensitive and can not include space. The "*" is allowed to use at the begin to match one or more characters, such as "*.baidu.com": *.baidu.com
anti-stealing-link action 配置防盗链的动作。
【命令】
anti-stealing-link action { permit | deny }
【缺省情况】
缺省情况下,默认是permit。
【视图】
精确访问控制配置视图
【参数】
Permit:允许。
Deny:拒绝。
【举例】
# WEB防护策略test的防盗链的处理动作为permit。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)# anti-steal-link action permit
csrf-defend { enable | disable } 启用/禁用CSRF功能。
【命令】
csrf-defend {enable | disable}
【缺省情况】
缺省情况下,默认是禁用的。
【视图】
WEB防护配置视图
【参数】
enable:启用。
Disable:禁用。
【举例】
# 开启WEB防护策略test的csrf功能。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#csrf-defend enable
csrf-defend url 配置需要CSRF防护的URL。
no csrf-defend url 删除需要进行CSRF防护的URL。
【命令】
csrf-defend url content
no csrf-defend url [content]
【视图】
WEB防护策略视图
【参数】
content:url关键字,no命令不配置表示删除全部。
【使用指导】
URL中可能包含?号,直接在命令行配不下去,所以采用交互方式配置
【举例】
# 添加csrf防护的URL。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy}csrf-defend url content
Please input the url, length scope is 1-127. It is case insensitive, can not include space and shold start with "/": /192.168.24.26
permit referer content 添加允许访问CSRF防护的URL的referer
no permit referer [content] 删除允许访问CSRF防护的URL的referer
【命令】
permit referer content
no permit referer [content]
【视图】
csrf策略配置视图
【参数】
content:url关键字,no命令不配置表示删除全部。
【使用指导】
URL中可能包含?号,直接在命令行配不下去,所以采用交互方式配置
【举例】
# 允许访问CSRF防护的URL的referer。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy}csrf-defend url content
Please input the url, length scope is 1-127. It is case insensitive, can not include space and shold start with "/": /192.168.24.26
host(config-web-defend-policy-csrf} permit referer content
Please input the referer, maximum length is 127. It is case insensitive, can not include space and should start with "http://": http://www.163.com
action 配置发生CSRF攻击时的动作。
【命令】
action {permit | deny}
【缺省情况】
缺省情况下,默认是permit。
【视图】
csrf策略配置视图
【参数】
Permit: 允许。
Deny:拒绝。
【举例】
# 配置防盗链策略的动作为permit。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy}csrf-defend url content
Please input the url, length scope is 1-127. It is case insensitive, can not include space and shold start with "/": /192.168.24.26
host(config-web-defend-policy-csrf} action permit
cc-defend {enable | disable} 启用/禁用CC防护功能。
【命令】
cc-defend {enable | disable}
【缺省情况】
缺省情况下,默认是禁用的。
【视图】
WEB防护配置视图
【参数】
enable:启用。
disable:禁用。
【举例】
# 开启WEB防护策略test的CC防护功能。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#cc-defend enable
cc-defend type 命令用来配置CC攻击防护的防护范围。
【命令】
cc-defend type { site | url }
【缺省情况】
缺省情况下,默认是site。
【视图】
WEB防护配置视图
【参数】
site:全站防盗链。
url:对指定的url防盗链。
【举例】
# 配置WEB防护策略test的CC防护方式为指定URL
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#cc-defend type url
cc-defend url 配置CC防护的URL
no cc-defend url 删除CC防护的URL
【命令】
cc-defend url content
no cc-defend url [content]
【视图】
WEB防护策略视图
【参数】
content:url关键字,no命令不配置表示删除全部。
【使用指导】
URL中可能包含?号,直接在命令行配不下去,所以采用交互方式配置
【举例】
# 添加cc防护的URL。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy} cc-defend url content
Please input the url, length scope is 1-127. It is case insensitive, can not include space and should start with "/": /192.168.24.26
cc-defend interval配置CC防护的检查时长
【命令】
cc-defend interval <30-3600>
【视图】
WEB防护策略视图
【参数】
<30-3600>:检测时间,单位为秒,默认60秒。
【举例】
# 设置cc防护的检测时长为30s。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy} cc-defend interval 30
cc-defend access-times配置CC防护的检测时长内的访问次数
【命令】
cc-defend access-times <30-100000>
【视图】
WEB防护策略视图
【参数】
<30-3600>:访问次数,默认600。
【举例】
# 设置cc防护检测时长内的访问次数为500。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy} cc-defend access-times 500
application-hide {enable | disable} 启用/禁用应用隐藏功能。
【命令】
application-hide {enable | disable}
【缺省情况】
缺省情况下,默认是禁用的。
【视图】
WEB防护配置视图
【参数】
enable:启用。
disable: 禁用。
【举例】
# 开启WEB防护策略test的应用隐藏功能。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#application-hide enable
application-hide {server | x-powered-by} 配置隐藏Server或X-Powered-By字段。
【命令】
application-hide { server | x-powered-by }
no application-hide { server | x-powered-by }
【视图】
WEB防护配置视图
【参数】
server :隐藏server字段。
x-powered-by:隐藏x-powered-by字段。
【举例】
# 应用隐藏配置隐藏server字段。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#application-hide server
application-hide replace {4xx | 5xx} 配置替换4xx或5xx错误页面。
【命令】
application-hide replace { 4xx | 5xx }
no application-hide replace { 4xx | 5xx }
【视图】
WEB防护配置视图
【参数】
4xx:错误码为4xx的页面
5xx:错误码为5xx的页面
【举例】
# 应用隐藏配置替换4xx错误码的页面。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#application-hide replace 4xx
anti-tamper start-url URL 防篡改前缀url配置。
【命令】
anti-tamper start-url URL
【视图】
WEB防护策略视图
【参数】
URL:前缀url。
【使用指导】
前缀url必须以“/”开头
【举例】
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#anti-tamper start-url /
anti-tamper exception-url 配置防篡改例外url。
【命令】
anti-tamper exception-url URL
【参数】
URL:例外url。
【视图】
WEB防护策略视图
【使用指导】
例外url必须以“/”开头
【举例】
# 配置例外url为/192.168.24.26。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#anti-tamper exception-url /192.168.24.26
anti-tamper {enable | disable } 启用/禁用防篡改功能。
【命令】
anti-tamper { enable | disable }
【缺省情况】
缺省情况下,默认是禁用的。
【视图】
WEB防护配置视图
【参数】
enable:启用。
Disable: 禁用。
【举例】
# 开启WEB防护策略test下的网页防篡改功能。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#anti-tamper enable
anti-tamper tip 配置防篡改阻断提示信息。
【命令】
anti-tamper tip LINE
【参数】
LINE:阻断提示信息。
【视图】
WEB防护策略视图
【举例】
# 配置防篡改阻断提示信息为Webpage exception。
host# configure terminal
host(config)# web-defend policy test
host(config-web-defend-policy)#anti-tamper tip Webpage exception
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!