CrowdSec - the open-source and participative security solution offering crowdsourced protection against malicious IPs and access to the most advanced real-world CTI. https://crowdsec.net
Find a file
Laurence Jones ecd82ecfbd
feat: File notification plugin (#2932)
* wip: basic impl of file notification no log rotate but might now do it 🤷

* wip: ticker to 2 seconds and lower some log levels

* wip: remove redundant logrus formatter

* wip: the plugin should not handle it own data queue since the plugin process may timeout, so instead have a function that uses said context and loop whilst locking the filewriter this may not be the best way 🤷, however, I dont want multiple notifications to attempt to reopen the file if it has been rotated outside of the plugin context

* wip: impl log rotation which checks on check append, however, this may cause some issues in slow systems as the mutex lock doesnt give up until the file is rotated, however, the plugin looks for context and will give up if the plugin broker decides its timeout and will retry once the plugin has pushed again

* wip: update yaml dep

* wip: me no english great

* wip: even if the file has been rotated outside our control we should still compute the file size

* wip: improve context handling with creating a custom io writer struct which checks the context before attempting to write

* wip: used return byte count instead of calling a conversion again

* wip: actually check the enabled flag on log rotate

* wip: changed my mind, we check when we check file size

* wip: use io copy instead for memory alloc

* fix: add notification file to deb/rpm build
2024-05-15 09:21:45 +01:00
.github docker: conditionally update hub (#2948) 2024-05-15 10:04:42 +02:00
cmd feat: File notification plugin (#2932) 2024-05-15 09:21:45 +01:00
config cron: spread server load when upgrading hub and data files (#2873) 2024-03-06 13:42:57 +01:00
debian feat: File notification plugin (#2932) 2024-05-15 09:21:45 +01:00
docker docker: conditionally update hub (#2948) 2024-05-15 10:04:42 +02:00
mk Docker: allow setting BUILD_VERSION as a build argument (#2736) 2024-01-15 11:05:27 +01:00
pkg fix: add sslmode check and apend flag to conn string (#3009) 2024-05-14 17:31:15 +01:00
rpm feat: File notification plugin (#2932) 2024-05-15 09:21:45 +01:00
scripts move plugins/notifications/* to cmd/notification-* (#2429) 2023-08-24 09:46:25 +02:00
test docker: conditionally update hub (#2948) 2024-05-15 10:04:42 +02:00
windows fix lapi credentials creation for debian package (#2646) 2023-12-08 12:10:23 +01:00
.dockerignore support capi_whitelists.yaml (#2224) 2023-05-25 10:02:33 +02:00
.gitignore LAPI: local api unix socket support (#2770) 2024-03-14 10:43:02 +01:00
.gitmodules Rename directory "tests" to "test" (#2094) 2023-03-03 15:54:49 +01:00
.golangci.yml enable linter "revive" (#2978) 2024-05-02 14:22:02 +02:00
.yamllint CI: colored test output, colored crowdsec and crowdsec-api logs, full final db dump for mysql and sqlite (#1596) 2022-06-17 16:12:49 +02:00
azure-pipelines.yml use go 1.22.3 (#2994) 2024-05-13 10:01:48 +02:00
CONTRIBUTING.md "make localstack" target, link to docs/contributing (#1522) 2022-05-17 15:54:52 +02:00
Dockerfile docker: conditionally update hub (#2948) 2024-05-15 10:04:42 +02:00
Dockerfile.debian docker: conditionally update hub (#2948) 2024-05-15 10:04:42 +02:00
go.mod update go-cs-lib to 0.0.11 (#2990) 2024-05-07 13:49:19 +02:00
go.sum update go-cs-lib to 0.0.11 (#2990) 2024-05-07 13:49:19 +02:00
LICENSE CI: Cache all built go modules (#2081) 2023-02-28 17:25:09 +01:00
make_chocolatey.ps1 Update windows pipeline (#2909) 2024-03-19 17:42:08 +01:00
make_installer.ps1 Update windows pipeline (#2909) 2024-03-19 17:42:08 +01:00
Makefile CI: "make generate" target; use ent 0.12.5 (#2871) 2024-03-07 14:25:25 +01:00
README.md Typos, grammar (#1905) 2022-12-06 15:55:27 +01:00
SECURITY.md renamed security.MD -> SECURITY.md, typos (#1774) 2022-10-04 09:50:18 +02:00
wizard.sh feat: File notification plugin (#2932) 2024-05-15 09:21:45 +01:00

CrowdSec




💻 Console (WebApp) 📚 Documentation 💠 Configuration Hub 💬 Discourse (Forum) 💬 Discord (Live Chat)

💃 This is a community-driven project, we need your feedback.

<TL;DR>

CrowdSec is a free, modern & collaborative behavior detection engine, coupled with a global IP reputation network. It stacks on fail2ban's philosophy but is IPV6 compatible and 60x faster (Go vs Python), it uses Grok patterns to parse logs and YAML scenarios to identify behaviors. CrowdSec is engineered for modern Cloud / Containers / VM-based infrastructures (by decoupling detection and remediation). Once detected you can remedy threats with various bouncers (firewall block, nginx http 403, Captchas, etc.) while the aggressive IP can be sent to CrowdSec for curation before being shared among all users to further improve everyone's security. See FAQ or read below for more.

2 mins install

Installing it through the Package system of your OS is the easiest way to proceed. Otherwise, you can install it from source.

From package (Debian)

curl -s https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.deb.sh | sudo bash
sudo apt-get update
sudo apt-get install crowdsec

From package (rhel/centos/amazon linux)

curl -s https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.rpm.sh | sudo bash
sudo yum install crowdsec

From package (FreeBSD)

sudo pkg update
sudo pkg install crowdsec

From source

wget https://github.com/crowdsecurity/crowdsec/releases/latest/download/crowdsec-release.tgz
tar xzvf crowdsec-release.tgz
cd crowdsec-v* && sudo ./wizard.sh -i

About the CrowdSec project

Crowdsec is an open-source, lightweight software, detecting peers with aggressive behaviors to prevent them from accessing your systems. Its user-friendly design and assistance offer a low technical barrier of entry and nevertheless a high security gain.

The architecture is as follows :

CrowdSec

Once an unwanted behavior is detected, deal with it through a bouncer. The aggressive IP, scenario triggered and timestamp are sent for curation, to avoid poisoning & false positives. (This can be disabled). If verified, this IP is then redistributed to all CrowdSec users running the same scenario.

Outnumbering hackers all together

By sharing the threat they faced, all users are protecting each-others (hence the name Crowd-Security). Crowdsec is designed for modern infrastructures, with its "Detect Here, Remedy There" approach, letting you analyze logs coming from several sources in one place and block threats at various levels (applicative, system, infrastructural) of your stack.

CrowdSec ships by default with scenarios (brute force, port scan, web scan, etc.) adapted for most contexts, but you can easily extend it by picking more of them from the HUB. It is also easy to adapt an existing one or create one yourself.

👉 What it is not

CrowdSec is not a SIEM, storing your logs (neither locally nor remotely). Your data are analyzed locally and forgotten.

Signals sent to the curation platform are limited to the very strict minimum: IP, Scenario, Timestamp. They are only used to allow the system to spot new rogue IPs, and rule out false positives or poisoning attempts.

⬇️ Install it !

Crowdsec is available for various platforms :

Or look directly at installation documentation for other methods and platforms.

🎉 Key benefits

Fast assisted installation, no technical barrier

Initial configuration is automated, providing functional out-of-the-box setup

Out of the box detection

Baseline detection is effective out-of-the-box, no fine-tuning required (click to expand)

Easy bouncer deployment

It's trivial to add bouncers to enforce decisions of crowdsec (click to expand)

Easy dashboard access

It's easy to deploy a metabase interface to view your data simply with cscli (click to expand)

Hot & Cold logs

Process cold logs, for forensic, tests and chasing false positives & false negatives (click to expand)

📦 About this repository

This repository contains the code for the two main components of crowdsec :

  • crowdsec : the daemon a-la-fail2ban that can read, parse, enrich and apply heuristics to logs. This is the component in charge of "detecting" the attacks
  • cscli : the cli tool mainly used to interact with crowdsec : ban/unban/view current bans, enable/disable parsers and scenarios.

Contributing

If you wish to contribute to the core of crowdsec, you are welcome to open a PR in this repository.

If you wish to add a new parser, scenario or collection, please open a PR in the hub repository.

If you wish to contribute to the documentation, please open a PR in the documentation repository.