crowdsec and generator fixes

This commit is contained in:
bunkerity 2021-06-03 17:44:12 +02:00
parent d2135c19c0
commit 4b31d005eb
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
4 changed files with 10 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<p align="center">
<img src="https://img.shields.io/badge/bunkerized--nginx-1.2.5-blue" />
<img src="https://img.shields.io/badge/nginx-1.20.0-blue" />
<img src="https://img.shields.io/badge/nginx-1.20.1-blue" />
<img src="https://img.shields.io/github/last-commit/bunkerity/bunkerized-nginx" />
<img src="https://img.shields.io/github/workflow/status/bunkerity/bunkerized-nginx/Automatic%20test?label=automatic%20test" />
<img src="https://img.shields.io/docker/cloud/build/bunkerity/bunkerized-nginx" />

View File

@ -130,10 +130,6 @@ git_secure_clone https://github.com/crowdsecurity/lua-cs-bouncer.git 3c235c813fc
cd lua-cs-bouncer
mkdir /usr/local/lib/lua/crowdsec
cp lib/*.lua /usr/local/lib/lua/crowdsec
mkdir /opt/crowdsec
cp template.conf /opt/crowdsec/crowdsec.conf
sed -i 's/^API_URL=.*/API_URL=%CROWDSEC_HOST%/' /opt/crowdsec/crowdsec.conf
sed -i 's/^API_KEY=.*/API_KEY=%CROWDSEC_KEY%/' /opt/crowdsec/crowdsec.conf
sed -i 's/require "lrucache"/require "resty.lrucache"/' /usr/local/lib/lua/crowdsec/CrowdSec.lua
sed -i 's/require "config"/require "crowdsec.config"/' /usr/local/lib/lua/crowdsec/CrowdSec.lua
cd /tmp

View File

@ -0,0 +1,5 @@
API_URL={{ CROWDSEC_HOST }}
API_KEY={{ CROWDSEC_KEY }}
LOG_FILE=/tmp/lua_mod.log
CACHE_EXPIRATION=1
CACHE_SIZE=1000

View File

@ -34,6 +34,10 @@ class Templator :
if type == "site" and self.__config_global["MULTISITE"] == "yes" :
site_config = copy.deepcopy(self.__config_sites[first_server])
real_config.update(site_config)
elif type == "global" and self.__config_global["MULTISITE"] == "yes" and self.__config_global["SERVER_NAME"] != "" :
for k, v in self.__config_sites.items() :
for k2, v2 in v.items() :
real_config[k + "_" + k2] = v2
if not server_name is None :
real_config["SERVER_NAME"] = server_name
if not first_server is None :