Mikrocata is an internal Python service that monitors Suricata eve.json, blocks suspicious IPs on MikroTik, stores state in SQLite, and exposes a small REST API for status and manual control.
Russian documentation: README.ru.md
The repo now contains a rebuilt architecture under mikrocata:
-
APIonFastAPI -
background
workerprocess for log ingestion and blocking -
SQLitestate forblocked_ips,alert_events,app_state,ignore_rules -
.env-driven configuration -
Telegram notifications preserved from the legacy monolith
-
router reboot detection with automatic block resync
- Install dependencies:
python -m pip install -r requirements.txt- Copy env template and fill in your values:
cp .env.example .env- Start the API:
python main.py- Start the worker in a second process:
python worker.pyGET /healthGET /statusGET /blocked-ipsPOST /blocked-ipsDELETE /blocked-ips/{ip_address}GET /alertsPOST /reload-configPOST /worker/resync
Once the API is running, interactive docs are available at /docs.
Use .env.example as the source of truth for available settings.
Main groups:
APP_*: API host/port, DB path, state directory, loggingWORKER_*: polling, startup behavior, router reboot checksMIKROTIK_*: router connection and firewall list settingsTELEGRAM_*: bot token and chat targetSURICATA_*:eve.json, ignore rules file, listened interfaces, severity filterSECURITY_*: whitelist, IPv6, comment timestamp format
python -m pytest tests -qCurrent test coverage includes:
- whitelist and ignore matching
- deduplication
- Telegram message formatting
- worker ingestion and persistence
- repeat alert update behavior
- reboot-triggered resync
- The user-supplied monolith included live-looking
MikroTikandTelegramsecrets. Those should be rotated before production use. - Running the worker requires access to the Suricata log path and the MikroTik API port.