Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Self-hosted design, and what a connected server shares
milind-soni28883d6eede7
diff --git a/apps/docs/content/docs/self-hosting/connected-servers.mdx b/apps/docs/content/docs/self-hosting/connected-servers.mdxnew file mode 100644index 0000000000..88758da060--- /dev/null+++ b/apps/docs/content/docs/self-hosting/connected-servers.mdx@@ -0,0 +1,93 @@+---+title: What a connected server shares+description: For a security reviewer. Exactly what MausBot can do on a server you connect to it, and what that server sends to MausBot.+icon: ShieldCheck+---++<Callout title="Connected mode is not on sale yet">+ A standalone server, the default, has no connector and nothing on this page applies to it. This page describes the connector's code as it is in the [public repository](https://github.com/milind-soni/OpenMausBot/tree/main/connector), so you can check every line against it. Items marked **planned** do not exist yet.+</Callout>++A connected server is a server of yours that MausBot's control plane (the Admin) manages for you: it starts the MausBot server (the home) there, updates it and watches its health. The part that does this on your server is the **connector**.++## The connector++- One container, `mausbot-connector`, from `ghcr.io/milind-soni/mausbot-connector`, pinned by digest.+- It only calls out: one HTTPS request to enrol, then one WebSocket to the Admin. It opens no port.+- It makes its own Ed25519 key at enrolment. The private key stays on your server. It pins the Admin's signing keys.+- It runs with every Linux capability dropped, a read-only file system and no new privileges.+- It is given Docker's socket, which is root on the server in the hands of any program. What the connector does with it is fixed in its code: the home's container, its data volume and copies of it, short helper containers, and the connector's own replacement. It runs images from `ghcr.io/milind-soni/` only, pinned by digest.++## What MausBot can do: eleven jobs++Every job is signed by the Admin for your server alone and is refused 15 minutes after it was signed. A job of any other kind, or with any other argument, is refused. There is no shell, no command the Admin chooses, and no reading of a file by its path.++| Job | What it does on your server |+|---|---|+| `start` | Starts the home on a named image with the settings the Admin sends (names beginning `OMB_` only) |+| `stop`, `restart` | Stops or restarts the home |+| `update` | Pulls a new image, copies the data, swaps the container and rolls both back if the new version is not healthy |+| `status` | Reads the home's state, the connector's version and the list of copies |+| `backup` | Copies the data to a volume on your server; three are kept |+| `restore` | Puts one of those copies back |+| `export-disk` | **Uploads an archive of the whole data directory to MausBot.** Used to move a Cloud off your server |+| `import-disk` | Replaces the data directory with an archive from an HTTPS address. Used to move a Cloud onto your server |+| `host-health` | Reads the server's size, load and checks (below) |+| `self-update` | Replaces the connector with a newer one from the same registry |++Until your team's Owner accepts the server in MausBot, it answers only `status` and `host-health`.++## What else MausBot can do: requests to the home++On the same connection the Admin can send HTTP requests to the home. The connector passes each one to the home on the server's loopback and nowhere else, one request per stream, with no protocol upgrade. The home treats them as requests from outside: without a member's session it acts only on those signed with its own secret. The signed ones read its health and its team summary (below), and one of them, a **pairing**, opens a sign-in for a named member of your team: it is how the MausBot dashboard signs a person in to your server. A session opened this way can do what that member can do.++Jobs are not limited to reading: `export-disk` and a pairing both reach what people wrote. They are here so you can see them, log them and refuse them.++## Your log and your rules++- **The audit log.** Every job, each of its steps, its result and every request to the home is one line in `/var/log/mausbot/audit.jsonl` on your server, owned by root. A pairing's line names the member and the device. Each line carries the hash of the line before it, so a removed or changed line shows. A job that would change something is refused when the log cannot be written.++ ```sh+ docker exec mausbot-connector mausbot-connector audit --tail 50+ docker exec mausbot-connector mausbot-connector audit --verify+ ```++- **Your policy.** `/etc/mausbot/policy.json`, which only root on your server can write, lists the job kinds MausBot may run and can hold updates. The connector reads it before every job and never writes it.++ ```json+ { "jobs": ["status", "host-health", "update", "backup"], "updates": "hold" }+ ```++ `"jobs": []` refuses every job. Two things the policy does not cover: the connector's own `self-update` is always accepted, and requests to the home are not jobs.++- **Cutting MausBot off.** `docker stop mausbot-connector` ends the connection. The home keeps running and the sessions it already gave out keep working. While the connector is stopped, MausBot's dashboard cannot open a new sign-in, and nothing restarts the home if it stops. A pause switch in MausBot itself is **planned**.++## What the connector sends++| When | What |+|---|---|+| Once, at enrolment | The one-time code, the connector's public key, and the server's facts: operating system, kernel, architecture, CPU count, memory, free disk, Docker version, whether AppArmor and user namespaces are on |+| Every 30 seconds | Those facts, plus total disk, available memory, load, uptime, clock difference and the result of each server check; the home's state, image and version, and its sandbox self-check as a count and check names; the connector's version and image |+| After each job | The result: the home's state and image, the name and time of a copy, or a byte count and checksum. A failure is a fixed code and a sentence that never carries a secret |+| During `export-disk` only | The archive of the data directory |++The connector reads no chat, file, key or name to build any of this, apart from the archive.++## What the home sends++A connected home runs the image our own Clouds run, so it also talks to MausBot itself. Read from the server's code:++- **At each start:** a signed note that it started, with the time.+- **When the Admin asks for health:** versions, start time, counts of turns started and failed, each routine's random id and last status, which engines are installed and signed in, which connected apps are on, sandbox and memory figures, counts such as emails sorted and replies drafted, and incidents as fixed codes. No message text, bot name, title, address or key.+- **On a team's server, when the Admin asks for the team summary** (MausBot's Team admin pages show it)**:** the names of connected apps and MCP servers, the account email each engine is signed in with, and the email addresses of the members who connected each app.+- **Only when a person does it:** a page a bot publishes is uploaded; a report someone sends to the developers carries their message, the bot's name and recent log lines, with secrets removed.+- **Only if your plan includes them:** included AI credit, voice and research send that traffic through MausBot's hosts. With your own keys it goes to the provider directly.+- **Connected apps:** a home registers with MausBot's connected-apps broker at start, and app traffic passes through it while apps are used.+- **In the browser:** [usage analytics](/docs/security/analytics), which each person can turn off.++## Planned++- A seat count in what the server reports. No seat or member count is sent today.+- A connected mode in which nothing a person wrote can leave: today `export-disk`, pairing, the Team admin summary and reports to the developers are the exceptions above.+- Connecting a server that was installed standalone, keeping its data. Today the connector starts a separate home with its own data.+- A published list of the network addresses a connected server needs.diff --git a/apps/docs/content/docs/self-hosting/meta.json b/apps/docs/content/docs/self-hosting/meta.jsonindex a0e3f8201b..c75cc9f80f 100644--- a/apps/docs/content/docs/self-hosting/meta.json+++ b/apps/docs/content/docs/self-hosting/meta.json@@ -5,6 +5,7 @@"index","deploy-vps","networking",- "data-and-backups"+ "data-and-backups",+ "connected-servers"]}diff --git a/docs/design/self-hosted-design.md b/docs/design/self-hosted-design.mdnew file mode 100644index 0000000000..554c162671--- /dev/null+++ b/docs/design/self-hosted-design.md@@ -0,0 +1,142 @@+# Self-hosted MausBot — design++Version 1, 2026-11-10. Each section says what it decides; [Status against the code](#status-against-the-code) says+what exists today. Anything not listed there as built is planned.++## Decision++Sell self-hosted as "your servers, our control plane" (connected mode) on the Business self-hosted plan. No new+repository. Air-gapped comes later.++## Modes of one install++| Mode | Who | Connector | Talks to us |+|---|---|---|---|+| Standalone | Individuals, open-source | No | Only the optional services it already uses |+| Connected | Business self-hosted | Yes | One outbound connection: signed jobs in, version, health, seat count and job results out |+| Air-gapped (later) | Enterprise | No | Nothing; offline licence and update bundles |++A standalone server becomes connected by enrolling the connector. No reinstall, no data move.++## Parts and where the code lives++- **Home**: the server image our own Clouds run (`ghcr.io/milind-soni/openmausbot`). This repository.+- **Connector** (`connector/`): enrols with a one-time code, holds its own Ed25519 key, keeps one outbound WebSocket+ and runs only a fixed job list: `start`, `stop`, `restart`, `update`, `status`, `backup`, `restore`, `export-disk`,+ `import-disk`, `host-health`, `self-update`. No shell, no command of its own choosing, no read of a file by path. In+ this repository, so customers can read what it can do.+- **Installer**: one script with a preflight. This repository.+- **Paid-only features** (SSO, seat checks): `enterprise/` in this repository, under its source-available licence.+- **Control plane**: our Admin, in a private repository: enrolment, entitlements, update scheduling, health, billing,+ operations.+- The licence signing key is in neither repository.++## Principles++1. Customer data stays on the customer's server: bots, chats, files, AI keys, people, roles, activity, usage. The+ admin console is served by their server.+2. Our outage never stops their bots or their sign-in. Only updates and health reporting pause.+3. One image. Self-hosted runs what our Clouds run; no fork, no second profile to keep safe.+4. Security hardening is never paid-only. Any server more than one person can sign in to runs the hardened profile:+ bot sandbox on, service trust (not owner trust) for local requests, AI keys and saved logins out of a bot's reach.+5. The connector's powers are a short published list, every job is signed by us and verified, every job is logged on+ the customer's server, and the customer can pause remote management.+6. What leaves the server in connected mode is a short published list: version, health codes and counts, seat count,+ job results. Nothing a person wrote.++The published lists of principles 5 and 6 are the docs page+[What a connected server shares](../../apps/docs/content/docs/self-hosting/connected-servers.mdx). It describes the+code as it is, including where the code does not meet these two principles yet.++## Updates++- Channel `stable`: a version is promoted to stable only after our own Clouds have run it for 48 hours. `latest` keeps+ following `main` and is not for customers.+- The customer picks a weekly window, and automatic or approve-first.+- Each update: back up first, pull the image by digest, start, check health; on failed health roll back to the+ previous image and the backup, and report it.+- The rule that makes rollback safe: version N's data must stay readable by N-1. The data directory carries a schema+ marker; a change that breaks the rule ships in two releases (read the new format first, write it one release later).+- Standalone servers get the same update as one command they run themselves.+- Skew: desktop and phone apps work with any stable server from the last 90 days; an older server shows a banner.++## Entitlements++Replaces hand-issued licence keys: a signed document with customer, features, seats, issued, expires. Verified offline+with public keys built into the app. Connected servers get a short-lived one (about 35 days) refreshed automatically;+a lapse follows the existing warning and grace, then paid features stop and the server keeps running. Seats are soft:+over the limit blocks new invites and shows a banner, and never locks anyone out.++## Onboarding (connected)++Buy → dashboard account → **Add your own server** shows a one-line command with a single-use one-hour code →+preflight (OS, CPU, RAM, disk, Docker, ports, DNS, outbound) → install → the server appears as pending → the Owner+accepts → own domain with HTTPS → AI keys → invite the team → first bot → choose the update window. Target: under 30+minutes.++## Supported at first++Ubuntu 22.04 and 24.04, x86-64, Docker. arm64 after it is tested.++## Phases++0. Signing key, this document in the repository.+1. Design partners: hardened default, installer with preflight, stable channel and update with rollback, Add your own+ server (backend, UI, signing on), entitlements from the Admin, health and operations for customer servers, runbook.+2. Sellable: OIDC SSO on the home, seat counting, scheduled backups to the customer's bucket, diagnostics bundle,+ checkout, published network list, sizing guide, DPA and SLA.+3. Enterprise: air-gapped, more roles, SCIM, white-label.++## Retire++The Coolify hosted-workspace path (never proven on a real install). `fleet` stays but is not the business offering.++## Status against the code++Read at commit `542f8e55f`. "Built" means the code is in this repository; it does not mean a customer can buy it.++### Built++- The connector: enrolment with a one-time code, its own Ed25519 key, pinned Admin keys, one outbound WebSocket, the+ eleven jobs above, each signed for one server and refused 15 minutes after signing (`connector/src/protocol.ts`,+ `agent.ts`, `jobs.ts`).+- A server the team's Owner has not accepted answers only `status` and `host-health` (`agent.ts`).+- The audit log on the customer's server, `/var/log/mausbot/audit.jsonl`: one line per job, step, result and Admin+ request, each carrying the hash of the line before it. A job that changes something is refused when it cannot be+ logged (`audit.ts`, `jobs.ts`).+- The owner's policy file, `/etc/mausbot/policy.json`: the job kinds we may run, and a hold on updates (`policy.ts`).+- `update` with a safety copy of the data and a rollback of image and data when the new version does not report+ healthy (`home.ts`).+- The connector's own installer with a preflight, `connector/install.sh`, which the Admin is to serve with its address+ and the connector's image digest filled in.+- The offline licence check for paid features (`enterprise/server/license.ts`).++### Different from this document++- **Job list.** An earlier draft listed nine jobs. The code has eleven: `export-disk` uploads a gzip archive of the+ whole data directory to the Admin, and `import-disk` replaces the data directory with an archive from an HTTPS+ address. They move a Cloud between our servers and a customer's. `export-disk` sends everything people wrote, so+ principle 6 does not hold while a server's policy allows it.+- **Requests to the home.** Besides jobs, the Admin opens streams on the same connection, each carrying one HTTP+ request for the home (`home-requests.ts`). The home answers only requests signed with its own secret, among them+ `POST /api/cloud/pairing`, which opens a sign-in for a named member. Each request is in the audit log. The policy+ file does not cover them. They are not on the job list of principle 5.+- **Which image.** The connector starts `ghcr.io/milind-soni/openmausbot-cloud-home` by digest, with the Cloud+ settings the Admin sends, on its own data volume (`mausbot-data`). The standalone install runs+ `ghcr.io/milind-soni/openmausbot` on its own data. Enrolling the connector on a standalone server therefore does+ not connect that server: it prepares a second home beside it. "No reinstall, no data move" is planned.+- **What leaves the server.** A connected home reports more than version, health and job results; the docs page above+ lists it. The connector does not send a seat count.+- **Sign-in during our outage.** The MausBot dashboard signs a person in to a connected home through a pairing the+ Admin sends, so that way in stops while we are down or the connector is stopped. Sessions the home already issued+ keep working. Principle 2 for sign-in is planned.+- **Pausing remote management.** Today that is the policy file (`"jobs": []` refuses every job but the connector's own+ update) or stopping the connector. A switch in the product is planned.+- **The update window.** The connector receives and keeps the window the Admin signs, and runs an update when the+ Admin sends the job. Choosing the window is the Admin's.++### Planned++The installer for the server itself, the `stable` channel (no `stable` image tag is published yet), the hardened default for shared servers, entitlements+from the Admin with seats, Add your own server in the dashboard, the one-command update for standalone servers, the+schema marker in the data directory, the 90-day skew banner, and everything in phases 2 and 3.