# 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
` | Banned right now? Country, AS, alert history, CTI/Shodan links | | `/unban
` | 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) ```bash 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. ```bash cscli machines add barbenoire --password '' -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 ```bash 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.