Security model
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
MZPanel is built so the customer VPS opens no inbound ports, the browser talks to the control plane over a normal authenticated session, and the control plane never stores more secrets than it strictly needs. This page explains the auth layers (including the API tokens your AI agent uses), how agent tokens work, how offsite credentials stay sealed, and what the audit log records.
For a plain-language overview of what is encrypted, who holds which key and how staff access works, start with How MZPanel protects your data.
Auth layers
Section titled “Auth layers”| Layer | From → to | Mechanism |
|---|---|---|
| A | You → dashboard | Session cookie mz_session — httpOnly, SameSite=Lax, Secure |
| B | Dashboard → API | The same session cookie, plus a CSRF token on every write |
| B’ | AI agent / script → API (MCP + REST) | Authorization: Bearer mzmcp_… API token with a level, opt-in scopes and an optional server allowlist |
| C | Agent → API (WS) | Authorization: Bearer <agent_token> on the WebSocket upgrade |
Each layer is independent: a leaked cookie can’t drive an agent, and a leaked agent token can’t sign into your account.
Layer A — you sign into the dashboard
Section titled “Layer A — you sign into the dashboard”You sign in with a magic link (a one-time email link) or with Google /
GitHub OAuth. On success the API sets an opaque session token in the
mz_session cookie — an ID that points at a row in the sessions table, not a
JWT. Signing out revokes that row, so the cookie is dead the moment you log out.
The cookie is httpOnly (JavaScript can’t read it), SameSite=Lax, and Secure
in production.
Layer B — the dashboard calls the API
Section titled “Layer B — the dashboard calls the API”The SPA rides the same mz_session cookie for every request. On top of that,
any state-changing call (POST/PUT/PATCH/DELETE) must present a CSRF
token: a non-httpOnly mz_csrf cookie the SPA reads and mirrors back in an
X-CSRF-Token header (double-submit). A cross-site page can’t read your cookie,
so it can’t forge a matching header — the request is rejected. Idempotent reads
(GET/HEAD) and the agent’s own endpoints are exempt.
Account two-factor authentication
Section titled “Account two-factor authentication”Two-factor authentication (an authenticator app plus single-use recovery codes) is on
every plan, and so are passkeys. With 2FA on, no session is created until the second
factor passes. Sensitive actions (API tokens, team access, DNS and backup credentials)
ask you to confirm once (reauth_required), and that confirmation covers 2 hours on
that browser. Actions that could hand the account to someone else (sign-in email,
passkeys, linked accounts, Vault reset, closing a workspace) need their own
confirmation each time and send a security email. With a passkey the confirmation is
one touch, and it also unlocks the Vault when that passkey can. A workspace owner can
require 2FA for every member.
Each browser signs its requests with its own device key, so a copied cookie does not work elsewhere. A work session lasts as long as you keep using the browser, up to 14 days, then asks again; Strict work session in Settings makes it end at the chosen time instead.
Layer B’ — API tokens for MCP and the REST API
Section titled “Layer B’ — API tokens for MCP and the REST API”An API token (mzmcp_…, created at Advanced > Developer) authenticates both the
MCP endpoint (https://mcp.mzpanel.com) and the REST API (/v1/api/ and the
dashboard’s /v1 routes). It is on every plan.
- Stored hashed. The raw value is shown once at creation.
- Never wider than its creator. A token narrows the grant of the user who minted it. The creator’s current role, capabilities and site scope are checked on every call, and a token whose creator is no longer an active member is refused.
- Level.
read(inspect),operate(day-2 actions such as restarts, SSL renew, cache purge, updates) orfull(provision and change). - Opt-in scopes. Destructive or sensitive actions need an extra scope ticked at
creation, never implied by the level:
servers:enroll,servers:delete,sites:delete,data:delete,backups:restore,files:write,system:admin,team:admin,tokens:admin,webhooks:admin,mail:read,mail:send,mail:modify. A call without the scope fails with403 scope_required(details.required_scope); a token below the needed level gets403 access_level. - Server allowlist. A token can be limited to chosen servers; operations that span the fleet (projects, moves, load balancers) are refused for such a token.
- Never available to tokens. Interactive shells (terminal tickets,
docker.exec), credential-revealing actions (one-click WordPress login, phpMyAdmin sessions, secret reveals) and billing stay dashboard-only. - Rate limit per token by plan: 60, 120, 300 or 600 requests a minute (Free, Plus, Pro, Max), shared by REST and MCP.
- Audited. Every mutation through a token lands in the audit log like a dashboard action.
Layer C — the agent dials home
Section titled “Layer C — the agent dials home”The agent authenticates its outbound WebSocket with a long-lived agent token,
sent as Authorization: Bearer <token> during the upgrade handshake. The control
plane hashes the token (SHA-256) and looks it up before completing the
upgrade, so a bad token gets a clean HTTP status instead of an opaque socket
close:
- 401 Unauthorized — unknown or missing token → the agent keeps retrying.
- 403 Forbidden — the server is suspended → the agent retries (recoverable).
- 410 Gone — the server was deleted → the agent self-uninstalls.
Because the connection is outbound only, there is no listening port on your VPS for an attacker to reach. See The agent for the full connection model.
Agent tokens & registration
Section titled “Agent tokens & registration”The agent’s very first contact uses a short-lived install token, not the long-lived one:
- When you add a server, the panel mints a one-time install token with a
1-hour TTL and wraps it in the
curl … | sudo … bashone-liner. It’s single-use and safe to paste into a command line. - On the box,
install.shposts that install token to/v1/agent/register. The control plane verifies it (not expired, not used, not revoked), creates the server row, and returns a long-lived agent token that authenticates every future WebSocket connection. - Only the hash of each token is ever stored server-side. The raw install token is shown once, at creation, with no recovery path — if you lose it, mint a new one. You can also revoke an unused install token from the panel before it expires.
Credential sealing (zero-knowledge)
Section titled “Credential sealing (zero-knowledge)”When you store credentials for an external destination — an offsite backup bucket (S3 / R2 / B2), a cloud drive, and similar — MZPanel acts as a blind broker: it keeps only ciphertext it cannot read.
Each agent generates a keypair on the box and publishes its public key. When you enter a destination secret in the dashboard, the browser encrypts it (RSA-OAEP + AES-256-GCM) to every server that published a key, and uploads only the sealed blob. The plaintext never touches the control plane; only an agent holding the matching private key can open it.
Agentless (SSH-only) servers use a separate, account-level zero-knowledge vault: your master password derives a key in the browser (PBKDF2-SHA512; in a v3 vault Argon2id combined with a Secret Key that stays on your devices) that wraps a data key, and SSH secrets are encrypted with that data key before upload. The server stores only ciphertext; in a v3 vault the hosts and users of agentless servers are encrypted too. When you open a terminal, the browser decrypts the secret and sends it transiently to the control plane, which holds it in memory for the SSH session only. See Agentless servers.
MZPanel Local (on-box console)
Section titled “MZPanel Local (on-box console)”MZPanel Local is a web console the box serves itself, for
when the control plane is down. It is off by default and turned on from SSH
(mz console on), always over TLS, on a random high port that you can limit to your
IP (--allow-ip). Sign-in is a single-use link printed on the box, or an SSH
password checked against the box’s own sshd (root and sudo members only). It turns
itself off after 24 hours by default, and its audit log is uploaded to
Team > Activity. A web UI cannot do more than its allow-list of actions, and it
cannot reconfigure or re-enable itself.
Audit log
Section titled “Audit log”Every meaningful control-plane action is appended to an immutable audit log:
who (user + org), when, the action (a dotted name like
server.added, auth.login.success, job.dispatched), the target
(server / site / job), the caller’s IP and user-agent, and a small meta
blob. It’s the system of record for what happened across your fleet — far more
durable than shell history.
mz on the box is root-trust
Section titled “mz on the box is root-trust”The layers above govern the panel. Once you SSH into a VPS and run the
mz CLI directly, you’re operating with local root
trust: mz runs as root and has no tier gate and no per-user RBAC — it’s
the raw engine the panel drives on your behalf. Team roles, plan quotas, and the
audit trail are control-plane concepts; they don’t apply to someone who already
has a root shell on the box. Treat SSH access to the VPS as equivalent to full
control of everything on it.
Gotchas & troubleshooting
Section titled “Gotchas & troubleshooting”- Install tokens expire in an hour. If the one-liner sits unused for too long,
registration returns
bad_token— mint a fresh server entry and paste the new command. - A suspended server keeps retrying; a deleted one uninstalls. Suspension
(
403) is recoverable — the agent reconnects once the block clears. Deletion (410) is terminal and tells the agent to remove itself, so don’t delete a server you only mean to pause. - Sealed credentials need at least one online agent’s key. If no server has published its public key yet (for example, before any agent has connected), the dashboard can’t seal a destination secret. Connect an agent first.
- Losing a token means minting a new one. Because only hashes are stored, there’s no “show me the token again.” Revoke and re-create instead.
Related
Section titled “Related”- The agent — the outbound, no-inbound-port connection model.
- Architecture — how the browser, control plane, and box fit together.
- Tiers & quotas — what plan enforcement gates, and where.
- The mz CLI — the on-box engine and its local-trust model.