mikroview

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: AGPL-3.0 Imports: 51 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

[!IMPORTANT] Development disclosure: MikroView was coded by Claude under human direction.

MikroView

A real-time firewall "live view" for RouterOS, in the spirit of OPNsense's live view: see every connection attempt as it happens, whether it was accepted, dropped, or rejected, and by which rule — filterable by device, IP/CIDR, port, protocol, interface, or rule.

Ships as a single Docker container. RouterOS pushes firewall log lines to it over syslog (no API access, no credentials, near-zero load on the router); MikroView parses, stores, and streams them to a fast, dark, dependency-light web UI.

MikroView live view showing accepted (green), dropped (amber), and rejected (red) RouterOS firewall connections

Quickstart

cp deploy/config.example.yaml deploy/config.yaml
# edit deploy/config.yaml with your router(s)' names/IPs, then:
chmod 644 deploy/config.yaml

cd deploy
docker compose up -d --build

Then follow docs/routeros-setup.md to point your RouterOS device(s) at the container, and open https://<docker-host> (port 443). A plain http://<docker-host> request on port 80 redirects there automatically. mikroview serves TLS by default with a self-generated certificate (see docs/configuration.md), so your browser will show an untrusted-certificate warning on first visit until you import that certificate -- expected for a self-hosted admin interface with no external CA, same as Proxmox/TrueNAS/pfSense's own web UIs.

Prebuilt image

docker pull ghcr.io/tomlawesome/mikroview:latest

Or run it directly with Compose, without cloning the repo:

services:
  mikroview:
    image: ghcr.io/tomlawesome/mikroview:latest
    restart: unless-stopped
    ports:
      # RouterOS remote-protocol=tls (RFC 5425's syslog-over-TLS port,
      # already unprivileged so no remap is needed). Mikroview's only
      # syslog listener -- comment this out (and set
      # MIKROVIEW_LISTEN_SYSLOG_TLS= below) only if you want no syslog
      # ingest at all.
      - "6514:6514/tcp"
      # HTTPS by default, on the conventional port -- see the Quickstart
      # above and docs/configuration.md's "TLS" section.
      - "443:8080"
      # A plain-HTTP listener that only ever redirects to the HTTPS
      # port above -- never serves real content.
      - "80:8081"
    # Container hardening -- defense in depth on top of the image
    # already being distroless + non-root. mikroview binds only
    # unprivileged ports inside the container (which is why the
    # mappings above exist), so it needs no capabilities at all, and
    # every path it writes to is a mount -- see "Persistent data".
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    read_only: true
    healthcheck:
      test: ["CMD", "/mikroview", "-healthcheck"]
      interval: 30s
      timeout: 5s
      start_period: 10s
      retries: 3
    volumes:
      - ./config.yaml:/etc/mikroview/config.yaml:ro
      # Optional -- see docs/configuration.md's GeoIP section. Requires
      # your own MaxMind GeoLite2 database; uncomment both this and the
      # env var below once you have one.
      # - ./GeoLite2-Country.mmdb:/etc/mikroview/GeoLite2-Country.mmdb:ro
      # Persists flags/accounts/detector settings/the new-device MAC
      # registry/the TLS cert across container recreation, not just
      # restarts -- see "Persistent data" below for what this is and
      # the bind-mount alternative.
      - mikroview-data:/var/lib/mikroview
      # Alternative to the named volume above: a bind mount, if you want
      # to browse/back up the files directly from the host. Comment out
      # the line above and uncomment this one instead (not both) -- see
      # "Persistent data" below for the permissions step this needs
      # first.
      # - ./data:/var/lib/mikroview
    environment:
      - MIKROVIEW_CONFIG=/etc/mikroview/config.yaml
      # - MIKROVIEW_GEOIP_DB_PATH=/etc/mikroview/GeoLite2-Country.mmdb
      # Only needed to move a store somewhere other than the default
      # /var/lib/mikroview/*.json -- see docs/configuration.md.
      # - MIKROVIEW_FLAGS_STORE_PATH=/var/lib/mikroview/flags.json
      # - MIKROVIEW_FLAGS_DETECTOR_SETTINGS_STORE_PATH=/var/lib/mikroview/detector-settings.json
      # - MIKROVIEW_AUTH_STORE_PATH=/var/lib/mikroview/users.json
      # - MIKROVIEW_DEVICE_MAC_STORE_PATH=/var/lib/mikroview/mac-registry.json
      # TLS is on by default and needs no configuration to work -- these
      # are only for customizing it.
      # - MIKROVIEW_TLS_STORE_PATH=/var/lib/mikroview/tls
      # - MIKROVIEW_TLS_HOSTS=192.168.1.50,mikroview.local
      # - MIKROVIEW_TLS_CERT_FILE=/etc/mikroview/tls.crt
      # - MIKROVIEW_TLS_KEY_FILE=/etc/mikroview/tls.key
      # Read docs/configuration.md's "TLS" section before using this --
      # only safe if this port is unreachable except from your own
      # isolated-network reverse proxy.
      # - MIKROVIEW_TLS_ENABLED=false
      # Disables the plain-HTTP redirect-only listener above -- only
      # needed if you've removed the "80:8081" port mapping too (e.g.
      # your reverse proxy handles the HTTP->HTTPS redirect itself).
      # - MIKROVIEW_LISTEN_HTTP_REDIRECT=
      # Disables syslog ingest entirely -- mikroview's only syslog
      # listener is RouterOS remote-protocol=tls, so only set this if
      # you don't want firewall events at all. Remove the "6514:6514/tcp"
      # port mapping above too if you do.
      # - MIKROVIEW_LISTEN_SYSLOG_TLS=

