Skip to content

Improve CrowdSec hardening and reverse proxy troubleshooting - #917

Merged
TechHutTV merged 5 commits into
mainfrom
docs/crowdsec-hardening
Aug 19, 2026
Merged

Improve CrowdSec hardening and reverse proxy troubleshooting#917
TechHutTV merged 5 commits into
mainfrom
docs/crowdsec-hardening

Conversation

@TechHutTV

@TechHutTV TechHutTV commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR expands the self-hosted CrowdSec and reverse proxy documentation with clearer setup, verification, monitoring, and recovery guidance. It documents observed CrowdSec behavior across access logs, community decisions, AppSec protection, and dashboard lockouts so operators can validate their deployment and recover safely when enforcement behaves unexpectedly.

Changes

  • Correct the dashboard location for reverse proxy access logs and clarify HTTP restriction and observe-mode fields.
  • Explain CrowdSec's lazy bouncer startup and how to verify that the proxy connected to LAPI.
  • Document initial CAPI synchronization, hidden community decisions, and per-label decision metrics.
  • Add end-to-end enforcement tests and safe allowlist and decision-removal workflows.
  • Improve Docker network guidance for the Traefik CrowdSec middleware.
  • Add middleware attachment probes and an optional Traefik health check.
  • Add dashboard lockout recovery steps for AppSec matches and IP decisions.
  • Warn about fail-closed behavior and deleting the entire community blocklist.
  • Clarify supported uses and visible effects of NB_PROXY_PRIVATE.

Summary by CodeRabbit

  • Documentation
    • Clarified reverse-proxy access-log locations, denial reasons, authentication metadata, API examples, and observe-mode behavior.
    • Expanded CrowdSec setup, enrollment, testing, troubleshooting, allowlisting, recovery, and dashboard lockout guidance.
    • Documented middleware verification, API security, fail-closed behavior, enforcement modes, bouncer startup, blocklist synchronization, local and CAPI decisions, metrics inspection, and enforcement timing.
    • Clarified private-mode support, manual enrollment, dashboard recovery, captcha and throttle handling, and protection against unwanted blocks.

@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 19, 2026 3:24pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@TechHutTV, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 04fd5877-47ae-43f2-b7d4-10277c0a4d7a

📥 Commits

Reviewing files that changed from the base of the PR and between 725a6ed and 8b67f29.

📒 Files selected for processing (1)
  • src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 26424032-c288-4f85-a02e-7be3bfebc790

📥 Commits

Reviewing files that changed from the base of the PR and between c5d45c3 and 725a6ed.

⛔ Files ignored due to path filters (1)
  • public/docs-static/img/manage/reverse-proxy/access-logs/proxy-events-table.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • src/pages/manage/reverse-proxy/access-logs.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/manage/reverse-proxy/access-logs.mdx

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The documentation updates clarify reverse-proxy access-log fields and expand CrowdSec setup, verification, enforcement, allowlists, dashboard protection, recovery, and troubleshooting procedures for self-hosted deployments.

Changes

CrowdSec and reverse-proxy documentation

Layer / File(s) Summary
Access-log semantics
src/pages/manage/reverse-proxy/access-logs.mdx
Updates the dashboard path and documents HTTP denial fields, L4 behavior, CrowdSec metadata, and observe-mode behavior.
CrowdSec setup and operation
src/pages/selfhosted/maintenance/crowdsec.mdx, src/pages/selfhosted/migration/enable-reverse-proxy.mdx
Documents lazy bouncer startup, synchronization, decision inspection, enforcement tests, allowlists, recovery, and private proxy capability.
Dashboard protection and recovery
src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx
Documents generated network handling, middleware verification, dashboard lockout recovery, and unavailable-CrowdSec behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 725a6

This PR improves CrowdSec and reverse proxy setup, verification, monitoring, and recovery guidance. No actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

  • netbirdio/docs#831: Expands the CrowdSec dashboard protection documentation covered by this change.
  • netbirdio/docs#889: Introduces related CrowdSec AppSec access-log and self-hosted setup documentation.

Suggested reviewers: lixmal

Poem

A rabbit checks logs in the soft evening light,
CrowdSec records each decision just right.
Networks connect, and lockouts unwind,
Clear fields and commands keep errors confined.
Hop by hop, the documentation guides.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes to CrowdSec hardening and reverse proxy troubleshooting documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/crowdsec-hardening

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/manage/reverse-proxy/access-logs.mdx`:
- Around line 79-83: Split the two top-level JSON examples in the access-log
documentation into separate json fences, keeping each object unchanged so every
fenced example is independently valid JSON.
- Line 12: Update the adjacent image alt text near the Access Logs description
to use the renamed “Access Logs” dashboard view instead of “Proxy Events table,”
while preserving the existing image and surrounding documentation.
- Line 62: Update the access-log field descriptions in the table around the
“Auth Method,” “Reason,” and “Denied requests” entries to match the HTTP API
contract: document that auth_method_used contains the restriction code, reason
contains “Authentication failed” for authentication failures and “Request
failed” for later request failures, and keep the descriptions consistent with
the existing HTTP note.

In `@src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx`:
- Around line 397-399: Update the CrowdSec troubleshooting documentation to
distinguish AppSec outage behavior from NetBird Proxy’s initial-sync fail-closed
behavior. Keep the statement that crowdsecAppsecUnreachableBlock=true denies
dashboard requests when AppSec is unreachable, but remove the broader claim that
every later LAPI outage denies all reverse-proxy traffic unless that post-sync
behavior is explicitly verified.
- Around line 316-332: Remove the optional Traefik API health-check
configuration, including --api.insecure=true and the internal API router checks,
from the maintenance documentation. Direct the monitoring guidance to use the
external /.env probe instead, treating HTTP 403 as the healthy response; do not
recommend exposing the unauthenticated API on the shared Docker network.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e86d2b90-877a-4f54-901c-d1367701d645

📥 Commits

Reviewing files that changed from the base of the PR and between 204c279 and 7b8d77e.

📒 Files selected for processing (4)
  • src/pages/manage/reverse-proxy/access-logs.mdx
  • src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx
  • src/pages/selfhosted/maintenance/crowdsec.mdx
  • src/pages/selfhosted/migration/enable-reverse-proxy.mdx

Comment thread src/pages/manage/reverse-proxy/access-logs.mdx
Comment thread src/pages/manage/reverse-proxy/access-logs.mdx
Comment thread src/pages/manage/reverse-proxy/access-logs.mdx
Comment thread src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx Outdated
Comment thread src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx (1)

338-391: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Include Central API decisions in the lockout diagnosis.

cscli decisions list hides CAPI-sourced decisions by default. A community blocklist decision can therefore be mistaken for AppSec. Query the affected IP with --all and filter AppSec alerts by the same IP:

ip="<your-ip>"
docker compose exec -T crowdsec cscli decisions list --ip "$ip" --all
docker compose exec -T crowdsec cscli alerts list --ip "$ip" --kind waf --limit 0
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx` around lines 338 -
391, Update the lockout diagnosis section around “cscli decisions list” to
include Central API decisions by querying the affected address with --all, and
distinguish those results from AppSec matches. Add the corresponding AppSec
alert query filtered by the same IP and kind waf, using the established shell
variable pattern, before the allowlisting guidance.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/manage/reverse-proxy/access-logs.mdx`:
- Around line 40-42: Update the access-log field descriptions in the table
around “Auth Method,” “User,” and “Reason” to match the raw /api/events/proxy
fields: list auth methods as oidc, password, pin, and header; state that empty
auth_method_used values are omitted and credential failures retain only the
attempted method when available; clarify the exact reason values; and document
that denied L4 entries store the restriction code in auth_method_used while
omitting reason.

In `@src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx`:
- Around line 316-322: Update the external monitoring guidance around the
`https://<your-domain>/.env` probe to also cover the protected `/api` router by
adding `https://<your-domain>/api/.env`, or explicitly state that the existing
check covers only the dashboard router. Preserve the instruction to keep the
unauthenticated Traefik API disabled.

---

Outside diff comments:
In `@src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx`:
- Around line 338-391: Update the lockout diagnosis section around “cscli
decisions list” to include Central API decisions by querying the affected
address with --all, and distinguish those results from AppSec matches. Add the
corresponding AppSec alert query filtered by the same IP and kind waf, using the
established shell variable pattern, before the allowlisting guidance.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ec487e1-2236-4ed4-87d3-dc8e22bd71c8

📥 Commits

Reviewing files that changed from the base of the PR and between 7b8d77e and c5d45c3.

📒 Files selected for processing (2)
  • src/pages/manage/reverse-proxy/access-logs.mdx
  • src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx

Comment thread src/pages/manage/reverse-proxy/access-logs.mdx Outdated
Comment thread src/pages/selfhosted/maintenance/crowdsec-dashboard.mdx Outdated
@TechHutTV
TechHutTV merged commit d810fdc into main Aug 19, 2026
5 checks passed
@TechHutTV
TechHutTV deleted the docs/crowdsec-hardening branch August 19, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants