Skip to content

Replace Traefik Crowdsec bouncer container with plugin, install iptables bouncer - #112

Merged
bubacoder merged 4 commits into
mainfrom
feature/crowdsec
Mar 25, 2025
Merged

Replace Traefik Crowdsec bouncer container with plugin, install iptables bouncer#112
bubacoder merged 4 commits into
mainfrom
feature/crowdsec

Conversation

@bubacoder

@bubacoder bubacoder commented Mar 18, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Introduced a new environment variable for managing collections in the Crowdsec service.
    • Enabled improved network connectivity by connecting the Crowdsec service to the proxy network.
    • Added support for a new Crowdsec bouncer API key in the Traefik service configuration.
    • Integrated a plugin-based approach for authentication middleware, offering dynamic key management and a live operational mode.
    • Rolled out experimental plugin support with clear versioning details.
    • Added new configuration options for managing the installation of the CrowdSec bouncer.
    • Introduced a new task for installing and configuring the CrowdSec firewall bouncer on Debian-based systems.
    • Added a new task to conditionally install the Crowdsec iptables bouncer.
  • Chores

    • Removed deprecated bouncer integration.
    • Updated underlying container base images for improved performance.
    • Restored the nas host entry in the inventory configuration.
    • Added a new handler for restarting the Crowdsec firewall bouncer service.
    • Updated Ansible configuration to align with new standards.

@coderabbitai

coderabbitai Bot commented Mar 18, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update the security service configurations and Traefik middleware integration. In the Docker Compose configurations, new environment variables and network settings are added while a deprecated service is removed. The Traefik configuration revises the middleware handling for the Crowdsec bouncer, transitioning from an old forward authentication method to a plugin-based structure. Additionally, an experimental section is introduced to declare the plugin details, and the logrotate base image is updated.

Changes

File(s) Change Summary
docker/security/crowdsec.yaml, docker/security/traefik.yaml crowdsec.yaml: Added COLLECTIONS env variable with a reference comment; added a new networks section for the proxy network; removed the deprecated crowsec-traefik-bouncer service; updated bottom network name from default to proxy.

traefik.yaml: Added CROWDSEC_BOUNCER_API_KEY env variable to the traefik service; updated the logrotate base image from alpine:3.20 to alpine:3.21.
docker/security/traefik/dynamic/middlewares.yml, docker/security/traefik/traefik.yml middlewares.yml: Replaced the forwardAuth middleware configuration with a plugin-based configuration for crowdsec-bouncer-traefik-plugin, including settings for enabling the plugin, API key sourcing, host, and mode.

traefik.yml: Added a new experimental section to declare the crowdsec-bouncer-traefik-plugin with its moduleName and version.
ansible/inventory/group_vars/debian/vars.yaml, ansible/inventory/inventory.yaml vars.yaml: Added new variable install_crowdsec_bouncer set to false.

inventory.yaml: Added host nas as an empty dictionary; added variable install_crowdsec_bouncer set to true under nest.
ansible/roles/debian_base/tasks/45-crowdsec.yaml, ansible/roles/debian_base/tasks/main.yaml 45-crowdsec.yaml: Introduced tasks for adding CrowdSec GPG key, repository, and installing crowdsec-firewall-bouncer-iptables.

main.yaml: Added a task to install the Crowdsec iptables bouncer, conditional on install_crowdsec_bouncer being true.
ansible/roles/debian_base/handlers/main.yaml Added a new handler for restarting the crowdsec-firewall-bouncer service.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Traefik
    participant Middleware as "Crowdsec Bouncer Plugin"
    participant Crowdsec

    Client->>Traefik: Send HTTP request
    Traefik->>Middleware: Invoke plugin for auth check
    Middleware->>Crowdsec: Validate request (using LAPI key & host)
    Crowdsec-->>Middleware: Return authentication status
    Middleware-->>Traefik: Relay auth result
    Traefik-->>Client: Forward or block request
Loading

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 3312459 and 62a980c.

📒 Files selected for processing (1)
  • ansible/ansible.cfg (1 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@bubacoder bubacoder changed the title Traefik: Replace Crowdsec bouncer container with plugin Replace Traefik Crowdsec bouncer container with plugin, install iptables bouncer Mar 25, 2025
@bubacoder
bubacoder merged commit ed15f7f into main Mar 25, 2025
@bubacoder
bubacoder deleted the feature/crowdsec branch March 25, 2025 20:16
@coderabbitai coderabbitai Bot mentioned this pull request Aug 16, 2026
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.

1 participant