← All projects

monarch

daemon

Source code

Latest version

Version 3.1.11 Dec 2026

Monarch.daemon

The node agent for Monarch.panel, part of Monarch. Formerly ControlCenter.Daemon (controlcenter-daemon); 3.0 renamed it and moves an existing enrollment automatically. It runs as root on every server you manage, opens one outbound WebSocket to the panel, and serves everything the panel needs over it: telemetry, a login shell, VM consoles, libvirt management, services, the journal, storage, containers, accounts, updates, firewall and log shipping. No inbound port is opened, no SSH key is installed.

License Platform Stack

Install and join

# 1. Build and install (needs git and the .NET 10 SDK)
curl -fsSL https://code.weexnes.dev/monarch/daemon/~raw/master/install.sh | sudo bash

# 2. Join, with the command the panel shows under Settings → Nodes → Add node
sudo monarch-daemon join https://panel.example:4382 ccj_… --fingerprint 76BEA1…

join creates the node's key pair, enrolls with the one-time token, writes /etc/monarch-daemon/daemon.json and installs monarch-daemon.service.

Arch Linux: yay -S monarch-daemon.

Commands

Command
join <url> <token> --fingerprint <sha256> [--no-service] [--force] Enroll with a one-time token
run Connect and serve (what the service runs)
status Show enrollment, pin and SMBIOS UUID
leave Remove the enrollment, key and service
install-service / uninstall-service Manage the systemd unit
version Print the version

Security model

  • Enrollment: a join token is single use, expires, and is stored hashed on the panel. The daemon sends a freshly generated ECDSA P-256 public key; the private key never leaves /etc/monarch-daemon/daemon.key (0600).
  • Connecting: the panel sends a random nonce; the daemon signs controlcenter-daemon-auth:v2:<nonce>:<machineId>. No shared secrets travel over the wire.
  • TLS: the panel certificate is pinned by SHA-256 fingerprint. Without a pin the certificate must validate against the system CA store. There is no trust-on-first-use. Plain ws:// is refused except to loopback.
  • Commands: every external program runs without a shell, with arguments passed as a list and validated (names may not start with -). Passwords for chpasswd go over stdin.
  • Removing a node in the panel revokes its key; the daemon cannot reconnect without a new token.

VM binding

The daemon reports /sys/class/dmi/id/product_uuid. libvirt gives every guest its domain UUID as the SMBIOS system UUID, so a daemon running inside a VM managed by another node is matched to that VM automatically (MAC addresses are the fallback, and the panel can bind manually).

Protocol

One WebSocket to /ws/daemon.

  • Text frames are JSON: hello, auth, ready, req/res (RPC), open/opened/close (streams), telemetry (every 2 s), vms (every 5 s), host, ping/pong, plus per-stream controls such as resize, finish and progress.
  • Binary frames carry stream data: a 4-byte big-endian stream id followed by the payload. Panel streams use ids below 0x80000000; the daemon's own (log uploads) start there.

Streams: pty, exec, serial, vnc, journal.follow, ctr.logs.follow, ctr.pull, updates.apply, vol.upload, vol.download, and daemon-initiated logfile.

Build from source

dotnet publish -c Release -r linux-x64 --self-contained false -o ./publish
sudo cp -r ./publish /opt/monarch-daemon
sudo ln -sf /opt/monarch-daemon/Monarch.Daemon /usr/local/bin/monarch-daemon

Linux is the supported platform. The Windows build in CI still compiles but most modules are Linux only.

License

GPL-3.0.