mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
bw - fix is_whitelisted function and fix typo in country core
This commit is contained in:
parent
a4f72f1c1e
commit
af8fa60e28
6 changed files with 75 additions and 6 deletions
|
|
@ -321,7 +321,7 @@ end
|
|||
utils.is_whitelisted = function(ctx)
|
||||
-- ngx.ctx
|
||||
if ctx and ctx.bw and ctx.bw.is_whitelisted then
|
||||
return ctx.bw.is_whitelisted
|
||||
return ctx.bw.is_whitelisted == "yes"
|
||||
end
|
||||
-- ngx.var
|
||||
if var.is_whitelisted and var.is_whitelisted == "yes" then
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ local utils = require "bunkerweb.utils"
|
|||
local country = class("country", plugin)
|
||||
|
||||
local ngx = ngx
|
||||
local get_country = utils.get_country
|
||||
local get_deny_status = utils.get_deny_status
|
||||
local decode = cjson.decode
|
||||
local get_country = cjson.get_country
|
||||
local encode = cjson.encode
|
||||
|
||||
function country:initialize(ctx)
|
||||
-- Call parent initialize
|
||||
|
|
@ -130,7 +131,7 @@ end
|
|||
function country:add_to_cache(ip, country_data, result)
|
||||
local ok, err = self.cachestore:set(
|
||||
"plugin_country_" .. self.ctx.bw.server_name .. ip,
|
||||
encode { country = country_data, result = result },
|
||||
encode({ country = country_data, result = result }),
|
||||
86400
|
||||
)
|
||||
if not ok then
|
||||
|
|
|
|||
|
|
@ -76,6 +76,60 @@
|
|||
"label": "Redis keepalive pool",
|
||||
"regex": "^[0-9]+$",
|
||||
"type": "text"
|
||||
},
|
||||
"REDIS_USERNAME": {
|
||||
"context": "global",
|
||||
"default": "",
|
||||
"help": "Redis username used in AUTH command.",
|
||||
"id": "redis-username",
|
||||
"label": "Redis username",
|
||||
"regex": "^.*$",
|
||||
"type": "text"
|
||||
},
|
||||
"REDIS_PASSWORD": {
|
||||
"context": "global",
|
||||
"default": "",
|
||||
"help": "Redis password used in AUTH command.",
|
||||
"id": "redis-password",
|
||||
"label": "Redis password",
|
||||
"regex": "^.*$",
|
||||
"type": "password"
|
||||
},
|
||||
"REDIS_SENTINEL_HOSTS": {
|
||||
"context": "global",
|
||||
"default": "",
|
||||
"help": "Redis sentinel hosts with format host:[port] separated with spaces.",
|
||||
"id": "redis-sentinel-hosts",
|
||||
"label": "Redis sentinel hosts",
|
||||
"regex": "^.*$",
|
||||
"type": "text"
|
||||
},
|
||||
"REDIS_SENTINEL_USERNAME": {
|
||||
"context": "global",
|
||||
"default": "",
|
||||
"help": "Redis sentinel username.",
|
||||
"id": "redis-sentinel-username",
|
||||
"label": "Redis sentinel username",
|
||||
"regex": "^.*$",
|
||||
"type": "text"
|
||||
},
|
||||
"REDIS_SENTINEL_PASSWORD": {
|
||||
"context": "global",
|
||||
"default": "",
|
||||
"help": "Redis sentinel password.",
|
||||
"id": "redis-sentinel-password",
|
||||
"label": "Redis sentinel password",
|
||||
"regex": "^.*$",
|
||||
"type": "password"
|
||||
},
|
||||
"REDIS_SENTINEL_MASTER": {
|
||||
"context": "global",
|
||||
"default": "",
|
||||
"help": "Redis sentinel master name.",
|
||||
"id": "redis-sentinel-master",
|
||||
"label": "Redis sentinel master",
|
||||
"regex": "^.*$",
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,6 +234,12 @@
|
|||
"name": "zlib v1.3",
|
||||
"url": "https://github.com/madler/zlib.git",
|
||||
"commit": "09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851"
|
||||
},
|
||||
{
|
||||
"id": "lua-resty-redis-connector",
|
||||
"name": "lua-resty-redis-connector v0.11.0",
|
||||
"url": "https://github.com/ledgetech/lua-resty-redis-connector.git",
|
||||
"commit": "02a29f93253d1f6ad392c5ac2b643c57e62b5979"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,22 +43,24 @@ do
|
|||
url="$(echo "$repo" | jq -r .url)"
|
||||
commit="$(echo "$repo" | jq -r .commit)"
|
||||
post_install="$(echo "$repo" | jq -r .post_install)"
|
||||
post="no"
|
||||
|
||||
echo "ℹ️ Clone ${name} from $url at commit/version $commit"
|
||||
|
||||
if [ ! -d "src/deps/src/$id" ] ; then
|
||||
do_and_check_cmd git subtree add --prefix "src/deps/src/$id" "$url" "$commit" --squash
|
||||
post="yes"
|
||||
else
|
||||
echo "⚠️ Skipping clone of $url because target directory is already present"
|
||||
echo "ℹ️ Updating ${name} from $url at commit/version $commit"
|
||||
do_and_check_cmd git subtree pull --prefix "src/deps/src/$id" "$url" "$commit" --squash
|
||||
# echo "ℹ️ Updating ${name} from $url at commit/version $commit"
|
||||
# do_and_check_cmd git subtree pull --prefix "src/deps/src/$id" "$url" "$commit" --squash
|
||||
fi
|
||||
|
||||
if [ -d "src/deps/src/$id/.git" ] ; then
|
||||
do_and_check_cmd rm -rf "src/deps/src/$id/.git"
|
||||
fi
|
||||
|
||||
if [ "$post_install" != "null" ] ; then
|
||||
if [ "$post_install" != "null" ] && [ "$post" != "no" ]; then
|
||||
echo "ℹ️ Running post install script for ${name}"
|
||||
bash -c "$post_install"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -183,6 +183,12 @@ export CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-signal"
|
|||
do_and_check_cmd make PREFIX=/usr/share/bunkerweb/deps -j "$NTASK"
|
||||
do_and_check_cmd make PREFIX=/usr/share/bunkerweb/deps LUA_LIB_DIR=/usr/share/bunkerweb/deps/lib/lua install
|
||||
|
||||
# Installing lua-resty-redis-connector
|
||||
echo "ℹ️ Installing lua-resty-redis-connector"
|
||||
export CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-redis-connector"
|
||||
do_and_check_cmd make PREFIX=/usr/share/bunkerweb/deps LUA_LIB_DIR=/usr/share/bunkerweb/deps/lib/lua install
|
||||
|
||||
# Patch modsec module
|
||||
export CHANGE_DIR="/tmp/bunkerweb/deps/misc"
|
||||
do_and_check_cmd bash -c "mv ngx_http_modsecurity_access.c /tmp/bunkerweb/deps/src/modsecurity-nginx/src/"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue