Closed baudneo closed 2 years ago
I will add some additional info.
crowdsec.lua
is located in /etc/nginx/lualib/
plugins/*.lua
are located /etc/nginx/lualib/
/etc/nginx/conf.d/crowdsec_openresty.conf
lua_package_path '/etc/nginx/lualib/plugins/crowdsec/?.lua;;';
lua_shared_dict crowdsec_cache 50m;
lua_ssl_trusted_certificate /etc/ssl/certs/GTS_Root_R1.pem;
init_by_lua_block {
cs = require "crowdsec"
local ok, err = cs.init("/data/crowdsec/crowdsec-openresty-bouncer.conf", "crowdsec-openresty-bouncer/v0.1.10")
if ok == nil then
ngx.log(ngx.ERR, "[Crowdsec] " .. err)
error()
end
if ok == "Disabled" then
ngx.log(ngx.ALERT, "[Crowdsec] Bouncer Disabled")
else
ngx.log(ngx.ALERT, "[Crowdsec] Initialisation done")
end
}
access_by_lua_block {
local cs = require "crowdsec"
cs.Allow(ngx.var.remote_addr)
}
I have not been able to track down what the issue is. When I turn debug level logging on for crowdsec.log the parsers drown it out. I will keep grep and searching the logs for clues. Since crowdsec is reporting the broken pipe I am assuming it is the openresty/lua bouncer that is closing the request? It never gets past sending startup=true while in STREAM mode.
I had installed lua-resty-http plugin as well, which caused all the errors I found. Everything is working as it should be now that plugin is removed.
I am running the latest commit build with the SSL_CERTS_PATH PR. After more debugging it seems that 'live' mode works while 'stream' mode does not.
Running nginx proxy manager and integrating the bouncer into the docker image. Everything seems to be installed correctly. On the lua/openresty end the logs have this ->
On the crowdsec LAPI end the logs have broken pipe errors -<
So the bouncer is sending the startup request to LAPI but the connection is broken. Is it something to do with the ngx.timer? I dont know Lua but I tried to do some debugging. I added some debugging lines just to make sure the ip is correct and so is the request to LAPI. All seems well its just this tcp connection seems to break as soon as the request is sent off?
cscli bouncers list
shows that the openresty bouncer is 'updating' every X seconds but it never gets past sending the first startup=true query. How can I help debug this further?The cs instance initializes, the config file parsers and it makes a request to the LAPI, so I am assuming its installed correctly.