Hey everyone!
I wanted to share a little project I've been working on: connecting a local LLM running in **Open WebUI** to my **MikroTik CCR1009 router** and a couple of Linux VDS servers using a custom Python Tool (`paramiko`).
Instead of just generating copy-paste commands, the AI has direct read/write SSH access (using a dedicated `AI OPS` user with Ed25519 keys) and follows strict operational guardrails.
### What it can actually do:
- **MikroTik RouterOS CLI integration:** Checks system health, active sessions, filtered logs, and large firewall `address-list`s (using `terse`, `without-paging`, and `count-only` so the SSH channel never hangs on 2,000+ entries).
- **Cross-server `whois` & ASN verification:** When I ask it to find subnets for blocked IPs on MikroTik, it doesn't blindly guess `/24`. It runs a batch `whois` lookup on one of my Linux VDS nodes to find the actual announced CIDR prefix and ASN owner, warning me if a subnet belongs to a major cloud/CDN or mobile carrier.
- **Human-in-the-loop safety:** The system prompt strictly forbids modifying firewall rules, routes, or `address-list`s without first showing the exact RouterOS commands, assessing blast radius, and waiting for my explicit confirmation. It also enforces standardized comments (`YYYY-MM-DD | Owner/ASN | Source`) on every new entry.
### Example workflow from today:
- I asked it to summarize my blacklists (&& "Selectel") on MikroTik and find the underlying subnets.
- It fetched the IPs from RouterOS, queried `whois` via my VDS, and flagged an `82.152.0.0/15` block as too broad/risky.
- After I confirmed, it added the prefixes to my target list with proper timestamps and ASN comments.
### Tech Stack:
* **Frontend / Agent:** Open WebUI (custom Python Tool with `paramiko` + Pydantic `Valves`)
* **Router:** MikroTik CCR (RouterOS)
* **Servers:** Ubuntu VDS nodes (for `whois`, `dig`, `fail2ban`, `lynis`) ( to bypass blocking etc)
* **Baremetall selfhost:** Inspur5212 +Tesla V100 ))
* * In fact, the local Ai has full control of linux systems ..
Happy to share the sanitized Python tool code and system prompt if anyone wants to build something similar! What guardrails do you think are must-haves when letting an LLM touch network gear?