Skip to content

Commit 2821006

Browse files
authored
Merge pull request #835 from crowdsecurity/feedback/tko
take tko's feedback into account
2 parents 22949df + c3fa7d5 commit 2821006

File tree

1 file changed

+89
-85
lines changed

1 file changed

+89
-85
lines changed

crowdsec-docs/unversioned/bouncers/haproxy_spoa.mdx

Lines changed: 89 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ We strongly encourage the use of our packages.
6464
### Using packages
6565

6666
You will have to setup crowdsec repositories first [setup crowdsec
67-
repositories](/docs/next/getting_started/install_crowdsec#install-our-repositories).
67+
repositories](/u/getting_started/installation/linux).
6868

6969
<Tabs
7070
defaultValue="haproxy_debian"
@@ -99,82 +99,10 @@ configuration file `/etc/crowdsec/bouncer/crowdsec-spoa-bouncer.yaml` should
9999
already be in a working state, and can skip this section and begin with HAProxy
100100
Configuration.
101101

102-
You can always edit the configuration file at `/etc/crowdsec/bouncer/crowdsec-spoa-bouncer.yaml`:
103-
104-
<details>
105-
106-
<summary>`/etc/crowdsec/bouncer/crowdsec-spoa-bouncer.yaml`</summary>
107-
108-
```yaml
109-
log_mode: file
110-
log_dir: /var/log/
111-
log_level: info
112-
log_compression: true
113-
log_max_size: 100
114-
log_max_backups: 3
115-
log_max_age: 30
116-
117-
update_frequency: 10s
118-
api_url: http://127.0.0.1:8080/
119-
api_key: ${API_KEY}
120-
insecure_skip_verify: false
121-
122-
workers:
123-
- name: spoa1
124-
listen_addr: 0.0.0.0:9000
125-
listen_socket: /run/crowdsec-spoa/spoa-1.sock
126-
127-
worker_user: crowdsec-spoa
128-
worker_group: crowdsec-spoa
129-
130-
asn_database_path: /var/lib/crowdsec/data/GeoLite2-ASN.mmdb
131-
city_database_path: /var/lib/crowdsec/data/GeoLite2-City.mmdb
132-
133-
admin_socket: /run/crowdsec-spoa-admin.sock
134-
135-
prometheus:
136-
enabled: true
137-
listen_addr: 127.0.0.1
138-
listen_port: 60601
139-
```
140-
</details>
141-
142-
You can get a workable configuration by using the yaml above and getting and api key by:
143-
```bash
144-
sudo cscli bouncers add mybouncer
145-
API key for 'bouncertest':
102+
If your CrowdSec Engine is installed on an other server, you'll have to [update
103+
the `/etc/crowdsec/bouncer/crowdsec-spoa-bouncer.yaml`
104+
file](/u/bouncers/haproxy_spoa#configure-the-bouncer).
146105

147-
JdVa7DKBM35gPDAR014pH/55l38fxLGt02NPPnZgLQI
148-
149-
Please keep this key since you will not be able to retrieve it!
150-
```
151-
152-
You can check that the bouncer is correctly installed with cscli:
153-
154-
```bash
155-
❯ sudo cscli bouncers list
156-
──────────────────────────────────────────────────────────────────────────────────────────
157-
Name IP Address Valid Last API pull Type
158-
──────────────────────────────────────────────────────────────────────────────────────────
159-
cs-spoa-bouncer-1752052534 127.0.0.1 ✔️ crowdsec-spoa-bouncer
160-
──────────────────────────────────────────────────────────────────────────────────────────
161-
❯ sudo cscli bouncers inspect cs-spoa-bouncer-1752052534
162-
──────────────────────────────────────────────────────────────────────────────────────────
163-
Bouncer: cs-spoa-bouncer-1752052534
164-
──────────────────────────────────────────────────────────────────────────────────────────
165-
Created At 2025-07-09 09:15:34.685444393 +0000 UTC
166-
Last Update 2025-07-09 12:42:18.92023029 +0000 UTC
167-
Revoked? false
168-
IP Address 127.0.0.1
169-
Type crowdsec-spoa-bouncer
170-
Version v0.0.3-beta29-rpm-pragmatic-arm64-db7065289a0f5ce1c92f34807c9a98b23c07dc90
171-
Last Pull
172-
Auth type api-key
173-
OS ?
174-
Auto Created false
175-
──────────────────────────────────────────────────────────────────────────────────────────
176-
177-
```
178106

179107
## HAProxy Configuration
180108

