1、插件作用
判断请求参数是否有确定的值,如果存在,则拒绝服务。
用于拦截恶意访问行为。
2、核心代码
local function decideUriExists(uri_value_tab,uri_key_tab)
local exists = true
local args = ngx.req.get_uri_args()
for i = 1, #uri_value_tab do
local local_uri_value = uri_value_tab[i]
local local_uri_key = uri_key_tab[i]
local sub_uri_key_tab = setmetatable(pl_stringx.split(local_uri_key, ";"), nil)
local sub_uri_value_tab = setmetatable(pl_stringx.split(local_uri_value, ";"), nil)
local sub_exists = true
for j = 1, #sub_uri_key_tab do
-- decide whether key uri begin with start(*)
local sub_uri_key = sub_uri_key_tab[j]
local is_prefix_start = false
if ('*' == string.sub(sub_uri_key,1,1)) then
is_prefix_start = true
sub_uri_key = string.sub(sub_uri_key,2)
end
-- ngx.log(ngx.ERR,'=sub_uri_key is:=' .. sub_uri_key .. '=end=')
local http_uri_arg_value = args[sub_uri_key]
local sub_uri_value = sub_uri_value_tab[j]
local idx_end = nil
if (is_prefix_start == true and http_uri_arg_value ~= nil) then
_,idx_end = string.find(string.lower(http_uri_arg_value),string.lower(sub_uri_value))
end
-- no specified key with value,then permit this request
if (http_uri_arg_value == nil or http_uri_arg_value == "") then
sub_exists = false
break
elseif (is_prefix_start and idx_end ~= nil and idx_end >= 1) then
-- Nothing to do
elseif (not is_prefix_start and string.lower(sub_uri_value) == string.lower(http_uri_arg_value)) then
-- Nothing to do
else
sub_exists = false
break
end
end
-- decide inner for whether it's false,then break the outer for
if (sub_exists == true) then
exists = true
break
else
exists = false
end
end
return exists
end
3、配置使用
配置示例如下:
uri_key=>*key1;key2;key3
uri_value=>valu1;value2;value3
【温馨提示】
如果您觉得满意,可以选择支持下,您的支持是我最大的动力:
分享到:
相关推荐
要将CI作为GitHub Action在CI上运行,请参阅cargo-deny-action。 快速入门货物安装拒绝货物&&货物拒绝初始化&&货物拒绝检查用法安装货物拒绝货物安装货物拒绝##或者,如果您是Arch用户yay -S货物拒绝初始化您的...
另外,ACL的默认动作在各业务模块应用 ACL 时各有不同,而前缀列表默认动作为 deny。 3. 路由策略的应用 路由策略广泛应用于路由选择和控制领域,可以实现路由筛选、路由优先级设置、路由反射等功能。路由策略可以...
在路由策略末尾有一个隐含的“deny any” 声明,这个 deny 的后继操作取决于这个路由策略是如何使用的。 华为公司使用路由策略.pptx 对路由策略的概念、特点、配置任务等进行了详细的介绍,为企业管理和网络管理员...
标题中的"PyPI 官网下载 | find2deny-0.1.12.tar.gz"表明这是一个在Python Package Index(PyPI)上发布的开源软件包。PyPI是Python社区广泛使用的资源库,开发者可以在这里发布自己的Python软件包,供其他用户下载...
在文件名"cargo-deny-main"中,"main"通常代表项目的主分支或主要代码库。这可能是一个仓库的克隆,包含了cargo-deny的源代码和资源,供开发者编译、测试或进一步开发使用。 总的来说,cargo-deny是Rust开发者的...
- **定义if-match子句**:例如,用if-match as-path、if-match community、if-match ip address、if-match interface、if-match ip next-hop等命令来指定匹配条件。 理解并熟练运用路由策略与引入要点对于网络管理...
禁止用户drop database策略设计 程序开发
4. 一旦找到匹配的路由策略,系统会立即应用并停止后续检查,类似于ACL中的“first match wins”原则。 5. if-match语句可以包含多个条件,逻辑上是“或”的关系,意味着只要满足其中一个条件即可。而在同一策略中的...
- **配置匹配规则**:接着,使用`if-match`语句定义匹配条件,如`if-match acl 2000`。 - **配置应用动作**:通过`apply`命令指定当路由信息满足匹配条件时应执行的操作,如`apply cost 10`。 - **验证Route-Policy*...
描述中提到的"X-Frame-Options头缺失 in a frame because it set 'X-Frame-Options' to 'deny'",意味着在某个特定的场景下,一个网页没有设置X-Frame-Options头,或者设置了值为'deny'的X-Frame-Options头,这表明...
这是一个适用于 Mozilla Firefox 和 Google Chrome 的浏览器插件,它会自动拒绝具有 GDPR 样式 cookie 同意提示的站点的 cookie。 还支持将新站点列入白名单并将新站点添加到配置中。
- If-match语句之间的匹配顺序按照配置顺序进行,报文匹配if-match语句后,是否执行对应的behavior动作取决于if-match语句之间的逻辑关系(And或Or)。 通过以上详细介绍,我们可以看到华为端口镜像ACL流过滤技术...
实验一:配置/etc/hosts.allow及/etc/hosts.deny 一、实验目的 了解/etc/hosts.allow与/etc/hosts.deny 掌握/etc/hosts.allow与/etc/hosts.deny的配置 二、实验内容与步骤 简介 /etc/hosts.allow与/etc/hosts.deny...
使用 geoip 查找和 OpenLayers 3 映射被拒绝主机 IP 的位置。 该产品包括由 MaxMind 创建的 GeoLite2 数据,可从。 ##Setup 重命名和编辑配置文件 mv config_SAMPLE.py config.py ... python map-deny.py
Route-Map 同 access-list 一样,最后都有隐含的 deny all,因此需要注意在配置 Route-Map 时,需要明确地配置 permit 语句,以免出现不必要的阻止。 三、route-map 语句顺序号 在编辑 Route-Map 时,如不注明 ...
if-match acl 3001 #将ACL于流分类关联 traffic behavior visitor1 #创建流行为 deny #行为是拒绝 traffic policy visitor2 #创建流策略 classifier visitor behavior visitor1 #将流分类和流行为关联 ...
Router(Config)# access-list 110 deny icmp any any mask-request Router(Config)# access-list 110 permit icmp any any ! Inbound ICMP Control Router(Config)# access-list 111 permit icmp any any echo ...
Order allow,deny Allow from all # 动态请求转发给WebLogic $"> SetHandler weblogic-handler ``` 在这个配置中,Apache会处理静态内容,而动态内容(如`.jsp`文件)则由WebLogic Server处理。通过这种...
class-map match-all DENY-ATTACK match protocol http url "*.ida*" match protocol http url "*cmd.exe*" match protocol http url "*root.exe*" match protocol http url "*readme.eml*" ! policy-map Aiko class...
当来自以太网口Ethernet3/0/0的报文到达时,它们将首先尝试匹配5号节点中的`if-match`子句。如果匹配成功,则执行相应的`apply`子句;如果匹配失败或匹配到`deny`语句,则退出策略路由处理,并按照常规路由方式进行...