Wie kann HAProxy (Plugin) den CrowdSec Bouncer nutzen?

Started by SteffenDE, Today at 12:01:04 PM

Previous topic - Next topic
Hallo.

Ich will auf der OPNsense 26.1 z.B. über einen CrowdSec Agent die HAProxy-Logs parsen lassen, damit Decisions entstehen, die der bereits aktive CrowdSec-Plugin-Bouncer auf L3 durchsetzt. Kein separater HAProxy-Bouncer, sondern die Nutzung des vorhanden Bouncer.

HAProxy-Logs erkennen Angriffsmuster (Brute-Force auf Login-Seiten, Scanning) → Decisions an LAPI → FW-Bouncer blockiert auf L3

Ich finde dazu keine aktuelle und funktionierende Anleitung oder geht das wirklich nicht. Falls es nicht geht würde mich natürlich interessieren wie Ihr den RP entsprechend absichert oder reagieren lasst?

Danke, Steffen

Das geht, dazu musst du eigentlich nur die HAproxy collection mit cscli nachinstallieren und in acquis.d irgend was passendes an YAML ablegen.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Danke, werde mal weiter recherchieren und schauen wie ich das hinbekomme.

So geht es mit caddy, wahrscheinlich mit ha-proxy irgendwie auch so ähnlich:

https://docs.opnsense.org/manual/how-tos/caddy.html#crowdsec-integration
Hardware:
DEC740

perhaps you can still use this https://forum.opnsense.org/index.php?topic=44839.msg223882#msg223882 . I wrote a while ago and is still in operation after a couple of OPN upgrades. I get a lot of hits.

I would use HAproxy only for acquis, not for bouncing. Bouncing can be done at the network layer, i.e. pf. But that's me. :-)
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

So, gar nicht so schwer ...

Schritt 1: HAProxy Collection installieren
bashcscli collections install crowdsecurity/haproxy
Schritt 2: Acquisition-Datei anlegen
printf 'filenames:\n  - /var/log/haproxy/*.log\nlabels:\n  type: syslog\n' > /usr/local/etc/crowdsec/acquis.d/haproxy.yaml
cat /usr/local/etc/crowdsec/acquis.d/haproxy.yaml

Schritt 3: CrowdSec neu starten
service oscrowdsec restart
Gestartet. Jetzt verifizieren ob die Acquisition aktiv ist und der Parser funktioniert:
cscli metrics show acquisition
Dann in die Decisions showen ob IP's geblockt werden (natürlich nur wenn was erkannt wird).