C
CrowdSec10mo ago
hhf

Need an insight for cloudflare tunnels --->> Nginx ---->> Website

Everything is working perfectly but alerts are not pop up. SystemOS- Ubuntu 24.04 Nginx version is 1.26.2
150 Replies
CrowdSec
CrowdSec10mo ago
Important Information
Thank you for getting in touch with your support request. To expedite a swift resolution, could you kindly provide the following information? Rest assured, we will respond promptly, and we greatly appreciate your patience. While you wait, please check the links below to see if this issue has been previously addressed. If you have managed to resolve it, please use run the command /resolve or press the green resolve button below.
Log Files
If you possess any log files that you believe could be beneficial, please include them at this time. By default, CrowdSec logs to /var/log/, where you will discover a corresponding log file for each component.
Guide Followed (CrowdSec Official)
If you have diligently followed one of our guides and hit a roadblock, please share the guide with us. This will help us assess if any adjustments are necessary to assist you further.
Screenshots
Please forward any screenshots depicting errors you encounter. Your visuals will provide us with a clear view of the issues you are facing.
© Created By WhyAydan for CrowdSec ❤️
iiamloz
iiamloz10mo ago
As stated can you provide some information like cscli metrics or what you mean by alerts are not pop up
hhf
hhfOP10mo ago
sure will provide you the details
hhf
hhfOP10mo ago
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
current nginx status
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
Can you check your /etc/nginx/nginx.conf has a include /etc/nginx/conf.d/*.conf; line (a line similar to include it)
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
also from the alert generation point of view within the acquisition there is no nginx logs, can you check /etc/crowdsec/acquis.yaml has a line for nginx logs
hhf
hhfOP10mo ago
yes its there
hhf
hhfOP10mo ago
current status
No description
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
/etc/crowdsec/acquis.yaml has a line for nginx logs
iiamloz
iiamloz10mo ago
but it only has the error log line, so what files do you see in /var/log/nginx/?
hhf
hhfOP10mo ago
do i have to add access log line also? you are correct it only has error log
iiamloz
iiamloz10mo ago
Yes, dont know why it wasnt picked up, maybe nginx didnt generate it before crowdsec was installed but you can just add it manually
hhf
hhfOP10mo ago
just to be sure
#Generated acquisition file - wizard.sh (service: nginx) / files : /var/log/nginx/error.log
filenames:
- /var/log/nginx/error.log
- /var/log/nginx/access.log
labels:
type: nginx
---
#Generated acquisition file - wizard.sh (service: nginx) / files : /var/log/nginx/error.log
filenames:
- /var/log/nginx/error.log
- /var/log/nginx/access.log
labels:
type: nginx
---
iiamloz
iiamloz10mo ago
and for the bouncer itself can you check /var/log/nginx/error.log if there are any entries for runtime errors
hhf
hhfOP10mo ago
still nothing
iiamloz
iiamloz10mo ago
and do you see anything if you nginx -t
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
and cscli bouncers list
hhf
hhfOP10mo ago
everything it to the T.
No description
hhf
hhfOP10mo ago
its 72 hours working on this. did all the permutation and combinations. 4 VM;s scraped. and today i can to you guys. i generally avoid posting and prefer to read on but i didn't get any ref so.
iiamloz
iiamloz10mo ago
hmm odd we dont see the other nginx with number, could you run:
cscli bouncers delete crowdsec-nginx-bouncer
cscli bouncers add crowdsec-nginx-bouncer
cscli bouncers delete crowdsec-nginx-bouncer
cscli bouncers add crowdsec-nginx-bouncer
Then copy the key that is generated and add it to /etc/crowdsec/bouncers/crowdsec-nginx-bouncer.conf
hhf
hhfOP10mo ago
give me a sec. will do that hands on
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
Did you add the key to /etc/crowdsec/bouncers/crowdsec-nginx-bouncer.conf?
hhf
hhfOP10mo ago
yes
iiamloz
iiamloz10mo ago
Okay now run nginx -t && nginx -s reload
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
hmm
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
okay can you run grep "listen" /etc/crowdsec/config.yaml
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
okay the url is wrong in nginx bouncer config, you need to put http://127.0.0.1:8089 if you want to use appsec that is a different option APPSEC_URL=http://127.0.0.1:7422
hhf
hhfOP10mo ago
basically i want that if some types https://url/.env to be blocked
iiamloz
iiamloz10mo ago
Yeah you just need to add APPSEC_URL=http://127.0.0.1:7422
hhf
hhfOP10mo ago
in config.yaml ?
iiamloz
iiamloz10mo ago
no in bouncers/crowdsec-nginx-bouncer.conf
hhf
hhfOP10mo ago
its there
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
no you are setting API_URL not APPSEC_URL
hhf
hhfOP10mo ago
ohh my lord
iiamloz
iiamloz10mo ago
API_URL must be set the crowdsec lapi port which is 8089 in your case
hhf
hhfOP10mo ago
api url should be 8089
iiamloz
iiamloz10mo ago
ye
hhf
hhfOP10mo ago
damm
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
still nothing
iiamloz
iiamloz10mo ago
the url is /.env/ it must match /.env you might have a directory redirect on wordpress
hhf
hhfOP10mo ago
any other scenarios i can test
hhf
hhfOP10mo ago
yesterday i tested your given example it worked
No description
iiamloz
iiamloz10mo ago
Yes you can curl -X POST --data "0x[]" <your_url>
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
did you nginx -t && nginx -s reload after updating the config?
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
okay and cscli bouncers list
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
okay and 100% there is a include line in the nginx.conf?
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
okay and run nginx -T | grep include
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
it shouldnt make a difference but could you put the conf.d include line above the sites enabled line
hhf
hhfOP10mo ago
sure why not
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
then nginx -t && nginx -s reload
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
then if you send a request to the server?
hhf
hhfOP10mo ago
yes the same command you gave
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
its definitely hitting logs with my public ip
iiamloz
iiamloz10mo ago
Could we just try a restart of the nginx service incase the main pid is stuck systemctl restart nginx
hhf
hhfOP10mo ago
done
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
did curl again a hit
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
nothing here
iiamloz
iiamloz10mo ago
can you list /etc/nginx/modules-enabled/
hhf
hhfOP10mo ago
iiamloz
iiamloz10mo ago
as I dont see
$ cat /etc/nginx/modules-enabled/50-mod-http-lua.conf
load_module modules/ngx_http_lua_module.so;
$ cat /etc/nginx/modules-enabled/50-mod-http-lua.conf
load_module modules/ngx_http_lua_module.so;
as this is what loads the lua module, however, I would expect nginx to throw an error if this module doesnt exist
hhf
hhfOP10mo ago
iiamloz
iiamloz10mo ago
okay, then try apt list --installed libnginx-mod-http-lua
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
yeah modules-available != modules-enabled, we need to see if the lua module is actually installed
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
😦
iiamloz
iiamloz10mo ago
can you run apt install libnginx-mod-http-lua
hhf
hhfOP10mo ago
i did
ln -s /usr/share/nginx/modules-available/mod-ndk-http-module.conf 50-mod-ndk-http-module.conf
ln -s /usr/share/nginx/modules-available/mod-ngx-lua-module.conf 50-mod-ngx-lua-module.conf
ln -s /usr/share/nginx/modules-available/mod-ndk-http-module.conf 50-mod-ndk-http-module.conf
ln -s /usr/share/nginx/modules-available/mod-ngx-lua-module.conf 50-mod-ngx-lua-module.conf
iiamloz
iiamloz10mo ago
yeah symlinking doesnt matter the underlying library is not installed
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
Yeah that is missing, it should be installed
hhf
hhfOP10mo ago
i should run this
iiamloz
iiamloz10mo ago
ye
hhf
hhfOP10mo ago
okay done
iiamloz
iiamloz10mo ago
and try nginx -t to see if the previous symlink might cause a failure
hhf
hhfOP10mo ago
yes
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
can you ensure this file also exists
$ cat /etc/nginx/modules-enabled/10-mod-http-ndk.conf
load_module modules/ndk_http_module.so;
$ cat /etc/nginx/modules-enabled/10-mod-http-ndk.conf
load_module modules/ndk_http_module.so;
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
no
iiamloz
iiamloz10mo ago
Okay firstly make sure /usr/share/nginx/modules/ngx_http_lua_module.so exists oops wrong file I meant /usr/share/nginx/modules/ndk_http_module.so
hhf
hhfOP10mo ago
no issues
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
No please read the file path, you are looking in modules-available
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
my bad
iiamloz
iiamloz10mo ago
Okay so we got both modules
hhf
hhfOP10mo ago
eyes are a bit sore of trying will get a coffee its an imp project for our company
iiamloz
iiamloz10mo ago
can you run these commands:
cd /etc/nginx/modules-enabled/
ln -s /usr/share/nginx/modules-available/mod-http-ndk.conf 10-mod-http-ndk.conf
cd /etc/nginx/modules-enabled/
ln -s /usr/share/nginx/modules-available/mod-http-ndk.conf 10-mod-http-ndk.conf
then see if nginx -t gets working
hhf
hhfOP10mo ago
Give me a few mins. I really appreciate your time and help. Got up to get some coffee and freshen up
hhf
hhfOP10mo ago
No description
iiamloz
iiamloz10mo ago
and in /etc/nginx/modules-enabled/ you have both 10 and 50?
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
no 50 removed
iiamloz
iiamloz10mo ago
so ls -la /etc/nginx/modules-enabled/?
hhf
hhfOP10mo ago
No description
hhf
hhfOP10mo ago
should i scrap it and start again
iiamloz
iiamloz10mo ago
If you have the ability too, it might be easier cause it seems there something happened to the nginx itself which I cant see easily from discord
hhf
hhfOP10mo ago
sure will try and scrape it do you suggest to manually compile modules this time? rather than apt install
iiamloz
iiamloz10mo ago
Not really needed, you can just use the distro provided ones and it should work. with all those modules, which distro is this or is it a platform like plesk or cpanel?
hhf
hhfOP10mo ago
we have a list of our own modules well its a saas app i take care of the security part but couldn't integrate crowdsec with cf tunnels
iiamloz
iiamloz10mo ago
is this prod or a development box?
hhf
hhfOP10mo ago
dev its just a concept we are try for the next release i am adamant to use crowdsec long time advocate will keep you posted. if any solution comes up thanks once again for your time and efforts Great product by the way.
iiamloz
iiamloz10mo ago
Please do, I want to make sure this is resolved 👍
hhf
hhfOP10mo ago
See you around. I saw we share a lot of servers. a quick question for you: can we install bouncer manually without the lua module and build lua module separately?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
hhf
hhfOP10mo ago
Done that already It's working for clp I have a script for that when a user adds it auto adds that to it It's not working for our custom stack With tunnels Did you compile lua with apt or custom compile
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
hhf
hhfOP10mo ago
You can mix them in this way, as long as -lpcre is added ./configure --with-compat --with-ld-opt='-lpcre' --add-dynamic-module=../ngx_devel_kit-${DEVEL_KIT_VERSION} --add-dynamic-module=../lua-nginx-module-${LUA_MODULE_VERSION}
hhf
hhfOP10mo ago
No description
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
hhf
hhfOP10mo ago
they have updated. not merged with --with-ld-opt='-lpcre' you can use the older version
hhf
hhfOP10mo ago
No description
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
hhf
hhfOP10mo ago
it works wait i will give yo the compile command
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
hhf
hhfOP10mo ago
no that will not work ./configure --with-ld-opt="-Wl,-rpath,/usr/local/include/luajit-2.1" --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-pcre-jit --with-compat --with-ld-opt='-lpcre' --add-dynamic-module=/root/ngx_devel_kit-0.3.3 --add-dynamic-module=/root/lua-nginx-module-0.10.27
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
hhf
hhfOP10mo ago
hmm
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
hhf
hhfOP7mo ago
its running perfectly since a month

Did you find this page helpful?