No description
Find a file
un-oeil 353799ac2f Read-only mode: machine login optional, bouncer key is enough for /bans and /ip
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 14:16:22 +02:00
.env.example Read-only mode: machine login optional, bouncer key is enough for /bans and /ip 2026-10-13 14:16:22 +02:00
.gitignore Initial barbenoire bot: Telegram commands, Pterodactyl deploy notes 2026-10-13 14:12:14 +02:00
app.py Read-only mode: machine login optional, bouncer key is enough for /bans and /ip 2026-10-13 14:16:22 +02:00
lapi.py Read-only mode: machine login optional, bouncer key is enough for /bans and /ip 2026-10-13 14:16:22 +02:00
README.md Read-only mode: machine login optional, bouncer key is enough for /bans and /ip 2026-10-13 14:16:22 +02:00
requirements.txt Initial barbenoire bot: Telegram commands, Pterodactyl deploy notes 2026-10-13 14:12:14 +02:00

barbenoire

Telegram bot on top of the homelab's CrowdSec Local API. CrowdSec itself still sends the ban notifications (same bot token, http plugin); this bot only adds commands.

Command Reply
/bans Active bans from the local CrowdSec (community blocklist not counted)
/ip <address> Banned right now? Country, AS, alert history, CTI/Shodan links
/unban <address> Lift a ban, after a ✅/❌ confirmation
/stats Alerts over 24 h and 7 days, by scenario and country

Optional: a heartbeat to a Kuma Push monitor (KUMA_PUSH_URL). It only answers the chat IDs in ALLOWED_CHAT_IDS.

CrowdSec credentials (on the CrowdSec host, LXC 101)

cscli bouncers add barbenoire        # -> CROWDSEC_BOUNCER_KEY (required, read-only)

Read-only mode (default): with only the bouncer key, /bans and /ip work (no country, no history); /unban and /stats reply that they are turned off.

Full mode (optional): a machine login adds alert history, countries, /stats and /unban. A machine can also create alerts and bans, so its password is sensitive.

cscli machines add barbenoire --password '<long random>' -f /dev/null
# then set CROWDSEC_MACHINE_ID / CROWDSEC_MACHINE_PASSWORD in .env and restart

The bot talks to the LAPI at http://10.0.0.11:8080 (reachable from VM 107).

Run locally

python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
cp .env.example .env   # fill in token + CrowdSec credentials
.venv/bin/python app.py

Deploy on Pterodactyl (python generic egg)

Server barbenoire on node wings. Same variables as barberousse, with GIT_ADDRESS=https://forgejo.un-oeil.fr/un-oeil/barbenoire.git.

  1. Set the variables, then Reinstall (clones the repo).
  2. Files → create .env from .env.example (git-ignored).
  3. Start. The console shows Barbenoire starting (...).

To update: push to Forgejo, then Restart the server.