volumes:
  mikroview-data:

Image tags: latest is the only tag intended for general use -- it's whatever was most recently promoted from preview after passing CI and a container smoke test there. preview-<7-char-sha> tags exist for every build off the preview branch, if you ever want to pin to a specific one rather than track latest. There is deliberately no dev tag: pushing to the dev branch never triggers a build at all, so nothing publishes from it -- if you ever see one referenced anywhere (including in your own docker images history), treat it as stale rather than a live channel, since nothing keeps it current.

Create config.yaml next to it first (see deploy/config.example.yaml for the full option reference), then docker compose up -d. This mirrors deploy/docker-compose.yml exactly, just swapping the local build: for the prebuilt image:.

Persistent data

By default, both compose files above mount a named volume over /var/lib/mikroview -- where flags, local accounts, detector on/off toggles, the new-device detector's MAC registry, and the self-generated TLS certificate all persist. This is the default deliberately: once you've set up authentication or have flags worth keeping, losing them on every docker compose down or image update -- not just a plain restart -- would be a bad surprise, not an edge case. Docker populates a fresh named volume from the image's own /var/lib/mikroview on first use, ownership included, so there's no setup step needed.

The tradeoff is that you can't cat/cp/back up the files directly from the host the way you can with a bind mount -- you'd go through docker run --rm -v mikroview-data:/data ... or docker cp instead. If you want that direct host access, switch to the commented-out bind mount in either compose file (./data:/var/lib/mikroview) instead of the named volume -- but it needs one extra step first: mikroview runs as a fixed non-root user inside the container, uid 65532, gid 65532 (distroless's built-in nonroot account, same identity used by the --chown in the Dockerfile), which can't chown a host directory the way a root-run container could. Pick one before starting:

# Preferred: exact uid/gid ownership, nothing broader
mkdir -p data
sudo chown 65532:65532 data
# No root available on the host: open it up to everyone instead
mkdir -p data
chmod 777 data

The same fix applies to any other host path you bind-mount over a /var/lib/mikroview/* sub-path (e.g. flags.storePath, auth.storePath, tls.storePath — see docs/configuration.md), or over /etc/mikroview/GeoLite2-Country.mmdb if you ever mount that read-write. Read-only mounts like config.yaml don't need either fix — world-readable (chmod 644, as in the Quickstart above) is enough, since the container only needs to read it, not own it.

If a bind mount is misconfigured (wrong ownership), mikroview logs permission denied at startup and falls back to in-memory-only state rather than crashing — annoying (you lose flags/accounts/TLS cert on every restart) but not fatal.

Features

  • Ingestion: RouterOS forwards firewall log lines via /system logging over syslog-over-TLS (remote-protocol=tls). No polling, no RouterOS API access, no credentials — push-based and cheap for the router.
  • Parsing: a RouterOS-specific parser decodes chain, action, rule label, interfaces, protocol, addresses/ports, and length from each log line. See docs/routeros-setup.md for the log-prefix convention that makes "accept vs. drop vs. reject" and the responsible rule visible at all.
  • Storage: in-memory only, a fixed-capacity ring buffer windowed to a configurable retention period (default 24h) — no database, and no disk persistence. All retained events are lost on restart, redeploy, or crash; MikroView is a live/recent-history view, not a log archive. The one deliberate exception is behavioral flags (see below), which can optionally persist to a small JSON file since they're meant to stay visible until a human clears them.
  • Behavioral flags: watches for port scans, per-source activity spikes, repeated attempts against critical ports (SSH, RDP, Winbox, ...) from external IPs, and network-wide volume spikes — each raises a flag for a human to review and clear, never an automatic action. See docs/configuration.md for the detectors and their thresholds.
  • Watchlist: operator-defined entries, persisted and queryable, in two modes — record ("watch attempts against these ports") and invert ("this device should only ever reach these destinations", reviewed via an observe-then-promote workflow before anything is treated as a violation). Tuning entries against your own network's traffic is expected and ongoing, not a one-time setup step: mikroview presents what it saw and lets you decide what's expected, it never decides that for you. And like everything else here, it only ever sees what the router is actually configured to log — an entry with no matches can mean "nothing happened" or "nothing logs this," and telling those apart is on the operator, not the tool. See docs/configuration.md's "Watchlist" section. Entries can also be suggested from data your router has already pushed (named DHCP leases, ports an existing rule already blocks), so there's something to react to rather than a blank page — reviewed Off/Accepted/Hidden, never applied automatically. See that section's "Suggested watchlist entries" subsection.
  • Live updates: a WebSocket pushes new events to the browser in real time; historical/filtered queries go through a REST endpoint against the retained buffer. See docs/configuration.md for the API and the server/client filtering split.
  • UI: Svelte, no component framework, dark professional theme, ~50KB JS bundle.
  • Logging: leveled (debug/info/warn/error) and colorized server output, auto-plain when piped or NO_COLOR is set. See docs/configuration.md's "Logging" section.
  • Authentication: required, always. On first load mikroview asks you to create the admin account, and serves nothing else until you do. After that it is required for everything except the health check (Argon2id-hashed passwords, opaque server-side sessions, self-registration for the first/super-admin account only). Local accounts and single sign-on via an external OIDC identity provider (e.g. Authentik, Keycloak, Entra ID) can both be enabled at once. See docs/configuration.md and SECURITY.md for the threat model and setup.

Security levels

Auth isn't one setting — the choice you make trades off convenience against how much a compromise of the mikroview host itself can expose. From least to most isolated:

  1. Local accounts (username/password). The floor — mikroview will not serve anything until one exists. Simplest to set up, but account data — usernames and roles, including who's the admin — lives in a plaintext file on the same host mikroview runs on. There's no separation between "the app is compromised" and "the account data is readable": a leaked backup, a misconfigured mount, or anything that exposes that one file hands over who to target, and local login security then depends entirely on password strength.
  2. OIDC/SSO (recommended when available). The real credential lives with your external identity provider (Authentik, Keycloak, Entra ID, ...), never on the mikroview host — compromising the host doesn't expose anything usable against an SSO-provisioned account. Local and SSO accounts can coexist.
  3. Off-box database backend (Postgres, optional). Moving persisted state to a separately-secured, network-restricted database closes the "read one file, get everything" exposure that local accounts still have today. See docs/configuration.md for setup — added in issue #131.

Pick the level that matches your network: local accounts are the floor, and SSO is worth preferring wherever you have an identity provider available. Full detail and the reasoning behind each is in SECURITY.md.

Docs

License

MikroView is free and open source under the GNU AGPL v3.0. You can use, modify and self-host it at no cost, including inside a business.

If you want to bundle MikroView into a commercial product, offer it as a hosted service, or ship changes without publishing them, a commercial licence is available — see COMMERCIAL-LICENSE.md.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
api
Package api exposes the HTTP/WebSocket surface: historical event queries, device/stat snapshots, and the live-tail WebSocket feed.
Package api exposes the HTTP/WebSocket surface: historical event queries, device/stat snapshots, and the live-tail WebSocket feed.
audit
Package audit records who did what admin-privileged mutation in mikroview itself, when, and to what -- an accountability log for the humans operating mikroview, distinct from internal/flags (which is about behavior mikroview *observes on the network*, not actions taken *in* mikroview) and from internal/store (raw ingested firewall events).
Package audit records who did what admin-privileged mutation in mikroview itself, when, and to what -- an accountability log for the humans operating mikroview, distinct from internal/flags (which is about behavior mikroview *observes on the network*, not actions taken *in* mikroview) and from internal/store (raw ingested firewall events).
auth
Package auth implements mikroview's local username/password authentication: user accounts (this file), Argon2id password hashing (password.go), in-memory sessions (session.go), and login-attempt rate limiting (ratelimit.go).
Package auth implements mikroview's local username/password authentication: user accounts (this file), Argon2id password hashing (password.go), in-memory sessions (session.go), and login-attempt rate limiting (ratelimit.go).
backup
Package backup reads and writes mikroview's whole persisted state as a single gzipped JSON document (issue #97).
Package backup reads and writes mikroview's whole persisted state as a single gzipped JSON document (issue #97).
blocklist
Package blocklist implements local IP/CIDR "known-bad" matching against a small, vetted menu of free, curated threat-intel feeds (issue #113 Part B) -- deliberately *not* an arbitrary user-supplied URL field.
Package blocklist implements local IP/CIDR "known-bad" matching against a small, vetted menu of free, curated threat-intel feeds (issue #113 Part B) -- deliberately *not* an arbitrary user-supplied URL field.
config
Package config loads mikroview's configuration with precedence defaults < YAML file < environment variables < CLI flags.
Package config loads mikroview's configuration with precedence defaults < YAML file < environment variables < CLI flags.
detect
Package detect watches the ingested event stream for a small set of behavioral patterns worth a human's attention -- a source scanning many ports, a source generating an unusual volume of traffic, repeated attempts against a critical service port from outside the LAN, and a sudden spike in overall traffic.
Package detect watches the ingested event stream for a small set of behavioral patterns worth a human's attention -- a source scanning many ports, a source generating an unusual volume of traffic, repeated attempts against a critical service port from outside the LAN, and a sudden spike in overall traffic.
device
Package device resolves syslog source IPs to RouterOS device identity.
Package device resolves syslog source IPs to RouterOS device identity.
entities
Package entities is the shared primitive behind two roadmap items (issue #107): a persisted, admin-manageable record per (entity type, key) with an optional friendly label and open-ended tags.
Package entities is the shared primitive behind two roadmap items (issue #107): a persisted, admin-manageable record per (entity type, key) with an optional friendly label and open-ended tags.
evict
Package evict bounds maps whose keys come from untrusted input.
Package evict bounds maps whose keys come from untrusted input.
flags
Package flags stores manually-clearable behavioral flags raised by internal/detect (port scans, per-source activity spikes, repeated critical-port attempts, global volume spikes).
Package flags stores manually-clearable behavioral flags raised by internal/detect (port scans, per-source activity spikes, repeated critical-port attempts, global volume spikes).
geoip
Package geoip resolves public IPs to a country code using an optional, locally-mounted MaxMind GeoLite2-Country database.
Package geoip resolves public IPs to a country code using an optional, locally-mounted MaxMind GeoLite2-Country database.
hub
Package hub fans newly inserted events out to connected WebSocket clients for the live-tail view.
Package hub fans newly inserted events out to connected WebSocket clients for the live-tail view.
ingest
Package ingest is the payload schema and validation for issue #186's RouterOS push ingest (step 2): what a router-side script may POST to POST /api/ingest/routeros, and the strict decoding that stands between that attacker-shaped input and the rest of mikroview.
Package ingest is the payload schema and validation for issue #186's RouterOS push ingest (step 2): what a router-side script may POST to POST /api/ingest/routeros, and the strict decoding that stands between that attacker-shaped input and the rest of mikroview.
logging
Package logging is mikroview's server-side log formatting: leveled, colorized (auto-disabled off a TTY or with NO_COLOR set), with a stable component column so a scrolling terminal or `docker logs` stays scannable.
Package logging is mikroview's server-side log formatting: leveled, colorized (auto-disabled off a TTY or with NO_COLOR set), with a stable component column so a scrolling terminal or `docker logs` stays scannable.
matchlog
Package matchlog persists watchlist matches (#243) -- the discrete, rare, high-value events a control-port/watchlist entry raises, distinct from internal/store's high-volume, volatile event ring and from internal/flags' aggregate, capped-evidence judgements.
Package matchlog persists watchlist matches (#243) -- the discrete, rare, high-value events a control-port/watchlist entry raises, distinct from internal/store's high-volume, volatile event ring and from internal/flags' aggregate, capped-evidence judgements.
naming
Package naming resolves friendly display names for firewall rule labels, host IPs, and (issue #109) ports from two layers: internal/ config's static RuleNames/HostNames maps (config-driven only, no auto-discovery or liveness tracking the way internal/device's Registry has, since a rule label or a host IP doesn't have a "connection" to observe the way a syslog source does), and, taking precedence when set, internal/entities' live, admin-manageable Store (issue #107) -- so an alias edited in the UI overrides the YAML-configured one for the same key without a restart, while config.yaml stays a fully supported fallback for anything not (yet) given an entity.
Package naming resolves friendly display names for firewall rule labels, host IPs, and (issue #109) ports from two layers: internal/ config's static RuleNames/HostNames maps (config-driven only, no auto-discovery or liveness tracking the way internal/device's Registry has, since a rule label or a host IP doesn't have a "connection" to observe the way a syslog source does), and, taking precedence when set, internal/entities' live, admin-manageable Store (issue #107) -- so an alias edited in the UI overrides the YAML-configured one for the same key without a restart, while config.yaml stays a fully supported fallback for anything not (yet) given an entity.
netclass
Package netclass attributes an IP address to a network class -- Tor exit, commercial VPN, cloud/datacenter, privacy relay -- from a small vetted menu of feeds, refreshed on a timer and matched locally.
Package netclass attributes an IP address to a network class -- Tor exit, commercial VPN, cloud/datacenter, privacy relay -- from a small vetted menu of feeds, refreshed on a timer and matched locally.
notify
Package notify delivers newly-raised behavioral flags (see internal/flags) somewhere outside the mikroview UI, batched rather than one message per flag so a real incident (many flags firing in quick succession) doesn't flood whatever channel is receiving them.
Package notify delivers newly-raised behavioral flags (see internal/flags) somewhere outside the mikroview UI, batched rather than one message per flag so a real incident (many flags firing in quick succession) doesn't flood whatever channel is receiving them.
oidc
Package oidc is mikroview's OIDC/SSO relying-party layer: provider discovery, the Authorization Code + PKCE flow, and ID token verification.
Package oidc is mikroview's OIDC/SSO relying-party layer: provider discovery, the Authorization Code + PKCE flow, and ID token verification.
persist
Package persist is the storage boundary the six persisted stores sit on: accounts/tokens (internal/auth), flags, entities, the MAC registry, rule usage, and detector settings.
Package persist is the storage boundary the six persisted stores sit on: accounts/tokens (internal/auth), flags, entities, the MAC registry, rule usage, and detector settings.
reputation
Package reputation provides on-demand IP reputation/threat-intel lookups for public addresses, combining a free keyless source (Shodan InternetDB) with an optional source that needs an API key (AbuseIPDB).
Package reputation provides on-demand IP reputation/threat-intel lookups for public addresses, combining a free keyless source (Shodan InternetDB) with an optional source that needs an API key (AbuseIPDB).
routeros
Package routeros decodes the body of a RouterOS firewall log message (the part after the syslog envelope has already been stripped) into structured fields.
Package routeros decodes the body of a RouterOS firewall log message (the part after the syslog envelope has already been stripped) into structured fields.
routerstate
Package routerstate holds the most recent state each router pushed via POST /api/ingest/routeros (issue #186 step 4): its firewall rule table, NAT table, and the host-identity records (DNS static entries, DHCP leases, WireGuard peers) that give addresses the operator's own names.
Package routerstate holds the most recent state each router pushed via POST /api/ingest/routeros (issue #186 step 4): its firewall rule table, NAT table, and the host-identity records (DNS static entries, DHCP leases, WireGuard peers) that give addresses the operator's own names.
rules
Package rules persists a long-lived, per-rule-label usage record -- when a firewall rule was first observed firing, when it last fired, and how many times -- independent of internal/store's ring buffer.
Package rules persists a long-lived, per-rule-label usage record -- when a firewall rule was first observed firing, when it last fired, and how many times -- independent of internal/store's ring buffer.
servertls
Package servertls provides mikroview's TLS certificate, either loaded from an operator-supplied cert/key pair or, as the zero-config default, a self-generated local certificate authority + leaf certificate.
Package servertls provides mikroview's TLS certificate, either loaded from an operator-supplied cert/key pair or, as the zero-config default, a self-generated local certificate authority + leaf certificate.
setup
Package setup records what mikroview has observed of a router's setup, so the guided wizard (issue #320) can tell an operator that a step worked instead of asking them to go and look.
Package setup records what mikroview has observed of a router's setup, so the guided wizard (issue #320) can tell an operator that a step worked instead of asking them to go and look.
store
Package store holds the in-memory, time-windowed event buffer.
Package store holds the in-memory, time-windowed event buffer.
suggest
Package suggest is #243 slice 5: watchlist entries suggested from data RouterOS has already pushed (internal/routerstate), rather than an operator having to already know what to watch.
Package suggest is #243 slice 5: watchlist entries suggested from data RouterOS has already pushed (internal/routerstate), rather than an operator having to already know what to watch.
syslog
Package syslog parses the BSD/RFC3164-style syslog lines that RouterOS emits, and listens for them over UDP/TCP.
Package syslog parses the BSD/RFC3164-style syslog lines that RouterOS emits, and listens for them over UDP/TCP.
tlssniff
Package tlssniff lets one port answer both a TLS client and someone who typed the address into a browser.
Package tlssniff lets one port answer both a TLS client and someone who typed the address into a browser.
watchlist
Package watchlist is the operator-owned entry set #243 grew Control Ports into: a persisted, admin-manageable list of (source, destination, port set) tuples, replacing the single flat criticalPorts port list every operator previously shared regardless of what they actually wanted watched.
Package watchlist is the operator-owned entry set #243 grew Control Ports into: a persisted, admin-manageable list of (source, destination, port set) tuples, replacing the single flat criticalPorts port list every operator previously shared regardless of what they actually wanted watched.
Package web embeds the built frontend into the mikroview binary so it ships as a single self-contained executable/image.
Package web embeds the built frontend into the mikroview binary so it ships as a single self-contained executable/image.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL