Skip to content

Commit 84f53ad

Browse files
committed
take tko's feedback into account
1 parent 22949df commit 84f53ad

File tree

1 file changed

+86
-86
lines changed

1 file changed

+86
-86
lines changed

crowdsec-docs/unversioned/bouncers/haproxy_spoa.mdx

Lines changed: 86 additions & 86 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](/docs/next/getting_started/u/getting_started/installation/linux).
6868

6969
<Tabs
7070
defaultValue="haproxy_debian"
@@ -99,82 +99,6 @@ 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':
146-
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-
```
178102

179103
## HAProxy Configuration
180104

@@ -334,23 +258,98 @@ sudo mkdir -p /etc/crowdsec/bouncers/
334258
sudo cp config/crowdsec-spoa-bouncer.yaml /etc/crowdsec/bouncers/
335259
```
336260

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

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

344-
- Generate an API key on the server where CrowdSec is intalled:
345-
```bash
346-
cscli bouncers add haproxy-spoa
347-
```
264+
<details>
265+
266+
<summary>`/etc/crowdsec/bouncer/crowdsec-spoa-bouncer.yaml`</summary>
267+
268+
```yaml
269+
log_mode: file
270+
log_dir: /var/log/
271+
log_level: info
272+
log_compression: true
273+
log_max_size: 100
274+
log_max_backups: 3
275+
log_max_age: 30
276+
277+
update_frequency: 10s
278+
api_url: http://127.0.0.1:8080/
279+
api_key: ${API_KEY}
280+
insecure_skip_verify: false
281+
282+
workers:
283+
- name: spoa1
284+
listen_addr: 0.0.0.0:9000
285+
listen_socket: /run/crowdsec-spoa/spoa-1.sock
286+
287+
worker_user: crowdsec-spoa
288+
worker_group: crowdsec-spoa
289+
290+
asn_database_path: /var/lib/crowdsec/data/GeoLite2-ASN.mmdb
291+
city_database_path: /var/lib/crowdsec/data/GeoLite2-City.mmdb
292+
293+
admin_socket: /run/crowdsec-spoa-admin.sock
294+
295+
prometheus:
296+
enabled: true
297+
listen_addr: 127.0.0.1
298+
listen_port: 60601
299+
```
300+
</details>
301+
302+
You can get a workable configuration by using the yaml above and getting and api key by:
303+
```bash
304+
sudo cscli bouncers add mybouncer
305+
API key for 'bouncertest':
306+
307+
JdVa7DKBM35gPDAR014pH/55l38fxLGt02NPPnZgLQI
348308

309+
Please keep this key since you will not be able to retrieve it!
310+
```
349311
- Paste the key into:
350312
```yaml
351313
api_key: your-generated-key
352314
```
353315
316+
317+
In the `/etc/crowdsec/bouncers/crowdsec-spoa-bouncer.yaml` file the following
318+
keys are of some importance:
319+
320+
- Set your **LAPI URL** to point to your CrowdSec LAPI instance:
321+
```yaml
322+
api_url: http://127.0.0.1:8080/
323+
```
324+
325+
You can check that the bouncer is correctly installed with cscli:
326+
327+
```bash
328+
❯ sudo cscli bouncers list
329+
──────────────────────────────────────────────────────────────────────────────────────────
330+
Name IP Address Valid Last API pull Type
331+
──────────────────────────────────────────────────────────────────────────────────────────
332+
cs-spoa-bouncer-1752052534 127.0.0.1 ✔️ crowdsec-spoa-bouncer
333+
──────────────────────────────────────────────────────────────────────────────────────────
334+
❯ sudo cscli bouncers inspect cs-spoa-bouncer-1752052534
335+
──────────────────────────────────────────────────────────────────────────────────────────
336+
Bouncer: cs-spoa-bouncer-1752052534
337+
──────────────────────────────────────────────────────────────────────────────────────────
338+
Created At 2025-07-09 09:15:34.685444393 +0000 UTC
339+
Last Update 2025-07-09 12:42:18.92023029 +0000 UTC
340+
Revoked? false
341+
IP Address 127.0.0.1
342+
Type crowdsec-spoa-bouncer
343+
Version v0.0.3-beta29-rpm-pragmatic-arm64-db7065289a0f5ce1c92f34807c9a98b23c07dc90
344+
Last Pull
345+
Auth type api-key
346+
OS ?
347+
Auto Created false
348+
──────────────────────────────────────────────────────────────────────────────────────────
349+
350+
```
351+
352+
354353
Create runtime socket directory and crowdsec-spoa user:
355354

356355
```bash
@@ -359,6 +358,7 @@ sudo mkdir -p /run/crowdsec-spoa
359358
sudo chown crowdsec-spoa:crowdsec-spoa /run/crowdsec-spoa
360359
```
361360

361+
362362
#### Configure HAProxy
363363

364364
##### Lua Integration & Environment Variables

0 commit comments

Comments
 (0)