C
CrowdSec9mo ago
b_d0n

appsec ip

maybe im confued but what does the ip for appsec need to be? i keep getting bind errors... im on unraid but localhost:port doesnt seem to work?
62 Replies
CrowdSec
CrowdSec9mo 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 ❤️
b_d0n
b_d0nOP9mo ago
] nginx: [error] [lua] crowdsec.lua:99: init(): APPSEC is enabled on '0.0.0.0:7422' in npm. does the ip need to be the same as the bouncer?
b_d0n
b_d0nOP9mo ago
No description
b_d0n
b_d0nOP9mo ago
set APPSEC_URL=http://0.0.0.0:7422 in my crowdsec-openrestry-bouncer.conf also set in my acquis.yaml
listen_addr: 0.0.0.0:7422
appsec_config: crowdsecurity/appsec-default
name: myAppSecComponent
source: appsec
labels:
type: appsec
listen_addr: 0.0.0.0:7422
appsec_config: crowdsecurity/appsec-default
name: myAppSecComponent
source: appsec
labels:
type: appsec
b_d0n
b_d0nOP9mo ago
No description
b_d0n
b_d0nOP9mo ago
i guess ill have to wait and see if anyone can chime in.. i suspect NPM isnt playing nice for no reason
b_d0n
b_d0nOP9mo ago
No description
iiamloz
iiamloz9mo ago
So where is NPM in relation to CrowdSec?
b_d0n
b_d0nOP9mo ago
What do u mean? I’m using lepresidentes image?
iiamloz
iiamloz9mo ago
No I mean where is crowdsec running to where NPM is running are they on the same docker subnet?
b_d0n
b_d0nOP9mo ago
Yes both running on the same docker network Crowdsec works has for years parsing logs for NPM works
iiamloz
iiamloz9mo ago
So when you defined the LAPI url in NPM did you use http://crowdsec:8080?
b_d0n
b_d0nOP9mo ago
I forgot where this is.. I setup crowdsec a ways back can u refresh me
iiamloz
iiamloz9mo ago
If you look at your crowdsec-openrestry-bouncer.conf it will say API url I think wait
b_d0n
b_d0nOP9mo ago
I used unraid-server-ip:8081
iiamloz
iiamloz9mo ago
and thats because you expose the port 8081:8080?
b_d0n
b_d0nOP9mo ago
Yes
iiamloz
iiamloz9mo ago
Okay, so can you expose the appsec port to the unraid server host? 7422:7422 for example
b_d0n
b_d0nOP9mo ago
Are u saying port forward 7422 to my unraid server via my router?
iiamloz
iiamloz9mo ago
No I am saying you need to modify the container to expose the port inside the container to the unraid host
b_d0n
b_d0nOP9mo ago
I need too add another port to the NPM container?
iiamloz
iiamloz9mo ago
No you need to add the port to the CrowdSec container
b_d0n
b_d0nOP9mo ago
Like so?
b_d0n
b_d0nOP9mo ago
No description
iiamloz
iiamloz9mo ago
Yes
b_d0n
b_d0nOP9mo ago
No change
iiamloz
iiamloz9mo ago
then on NPM side you can set the appsec_url to http://unraid-server-ip:7422
b_d0n
b_d0nOP9mo ago
Trying now
iiamloz
iiamloz9mo ago
You basically set it the same as the original lapi url but different port
b_d0n
b_d0nOP9mo ago
Listen address in acquis.yaml too then?
iiamloz
iiamloz9mo ago
the listen address should be 0.0.0.0:7422 as its a container it can bind to all interfaces
b_d0n
b_d0nOP9mo ago
cscli metrics show appsec still shows a blank engine
iiamloz
iiamloz9mo ago
have you sent a request to the web server?
b_d0n
b_d0nOP9mo ago
As in?
iiamloz
iiamloz9mo ago
Have you gone to a webpage served by NPM as it need to see a request before it shows in metrics
b_d0n
b_d0nOP9mo ago
Yes
iiamloz
iiamloz9mo ago
and if you check npm did you restart both crowdsec and npm containers?
b_d0n
b_d0nOP9mo ago
Yes but NPM is still showing the error I posted above in red
iiamloz
iiamloz9mo ago
its not an error, it just the way we log it as by default lua doesnt show any other logs than error so you see appsec enabled and the unraid-server-ip:7422? Can you check the crowdsec container that it logs that it enabled the appsec on the address
b_d0n
b_d0nOP9mo ago
[nginx ] nginx: [error] [lua] crowdsec.lua:99: init(): APPSEC is enabled on '192.168.1.50:7422' NPM log
iiamloz
iiamloz9mo ago
and the crowdsec logs?
b_d0n
b_d0nOP9mo ago
No description
b_d0n
b_d0nOP9mo ago
Success?
b_d0n
b_d0nOP9mo ago
No description
iiamloz
iiamloz9mo ago
success
b_d0n
b_d0nOP9mo ago
So will appsec have an issue with Authentik? Anything I need too addd besides the default config?
iiamloz
iiamloz9mo ago
since your using appsec-default then no, its CVE rules that shouldnt impact any application
b_d0n
b_d0nOP9mo ago
But still protects them via those rules ?
iiamloz
iiamloz9mo ago
Yes
b_d0n
b_d0nOP9mo ago
So if I go to http://server-ip/env. I should see the block?
iiamloz
iiamloz9mo ago
.env it depends because the authentik hook may run before the lua as you have a location rewrite most likely, so if all appsec are behind authentik then appsec will only enforce rules on authenticated requests.
b_d0n
b_d0nOP9mo ago
Yeah just gives 404 not found nginx
iiamloz
iiamloz9mo ago
so all your apps are behind authentik?
b_d0n
b_d0nOP9mo ago
Yes. Would u suggested a more complex appsec due to this? Wait. Not all, my overseerr for example
iiamloz
iiamloz9mo ago
we have to test an authentik setup, as users reported this in the past but couldnt replicate it as the location rewrites seems to cause an issue
b_d0n
b_d0nOP9mo ago
So is appsec obsolete in my use case for now?
iiamloz
iiamloz9mo ago
for the authentik protected routes most likely, as they need to authenticate anyways so the attack layer is quite minimal as long as your monitoring BF on authentik
b_d0n
b_d0nOP9mo ago
Security is #1. I guess I’ll have to keep an eye out and see if you guys find a fix. Should I keep appsec for now anyways?
iiamloz
iiamloz9mo ago
You can keep it live, there no impact to keep it running
b_d0n
b_d0nOP9mo ago
Is testing Authentik still on the todo?
iiamloz
iiamloz9mo ago
and if it we managed to find a solution, then you will already be setup to use it right away
b_d0n
b_d0nOP9mo ago
My thoughts exactly, just didn’t wanna be blind sided because my luck id be remote when it happened lol

Did you find this page helpful?