<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=CrowdSec_HAProxy_Bouncer</id>
	<title>CrowdSec HAProxy Bouncer - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=CrowdSec_HAProxy_Bouncer"/>
	<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=CrowdSec_HAProxy_Bouncer&amp;action=history"/>
	<updated>2026-06-17T13:30:44Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Xinux Wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=CrowdSec_HAProxy_Bouncer&amp;diff=70371&amp;oldid=prev</id>
		<title>Thomas.will am 23. Mai 2026 um 13:35 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=CrowdSec_HAProxy_Bouncer&amp;diff=70371&amp;oldid=prev"/>
		<updated>2026-05-23T13:35:25Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 23. Mai 2026, 13:35 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;===Was ist das?===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;CrowdSec läuft als IDS/IPS und kommuniziert über den SPOE-Mechanismus direkt mit HAProxy. Blockentscheidungen werden auf Proxy-Ebene getroffen, bevor der Request das Backend erreicht.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;CrowdSec läuft als IDS/IPS und kommuniziert über den SPOE-Mechanismus direkt mit HAProxy. Blockentscheidungen werden auf Proxy-Ebene getroffen, bevor der Request das Backend erreicht.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-70370:rev-70371 --&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=CrowdSec_HAProxy_Bouncer&amp;diff=70370&amp;oldid=prev</id>
		<title>Thomas.will: Die Seite wurde neu angelegt: „CrowdSec läuft als IDS/IPS und kommuniziert über den SPOE-Mechanismus direkt mit HAProxy. Blockentscheidungen werden auf Proxy-Ebene getroffen, bevor der Req…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=CrowdSec_HAProxy_Bouncer&amp;diff=70370&amp;oldid=prev"/>
		<updated>2026-05-23T13:34:58Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „CrowdSec läuft als IDS/IPS und kommuniziert über den SPOE-Mechanismus direkt mit HAProxy. Blockentscheidungen werden auf Proxy-Ebene getroffen, bevor der Req…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;CrowdSec läuft als IDS/IPS und kommuniziert über den SPOE-Mechanismus direkt mit HAProxy. Blockentscheidungen werden auf Proxy-Ebene getroffen, bevor der Request das Backend erreicht.&lt;br /&gt;
&lt;br /&gt;
;Voraussetzung: CrowdSec ist installiert und läuft (siehe [[CrowdSec]])&lt;br /&gt;
&lt;br /&gt;
===Installation===&lt;br /&gt;
&lt;br /&gt;
*apt install crowdsec-haproxy-bouncer&lt;br /&gt;
&lt;br /&gt;
===SPOE-Konfiguration===&lt;br /&gt;
&lt;br /&gt;
Der Bouncer legt automatisch eine SPOE-Konfigurationsdatei an:&lt;br /&gt;
&lt;br /&gt;
 /etc/haproxy/spoe-crowdsec.conf&lt;br /&gt;
&lt;br /&gt;
Inhalt prüfen:&lt;br /&gt;
&lt;br /&gt;
*cat /etc/haproxy/spoe-crowdsec.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
[config]&lt;br /&gt;
  spoe-agent crowdsec&lt;br /&gt;
    messages    check-client-ip&lt;br /&gt;
    option      var-prefix      crowdsec&lt;br /&gt;
    timeout     hello           100ms&lt;br /&gt;
    timeout     idle            30s&lt;br /&gt;
    timeout     processing      50ms&lt;br /&gt;
    use-backend crowdsec_backend&lt;br /&gt;
&lt;br /&gt;
  spoe-message check-client-ip&lt;br /&gt;
    args src&lt;br /&gt;
    event on-client-session&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===HAProxy Konfiguration erweitern===&lt;br /&gt;
&lt;br /&gt;
*nano /etc/haproxy/haproxy.cfg&lt;br /&gt;
&lt;br /&gt;
Im &amp;lt;code&amp;gt;global&amp;lt;/code&amp;gt;-Block ergänzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
global&lt;br /&gt;
    # ... bestehende Einträge ...&lt;br /&gt;
    lua-prepend-path /usr/lib/crowdsec/lua/haproxy/?.lua&lt;br /&gt;
    lua-load /usr/lib/crowdsec/lua/haproxy/crowdsec.lua&lt;br /&gt;
    setenv CROWDSEC_API_KEY &amp;lt;DEIN_BOUNCER_KEY&amp;gt;&lt;br /&gt;
    setenv CROWDSEC_API_URL http://127.0.0.1:8080&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Im &amp;lt;code&amp;gt;frontend ft_https&amp;lt;/code&amp;gt; ergänzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
frontend ft_https&lt;br /&gt;
    # ... bestehende Einträge ...&lt;br /&gt;
    filter spoe engine crowdsec config /etc/haproxy/spoe-crowdsec.conf&lt;br /&gt;
    http-request lua.crowdsec_allow&lt;br /&gt;
    http-request deny deny_status 403 if { var(txn.crowdsec.action) -m str &amp;quot;ban&amp;quot; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Backend für den CrowdSec-Agent hinzufügen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
backend crowdsec_backend&lt;br /&gt;
    server crowdsec 127.0.0.1:7422&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bouncer-Key generieren===&lt;br /&gt;
&lt;br /&gt;
*cscli bouncers add haproxy-bouncer&lt;br /&gt;
&lt;br /&gt;
Den ausgegebenen Key in die HAProxy-Konfiguration unter &amp;lt;code&amp;gt;CROWDSEC_API_KEY&amp;lt;/code&amp;gt; eintragen.&lt;br /&gt;
&lt;br /&gt;
===Konfiguration testen und neu laden===&lt;br /&gt;
&lt;br /&gt;
*haproxy -c -f /etc/haproxy/haproxy.cfg&lt;br /&gt;
*systemctl reload haproxy&lt;br /&gt;
&lt;br /&gt;
===Test===&lt;br /&gt;
&lt;br /&gt;
CrowdSec-Entscheidungen anzeigen:&lt;br /&gt;
&lt;br /&gt;
*cscli decisions list&lt;br /&gt;
&lt;br /&gt;
Eine Test-IP manuell bannen:&lt;br /&gt;
&lt;br /&gt;
*cscli decisions add --ip 10.88.2XX.99 --duration 5m --reason &amp;quot;Test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Vom gebannten Client aus sollte ein HTTP 403 zurückkommen. Ban wieder entfernen:&lt;br /&gt;
&lt;br /&gt;
*cscli decisions delete --ip 10.88.2XX.99&lt;br /&gt;
&lt;br /&gt;
Logs beobachten:&lt;br /&gt;
&lt;br /&gt;
*journalctl -fu haproxy&lt;br /&gt;
*journalctl -fu crowdsec&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
</feed>