Skip to content

Commit cfb2864

Browse files
author
jdv
committed
improving detection section 1/2
1 parent b7a8042 commit cfb2864

2 files changed

Lines changed: 60 additions & 52 deletions

File tree

crowdsec-docs/sidebarsUnversioned.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,11 @@ module.exports = {
551551
id: "getting_started/next_steps",
552552
},
553553
items: [
554-
"getting_started/post_installation/health_check",
554+
{
555+
type: "doc",
556+
id: "getting_started/post_installation/health_check",
557+
label: "Stack Health-Check",
558+
},
555559
{
556560
type: "category",
557561
label: "CrowdSec Console",

crowdsec-docs/unversioned/getting_started/post_installation/health_check.mdx

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,122 +9,126 @@ import CodeBlock from '@theme/CodeBlock';
99
import { CheckboxProvider, InteractiveCheckbox } from '@site/src/components/InteractiveCheckbox.js';
1010
import HierarchicalList from '@site/src/components/HierarchicalList.js';
1111

12-
<small className="health-check-version">Health Check Version: 0.1.0</small>
12+
<small className="health-check-version" style="position: relative;top: -32px;">Health Check Version: 0.1.0</small>
1313

14-
Welcome to the interactive health check of your CrowdSec setup.
15-
We'll guide you through a series of tests to ensure that your Security Stack is fully functional and ready to protect your services: **Detecting**, **Threat Sharing** and **Remediating**.
16-
This guide covers cases of protecting common services such as web servers (HTTP) and SSH.
14+
Welcome to the interactive Health-Check of your CrowdSec setup.
15+
We'll guide you through a series of tests to ensure that your Security Stack is fully functional and ready to protect your services:
16+
**Detecting**, **Threat Sharing** and **Remediating**.
17+
*This guide covers cases of protecting common services such as web servers (HTTP) and SSH.*
1718

18-
Via a **top-down approach** we'll test the end goal of components, and then dive into detailed troubleshooting if needed.
19+
We'll first test the final functionality of each component (top-down approach) before diving into detailed troubleshooting if issues arise.
1920

2021
This health check is divided into three main sections:
21-
- [**📡 Detecting**](#-detection-checks) behaviors on your services.
22-
- [**🔗 Connectivity**](#-crowdsec-connectivity-checks) with CrowdSec network to retrieve the community blocklist.
23-
- [**🛡️ Protecting**](#-remediation-checks) your services by remediating alerts automatically with bouncers.
22+
- [**📡 Detection**](#-detection-checks): Ensuring CrowdSec properly detects threats targeting your services.
23+
- [**🔗 Connectivity**](#-crowdsec-connectivity-checks): Verifying communication with the CrowdSec network to receive the community blocklist.
24+
- [**🛡️ Protection**](#-remediation-checks): Confirming that your bouncers automatically block threats detected by CrowdSec
2425

2526
* * *
2627

2728
## 📡 Detection checks
2829

2930
### *Trigger CrowdSec's test scenarios*
3031

31-
:::info
32-
Check that your Security Engine properly reads and parses the logs of the services you protect.
33-
The HTTP collection and the Linux collection contain **dummy scenarios** allowing you to prove your Security Engine works as intended, without having to do penetration tests, risking getting you banned from your own server.
34-
:::
32+
Let's use CrowdSec's built-in **dummy scenarios** (HTTP and Linux) to safely verify your Security Engine detects threats, without risking accidental self-blocking.
3533

3634
<details>
3735
<summary>🌐 **HTTP** detection test</summary>
3836

39-
Let's trigger the `crowdsecurity/http-generic-test` dummy scenario by calling a *probe path* on your web server.
37+
We'll trigger the dummy scenario `crowdsecurity/http-generic-test` by accessing a **probe path** on your web server.
4038

41-
1️⃣ Request your service URL with the following path: `/crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl`
39+
1️⃣ Access your service URL with this path: `/crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl`
4240
<CodeBlock className="language-bash">curl -I https://\<your-service-url\>/crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl</CodeBlock>
4341

44-
2️⃣ You should see an alert for the scenario `crowdsecurity/http-generic-test`
45-
42+
2️⃣ Confirm the alert has triggered for the scenario `crowdsecurity/http-generic-test`
4643
<CodeBlock className="language-bash">sudo cscli alerts list -s crowdsecurity/http-generic-test</CodeBlock>
4744

48-
Notes:
49-
- If it's done from a private IP the alert won't appear as private IPs are whitelisted by default.
50-
- You can call the test url via a browser if you prefer, it might make it easier to test from an other device.
51-
- This scenario has a delay of 5 minutes before it can re-trigger _(blackhole parameter of the scenario)_.
45+
**Notes:**
46+
- Requests from private IP addresses won't trigger alerts (private IPs are whitelisted by default).
47+
- You can also test via a browser if easier, especially from another device.
48+
- This scenario can be triggered again only after a 5-minutes delay.
5249
</details>
5350

5451
<details>
5552
<summary>🔐 **SSH** detection test</summary>
5653

57-
Let's trigger the `crowdsecurity/ssh-generic-test` dummy scenario by logging in to your server via SSH with a specific user.
54+
We'll trigger the dummy scenario `crowdsecurity/ssh-generic-test` by attempting an SSH login with a specific username.
5855

59-
1️⃣ Try to authenticate to your server via SSH using the following user: `crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl`.
56+
1️⃣ Attempt SSH login using this username: `crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl`.
6057
<CodeBlock className="language-bash">ssh crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl@\<your-server-ip\></CodeBlock>
6158

62-
2️⃣ You should see an alert for the scenario `crowdsecurity/ssh-generic-test`
63-
59+
2️⃣ Confirm the alert has triggered for the scenario `crowdsecurity/ssh-generic-test`
6460
<CodeBlock className="language-bash">sudo cscli alerts list -s crowdsecurity/ssh-generic-test</CodeBlock>
6561

66-
Note that this scenario has a delay of 5 minute before it can re-trigger _(blackhole parameter of the scenario)_.
62+
**Notes:**
63+
- This scenario can only be triggered again after a 5-minutes delay.
6764
</details>
6865

6966
<details>
7067
<summary>🛡️ **AppSec** detection test - CrowdSec WAF </summary>
7168

72-
If you are using an AppSec-capable bouncer and have configured CrowdSec WAF, you can test the detection of an AppSec scenario.
73-
It's similar to the HTTP detection test, but it will trigger `crowdsecurity/appsec-generic-test`.
69+
If you've enabled an AppSec-capable bouncer with CrowdSec WAF, you can trigger the `crowdsecurity/appsec-generic-test` dummy scenario.
70+
It would have triggered along with the HTTP detection test, but it is worth mentioning here as well.
7471

7572
Here is how to trigger the `crowdsecurity/appsec-generic-test` dummy scenario by calling a *probe path* on your web server.
7673

77-
1️⃣ Request your service URL with the following path: `/crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl`
78-
<CodeBlock className="language-bash">curl -I http://your-service-url/crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl</CodeBlock>
74+
We'll trigger the dummy scenario `crowdsecurity/appsec-generic-test` by accessing a **probe path** on your web server.
7975

80-
2️⃣ You should see an alert for the scenario `crowdsecurity/appsec-generic-test`
76+
1️⃣ Access your service URL with this path: `/crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl`
77+
<CodeBlock className="language-bash">curl -I https://\<your-service-url\>/crowdsec-test-NtktlJHV4TfBSK3wvlhiOBnl</CodeBlock>
8178

79+
2️⃣ Confirm the alert has triggered for the scenario `crowdsecurity/appsec-generic-test`
8280
<CodeBlock className="language-bash">sudo cscli alerts list -s crowdsecurity/appsec-generic-test</CodeBlock>
8381

84-
Note that this scenario has a delay of **1** minute before it can re-trigger _(blackhole parameter of the scenario)_.
82+
**Notes:**
83+
- This scenario can only be triggered again after a 1-minute delay.
8584
</details>
8685

8786
* * *
8887

8988
### Were all the tests successful ?
9089

91-
Were all the tests related to your setup successful ?
92-
If so, you can proceed to the next phase of the health check: [**Connectivity checks**](#crowdsec-connectivity-checks).
90+
Were all the tests related to your setup successful?
91+
👍 If so, you can proceed to the next phase of the health check: [**Connectivity checks**](#-crowdsec-connectivity-checks).
9392

94-
If not, check the troubleshooting section below
93+
🛠️ If not, check the troubleshooting section below.
9594

9695
<details>
97-
<summary>🚨 **Detection Troubleshooting**</summary>
96+
<summary>🐞 **Detection Troubleshooting**</summary>
9897

99-
*No alerts triggered? Let's investigate: Here are some tests to identify where the issue might be.*
98+
**No alert triggered? Let's find out why.**
10099

101-
If you installed **CrowdSec Security Engine** on the same **Host** as the service you want to protect, the install wizards should have automatically detected the service and installed the appropriate parsers and scenarios.
102-
103-
If you have non-default paths or format for your logs, or if you chose other installation methods (docker, kubernetes..), you may need to manually install the parsers and scenarios.
100+
If you installed CrowdSec on the same **host** as the service you're protecting, it should have auto-detected it and installed the right collections of parsers and scenarios.
101+
However, if you're using *custom log paths*, *unusual log formats*, or running in *Docker/Kubernetes*, you might need to configure some things manually.
104102

105-
**This troubleshooting section will help you identify the issue and guide you through the necessary steps to fix it.**
103+
**This section will help you pinpoint the issue and walk you through how to fix it.**
106104

107105
<details>
108106
<summary>Are your logs being properly read and parsed?</summary>
109107

110-
The acquisition and parsing aspect of CrowdSec is crucial, as it tells The Security Engine which logs to read and how to parse them. You can setup multiple datasources (files, syslog, etc.), for more details you can refer to the [datasources documentation](https://doc.crowdsec.net/docs/next/log_processor/data_sources/intro).
111-
112-
Let's do a Top Down check using the `cscli metrics` command to see if your logs are being read and parsed correctly.
108+
CrowdSec needs to know what logs to read and how to interpret them.
109+
This is handled by the acquisition configuration (log sources) and parsing (how to read them).
110+
Multiple log sources can be defined in the acquisition(s) configuration files and they support diverse datasources (files, syslog, etc.).
111+
For more details you can refer to the [datasources documentation](https://doc.crowdsec.net/docs/next/log_processor/data_sources/intro).
113112

113+
We'll look at the security engine **metrics** to see if logs are **being read** and if what's read is **parsed correctly**.
114+
We'll do that using the `cscli metrics` command:
114115
<CodeBlock className="language-bash">sudo cscli metrics show acquisition parsers</CodeBlock>
115116

116-
- You should see the **names of the log files/stream** configured in the acquisition files, and the number of lines parsed for each of them.
117-
- The number of "Lines parsed" should be non-zero for each of the files you configured in the acquisition section.
118-
- The parsers metrics show you what parsers were successfully used. Look for the name of the parsers installed for the logs you're reading
117+
Under **Acquisition Metrics** you should see:
118+
- The source name of the log files or streams that have been read and the number of lines read and parsed for each of them.
119+
- If you don't see any sources or some you have configured are missing, it means that the acquisition configuration is not properly set up.
120+
- A non zero number of "Lines parsed" is expected for each source, proving that the appropriate parser was found and used.
121+
122+
Under The **Parsers Metrics** you have the details of the parsers used.
119123

120124
<div style={{ backgroundColor: '#FFE5B4', borderRadius: '5px' }}>
121-
🚨 If this command fails, check the [**CrowdSec Service Troubleshooting section**](#troubleshooting_service)
125+
🐞 If this command fails, check the [**CrowdSec Service Troubleshooting section**](#troubleshooting_service)
122126
</div>
123127
<div style={{ backgroundColor: '#FFE5B4', borderRadius: '5px' }}>
124-
🚨 If you don't see the log names supposed to be parsed, check the [**Acquisition Troubleshooting section**](#troubleshooting_acquisition)
128+
🐞 If you don't see the log names supposed to be parsed, check the [**Acquisition Troubleshooting section**](#troubleshooting_acquisition)
125129
</div>
126130
<div style={{ backgroundColor: '#FFE5B4', borderRadius: '5px' }}>
127-
🚨 If you don't see parsed lines, check the [**Collection Troubleshooting section****](#troubleshooting_collection)
131+
🐞 If you don't see parsed lines, check the [**Collection Troubleshooting section****](#troubleshooting_collection)
128132
</div>
129133

130134
</details>
@@ -208,7 +212,7 @@ The CAPI allows your instance to receive a curated blocklist of malicious IP add
208212
### Were all the tests successful ?
209213

210214
<details>
211-
<summary>🚨 Connectivity Troubleshooting</summary>
215+
<summary>🐞 Connectivity Troubleshooting</summary>
212216

213217
Check CAPI status with the command:
214218
<CodeBlock className="language-bash">sudo cscli capi status</CodeBlock>
@@ -271,7 +275,7 @@ You might want to continue to the next recommended steps:
271275
- Then subscribe to more blocklists to benefit from additionnl proactive prevention
272276

273277
<details>
274-
<summary>🚨 **Remediation Troubleshooting**</summary>
278+
<summary>🐞 **Remediation Troubleshooting**</summary>
275279

276280
...
277281

0 commit comments

Comments
 (0)