moved UA, referrer and country check after whitelist and blacklist check

This commit is contained in:
bunkerity 2020-12-04 22:58:48 +01:00
parent 26947179a4
commit 95153dbc5d
No known key found for this signature in database
GPG Key ID: 654FFF51CEF7CC47
1 changed files with 15 additions and 15 deletions

View File

@ -37,21 +37,6 @@ if use_whitelist_reverse and whitelist.reverse_cached_ok() then
ngx.exit(ngx.OK)
end
-- check if user-agent is allowed
if use_user_agent and ngx.var.bad_user_agent == "yes" then
ngx.exit(ngx.HTTP_FORBIDDEN)
end
-- check if referrer is allowed
if use_referrer and ngx.var.bad_referrer == "yes" then
ngx.exit(ngx.HTTP_FORBIDDEN)
end
-- check if country is allowed
if use_country and ngx.var.allowed_country == "no" then
ngx.exit(ngx.HTTP_FORBIDDEN)
end
-- check if already in blacklist cache
if use_blacklist_ip and blacklist.ip_cached_ko() then
ngx.exit(ngx.HTTP_FORBIDDEN)
@ -93,6 +78,21 @@ if use_blacklist_reverse and not blacklist.reverse_cached() then
end
end
-- check if user-agent is allowed
if use_user_agent and ngx.var.bad_user_agent == "yes" then
ngx.exit(ngx.HTTP_FORBIDDEN)
end
-- check if referrer is allowed
if use_referrer and ngx.var.bad_referrer == "yes" then
ngx.exit(ngx.HTTP_FORBIDDEN)
end
-- check if country is allowed
if use_country and ngx.var.allowed_country == "no" then
ngx.exit(ngx.HTTP_FORBIDDEN)
end
-- check if IP is in DNSBLs (only if not in cache)
if use_dnsbl and not dnsbl.cached() then
if dnsbl.check() then