Merge pull request #117 from thelittlefireman/patch-9

Fix lua mistake
This commit is contained in:
Bunkerity 2021-04-13 16:49:45 +02:00 committed by GitHub
commit deeb7a76a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,7 +73,7 @@ for k, v in pairs(whitelist_uri) do
ngx.log(ngx.WARN, "[WHITELIST] URI " .. v .. " is whitelisted") ngx.log(ngx.WARN, "[WHITELIST] URI " .. v .. " is whitelisted")
ngx.exit(ngx.OK) ngx.exit(ngx.OK)
end end
done end
-- check if it's certbot -- check if it's certbot
if use_lets_encrypt and string.match(ngx.var.request_uri, "^/.well-known/acme-challenge/") then if use_lets_encrypt and string.match(ngx.var.request_uri, "^/.well-known/acme-challenge/") then
@ -97,12 +97,12 @@ end
-- check if user-agent is allowed -- check if user-agent is allowed
if use_user_agent and ngx.var.bad_user_agent == "yes" then if use_user_agent and ngx.var.bad_user_agent == "yes" then
local block = false local block = false
for k, v in pairs(whitelist_user_agent) then for k, v in pairs(whitelist_user_agent) do
if string.match(ngx.var.http_user_agent, v) then if string.match(ngx.var.http_user_agent, v) then
ngx.log(ngx.WARN, "[ALLOW] User-Agent " .. ngx.var.http_user_agent .. " is whitelisted") ngx.log(ngx.WARN, "[ALLOW] User-Agent " .. ngx.var.http_user_agent .. " is whitelisted")
block = false block = false
break break
fi end
end end
if block then if block then
ngx.log(ngx.WARN, "[BLOCK] User-Agent " .. ngx.var.http_user_agent .. " is blacklisted") ngx.log(ngx.WARN, "[BLOCK] User-Agent " .. ngx.var.http_user_agent .. " is blacklisted")