@@ -334,23 +262,98 @@ sudo mkdir -p /etc/crowdsec/bouncers/
334262
sudo cp config/crowdsec-spoa-bouncer.yaml /etc/crowdsec/bouncers/
335263
```
336264

337-
Edit `/etc/crowdsec/bouncers/crowdsec-spoa-bouncer.yaml`:
338265

339-
- Set your **LAPI URL** to point to your CrowdSec LAPI instance:
340-
```yaml
341-
api_url: http://127.0.0.1:8080/
342-
```
266+
You can always edit the configuration file at `/etc/crowdsec/bouncer/crowdsec-spoa-bouncer.yaml`:
343267

344-
- Generate an API key on the server where CrowdSec is intalled:
345-
```bash
346-
cscli bouncers add haproxy-spoa
347-
```
268+
<details>
348269

270+
<summary>`/etc/crowdsec/bouncer/crowdsec-spoa-bouncer.yaml`</summary>
271+
272+
```yaml
273+
log_mode: file
274+
log_dir: /var/log/
275+
log_level: info
276+
log_compression: true
277+
log_max_size: 100
278+
log_max_backups: 3
279+
log_max_age: 30
280+
281+
update_frequency: 10s
282+
api_url: http://127.0.0.1:8080/
283+
api_key: ${API_KEY}
284+
insecure_skip_verify: false
285+
286+
workers:
287+
- name: spoa1
288+
listen_addr: 0.0.0.0:9000
289+
listen_socket: /run/crowdsec-spoa/spoa-1.sock
290+
291+
worker_user: crowdsec-spoa
292+
worker_group: crowdsec-spoa
293+
294+
asn_database_path: /var/lib/crowdsec/data/GeoLite2-ASN.mmdb
295+
city_database_path: /var/lib/crowdsec/data/GeoLite2-City.mmdb
296+
297+
admin_socket: /run/crowdsec-spoa-admin.sock
298+
299+
prometheus:
300+
enabled: true
301+
listen_addr: 127.0.0.1
302+
listen_port: 60601
303+
```
304+
</details>
305+
306+
You can get a workable configuration by using the yaml above and getting and api key by:
307+
```bash
308+
sudo cscli bouncers add mybouncer
309+
API key for 'bouncertest':
310+
311+
JdVa7DKBM35gPDAR014pH/55l38fxLGt02NPPnZgLQI
312+
313+
Please keep this key since you will not be able to retrieve it!
314+
```
349315
- Paste the key into:
350316
```yaml
351317
api_key: your-generated-key
352318
```
353319
320+
321+
In the `/etc/crowdsec/bouncers/crowdsec-spoa-bouncer.yaml` file the following
322+
keys are of some importance:
323+
324+
- Set your **LAPI URL** to point to your CrowdSec LAPI instance:
325+
```yaml
326+
api_url: http://127.0.0.1:8080/
327+
```
328+
329+
You can check that the bouncer is correctly installed with cscli:
330+
331+
```bash
332+
❯ sudo cscli bouncers list
333+
──────────────────────────────────────────────────────────────────────────────────────────
334+
Name IP Address Valid Last API pull Type
335+
──────────────────────────────────────────────────────────────────────────────────────────
336+
cs-spoa-bouncer-1752052534 127.0.0.1 ✔️ crowdsec-spoa-bouncer
337+
──────────────────────────────────────────────────────────────────────────────────────────
338+
❯ sudo cscli bouncers inspect cs-spoa-bouncer-1752052534
339+
──────────────────────────────────────────────────────────────────────────────────────────
340+
Bouncer: cs-spoa-bouncer-1752052534
341+
──────────────────────────────────────────────────────────────────────────────────────────
342+
Created At 2025-07-09 09:15:34.685444393 +0000 UTC
343+
Last Update 2025-07-09 12:42:18.92023029 +0000 UTC
344+
Revoked? false
345+
IP Address 127.0.0.1
346+
Type crowdsec-spoa-bouncer
347+
Version v0.0.3-beta29-rpm-pragmatic-arm64-db7065289a0f5ce1c92f34807c9a98b23c07dc90
348+
Last Pull
349+
Auth type api-key
350+
OS ?
351+
Auto Created false
352+
──────────────────────────────────────────────────────────────────────────────────────────
353+
354+
```
355+
356+
354357
Create runtime socket directory and crowdsec-spoa user:
355358

356359
```bash
@@ -359,6 +362,7 @@ sudo mkdir -p /run/crowdsec-spoa
359362
sudo chown crowdsec-spoa:crowdsec-spoa /run/crowdsec-spoa
360363
```
361364

365+
362366
#### Configure HAProxy
363367

364368
##### Lua Integration & Environment Variables

0 commit comments

Comments
 (0)