barbenoire/README.md

44 lines
1.6 KiB
Markdown
Raw Normal View History

2026-10-13 12:06:40 +00: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)
```bash
cscli bouncers add barbenoire # -> CROWDSEC_BOUNCER_KEY (read current decisions)
cscli machines add barbenoire --password '<long random>' -f /dev/null # -> machine login (history + unban)
```
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.