Closed quantranhong1999 closed 5 months ago
@thanhbv200585 please research the topic and make a proposal about the list of tasks (could think more or less than the above tasks if needed) with basic ticket details first.
query mode ip
API looks like what we want
https://doc.crowdsec.net/docs/local_api/bouncers#query-mode--ip
Task proposal:
Task proposal:
* ADR * Create a SMTP EHLO hook questionning via a REST call the CrowdSec local agent
Not only SMTP, IMAP/POP also
* Create a mailet questionning via a REST call the CrowdSec local agent * Create a mailet to provision local CrowdSec database (for highest level of spam for instance) (https://doc.crowdsec.net/docs/local_api/bouncers#query-mode--ip) * Think about the interfaces we would need to question CrowdSec upon incoming IMAP connections (check a mail used for spam) * Externalize behaviour linked to failed login attempts (sleep, 3 failure connection closure) as configurable extensible - plugins. * Use it to manage IP reporting to crowdSec, especially upon failed authentications (~fail2ban).
Task proposal:
Basic details for each task, and are there any possible tasks?
Two distincts plugins:
I didn't have time to really have a look myself tbh, but I would think you would need first to implement a client to communicate with crowdsec, which would force you to implement a docker extension for testing too
(later) one to push information to Crowdsec (~fail2ban)
Do you suggest letting CrowdSec access the James logs, or we let James push directly alerts/decisions via CrowdSec HTTP API?
It's easy to write the first plugin: Lemonldap-NG plugin as example
(later) one to push information to Crowdsec (~fail2ban)
I succeeded to report IP via HTTP API directly Screencast from 21-09-2023 14:35:08.webm
or we let James push directly alerts/decisions via CrowdSec HTTP API?
This one eliminate the need to plug James logs to crowdsec and might save headaches with fluentbit / loki...
Rene:
This one eliminate the need to plug James logs to crowdsec and might save headaches with fluentbit / loki...
You mean implement the magic on our side about if we should ban an IP or not and just report to crowdsec? I feel it would be more of an headache than just letting crowdsec scraping our logs and doing the magic itself that he is supposed to know to do well already, no? It would mean you need to track all failed attempts (like with Redis?)
I would be more interested to know if we can just report via HTTP API to crowdsec IPs that are failing to login and if crowdsec is able to detect many reports of failed attempts from a same IP from us and act in consequence?
(later) one to push information to Crowdsec (~fail2ban)
Can we have more detail on that? I'm not sure if it means we do the magic implementation of determining ourselves which IPs to ban, or if we just tell crowdsec this IP failed to login and let crowdsec take the decision after a couple of similar reports... (joins my previous point)
Looks confusing to me (and the team)
Propose other tasks:
For @thanhbv200585 trying to parse James' logs and build a CrowdSec attack scenario - would need to write a log parser https://docs.crowdsec.net/docs/concepts#parsers to parse James' logs.
Seems not easy to me, but let's try :)
FYI, CrowdSec supports
Missing SMTP though. If we want a no-code solution, and not only for TMail but for other services as well, we have the choice :-)
Integrate Crowdsec modules into TMail backend
Why not James?
CrowdSec is a free, modern & collaborative behavior detection engine, coupled with a global IP reputation network, based on AI behaviour refinement.
Develop a third-party plugin in James for questionning CrowdSec:
rf: https://issues.apache.org/jira/browse/JAMES-3897, https://github.com/linagora/tmail-backend/issues/803
cc @guimard @chibenwa