C
CrowdSec7mo ago
b_d0n

Question about notifications

Does crowdsec offer what domain is being targeted for its notifications? Using npmplus the logs are now combined into one access.log making it impossible too know what’s being targeted and causing the ban
51 Replies
CrowdSec
CrowdSec7mo 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_d0nOP7mo ago
Would it be target_fqdn
blotus
blotus7mo ago
Looking at the npmplus parser (https://app.crowdsec.net/hub/author/ZoeyVid/log-parsers/npmplus-logs), the target domain will be stored in evt.Meta.target_fqdn. You can update your notification template to add this information with {{ GetMeta . "target_fqdn"}}
CrowdSec Console
Hub configuration
Use CrowdSec Console to visualize security data, manage dynamic blocklists, and gain real-time intelligence on IPs. Enhance your threat response capabilities.
blotus
blotus7mo ago
b_d0n
b_d0nOP7mo ago
I currently don’t use the crowdsec templates, I use notifiarr. Will this still be possible on there end?
blotus
blotus7mo ago
I don't know how notifiarr works :/ How does it get the information from crowdsec ?
b_d0n
b_d0nOP7mo ago
No description
b_d0n
b_d0nOP7mo ago
I cut out the api key of course
blotus
blotus7mo ago
ok so you send everything, good the FQDN will be in events[].meta[] It's a list of key and value, the key will value will be target_fqdn It might be a bit awkward to extract tho
b_d0n
b_d0nOP7mo ago
how can i manually test if the notifications are getting the target_fqdn now? i assume something like
sudo cscli decisions add --ip 192.168.1.1 --duration 24h --reason "web bruteforce"
sudo cscli decisions add --ip 192.168.1.1 --duration 24h --reason "web bruteforce"
wont work would the reason need too be changed? So my example notifications are currently showing target_fqdn as my wan ip is this normal for http-bad-user-agent scenario?
blotus
blotus7mo ago
not normal no, what does cscli alerts inspect -d <alert_id> shows ? Also, you can replay a notification with cscli notifications reinject <alert_id>
b_d0n
b_d0nOP7mo ago
No description
blotus
blotus7mo ago
There are 2 IPs in the alert: - source_ip - target_fqdn Just to confirm, source_ip is your IP and target_fqdn is the IP of your webserver ?
b_d0n
b_d0nOP7mo ago
Shows my wan ip where I marked out
blotus
blotus7mo ago
(your IP or the IP of the client that made the requests)
b_d0n
b_d0nOP7mo ago
I don’t recognize the source ip, I assumed that was where the attack came from, the target_fqdn is showing my public wan ip “why I marked it out” Yeah the source ip is showing as sharktech “where the attack came from”
blotus
blotus7mo ago
ok so that could be normal, the client probably queried the IP directly, without setting any host header I was confused when you said "WAN IP" (ie, the parser somehow got confused and took the client IP as the target fqdn)
b_d0n
b_d0nOP7mo ago
So it didn’t target a specific host, and it targeted the whole ip? How could I test it for a specific host too see if it’s getting the correct fqdn? Without waiting? I tried using my Authentik-bf by banning my phone with multiple login fails but that didn’t seem too give me a target fqdn either
blotus
blotus7mo ago
if you want, you can trigger an alert yourself (careful, you will get banned, so maybe stop your bouncer first) with something like curl https://<your_domain>/util/php/eval-stdin.php
b_d0n
b_d0nOP7mo ago
Would it have to be curl or could I just type that into a search bar on my phone?
blotus
blotus7mo ago
Authentik-bf works by reading the logs of authentik, so there's no domain information in it (the domain is extracted from the nginx logs) you can do it from your phone
b_d0n
b_d0nOP7mo ago
I will try that now then Will doing cscli decisions list show the ban so I can remove it like normal?
blotus
blotus7mo ago
yes
b_d0n
b_d0nOP7mo ago
Thank you That showed the target_fqdn as the domain name I used in the snippet you provided so I assume all is working correctly? If so this can be marked as closed
iiamloz
iiamloz7mo ago
Yes so it will show when the key exists, by default its an empty string.
b_d0n
b_d0nOP7mo ago
So by default if it’s not a host direct attack it’ll revert to the wan ip?
blotus
blotus7mo ago
yes basically, nginx will use the host header value as the target fqdn (it's not exactly that, but close enough 99% of the time)
iiamloz
iiamloz7mo ago
Typically this only happens when a bot is crawling directly to your WAN, you should setup a server_name _; which is the default which should either redirect to your fqdn or deny them.
b_d0n
b_d0nOP7mo ago
I’m not sure I follow? Is this something I missed in my setup? Is this in the docs?
iiamloz
iiamloz7mo ago
This is nginx configuration im talking about not crowdsec. maybe I just presumed you was using nginx. ahh npmplus
b_d0n
b_d0nOP7mo ago
I’m using npmPLUS Is this still achievable?
iiamloz
iiamloz7mo ago
there should be an option in npm that sets the default if no host is found its in the gui somewhere
b_d0n
b_d0nOP7mo ago
I’ve never seen it. I guess I can ask the dev
b_d0n
b_d0nOP7mo ago
But what goes into there? I thought that was just a landing page?
iiamloz
iiamloz7mo ago
Yeah but most likely you will want to do 404 or redirect as typically you dont expect someone to go directly to your WAN
b_d0n
b_d0nOP7mo ago
So just set that as a 404 page?
iiamloz
iiamloz7mo ago
Yes
b_d0n
b_d0nOP7mo ago
Hmm NPMplus has a new option drop connection
No description
iiamloz
iiamloz7mo ago
Well either option is fine, I believe both will still end up in the log files so either way it will still trigger a notification with the WAN in if they go directly to it
b_d0n
b_d0nOP7mo ago
So now it’ll show my npm fqdn instead of the wan ip for the target_fqdn? Or am I still not following
iiamloz
iiamloz7mo ago
it will show as long as they go to your FQDN, if they go directly to your WAN then there nothing you can really do about it
b_d0n
b_d0nOP7mo ago
Ok thanks Loz while I got u here, I know it’s not a thread for it, but is there any updates on UniFi working?
iiamloz
iiamloz7mo ago
The syslog acquisition "fix" got merged for 1.6.6 then once that is released, I can then move my attention to the parser itself
b_d0n
b_d0nOP7mo ago
So likely the release after
iiamloz
iiamloz7mo ago
The hub updates can happen at any time so it not dependant on the CS release, it just to get the syslog acqusition to work we had to add an option to disable the magic parsers
b_d0n
b_d0nOP7mo ago
Ok nice I’ll note the current version and keep an update. Is there an option on the hub to be notified when there’s an update?
iiamloz
iiamloz7mo ago
If you follow the issue I will tag it when any fixes are being worked on or merged you get a notification from GH
b_d0n
b_d0nOP7mo ago
#940
iiamloz
iiamloz7mo ago
Yep
CrowdSec
CrowdSec7mo ago
Resolving Question about notifications This has now been resolved. If you think this is a mistake please run /unresolve

Did you find this page helpful?