jobs - various bugs fixed and old files removed
This commit is contained in:
@@ -15,6 +15,10 @@ end
|
||||
-- let's encrypt
|
||||
local use_lets_encrypt = {% if AUTO_LETS_ENCRYPT == "yes" %}true{% else %}false{% endif +%}
|
||||
|
||||
-- redis
|
||||
local use_redis = {% if USE_REDIS == "yes" %}true{% else %}false{% endif +%}
|
||||
local redis_host = "{{ REDIS_HOST }}"
|
||||
|
||||
-- external blacklists
|
||||
local use_user_agents = {% if BLOCK_USER_AGENT == "yes" %}true{% else %}false{% endif +%}
|
||||
local use_proxies = {% if BLOCK_PROXIES == "yes" %}true{% else %}false{% endif +%}
|
||||
@@ -64,6 +68,7 @@ local recaptcha = require "recaptcha"
|
||||
local iputils = require "resty.iputils"
|
||||
local behavior = require "behavior"
|
||||
local logger = require "logger"
|
||||
local redis = require "resty.redis"
|
||||
|
||||
-- user variables
|
||||
local antibot_uri = "{{ ANTIBOT_URI }}"
|
||||
@@ -139,6 +144,17 @@ if use_bad_behavior and behavior.is_banned() then
|
||||
ngx.exit(ngx.HTTP_FORBIDDEN)
|
||||
end
|
||||
|
||||
-- our redis client
|
||||
local redis_client = nil
|
||||
if use_redis then
|
||||
redis_client = redis:new()
|
||||
local ok, err = redis_client:connect(redis_host, 6379)
|
||||
if not ok then
|
||||
redis_client = nil
|
||||
logger.log(ngx.ERR, "REDIS", "Can't connect to the Redis service " .. redis_host)
|
||||
end
|
||||
end
|
||||
|
||||
-- check if IP is in proxies list
|
||||
if use_proxies then
|
||||
local value, flags = ngx.shared.proxies_data:get(iputils.ip2bin(ngx.var.remote_addr))
|
||||
|
||||
Reference in New Issue
Block a user