SSH keys & audit
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
The SSH keys tab of a server’s Users & SFTP section (/servers/:id/users)
gives you one box-wide view of every authorized key on the VPS — which user it
opens, whether MZPanel added it, and whether anything looks off. authorized_keys
tells you what’s active but not who added it or when, so MZPanel keeps a small
provenance sidecar on the box and cross-references it with the live keys. It’s
available on all plans (Free).
Add or generate a key, step by step
Section titled “Add or generate a key, step by step”- Open the SSH keys tab and click Add key to reveal the quick-add bar.
- Pick the target user (root and every login/SFTP user on the box are listed).
- Paste a public key — or click Generate SSH key to mint a fresh ed25519 pair right in your browser. The public key drops into the box and the private key is revealed once for you to Copy or Download; it never leaves the page.
- Optionally tick Grant sudo and/or SSH allow-list to add that user to the
sudoers and the sshd
AllowUsersset in the same step. - Click Authorise key. The new row appears in the audit as a Panel-sourced key, recorded with who added it and when.
What else you can do
Section titled “What else you can do”The tab is a searchable list of key cards — user, type and bits, fingerprint, comment/label, source, and date — with anomalies surfaced as chips.
- Filter and search — narrow to Foreign, Root, or Weak keys (each filter only shows when there’s something to see), and search across user, fingerprint, and label.
- Revoke a key — remove it by fingerprint (with a confirm step); the entry is also pruned from the provenance registry.
- Mark known — acknowledge a reviewed foreign key. It keeps a muted “known” chip and drops out of the anomaly count, so the audit reflects only what you haven’t reviewed yet.
- Label a key — store a friendly name against a fingerprint without ever
rewriting
authorized_keys(works for foreign keys too). - Export — download the full audit (not just the filtered view) as CSV. No key material is ever included, so it’s safe to share.
Anomaly chips
Section titled “Anomaly chips”The audit flags keys that deserve a second look:
| Chip | What it means |
|---|---|
| Foreign | In authorized_keys but not added through MZPanel — installed by hand, cloud-init, a script, or pre-existing. A signal, not proof. |
| Root | Authorized on the root account. |
| Weak | DSA, or RSA under 3072 bits. |
| Duplicate | The same fingerprint opens two or more accounts. |
| No comment | No identifying comment on the key. |
How it works
Section titled “How it works”The list reads the agent-pushed ssh_keys inventory — the agent’s native
collectSSHKeys scans every user’s authorized_keys, cross-references the sidecar
provenance registry at /etc/mz/ssh/provenance.json, and returns metadata only
(user, type, bits, fingerprint, comment, source, date). Key bodies are never read or
shown. The snapshot is cached on the control plane, so the page loads instantly, and
re-pushes after every change.
Actions dispatch user.key-* jobs to the agent, which runs them natively:
| Action | Job | Agent does |
|---|---|---|
| Add key | user.key-add | appends to the user’s authorized_keys, records source: panel |
| Revoke | user.key-remove | removes by fingerprint, prunes provenance |
| Mark known / undo | user.key-ack / user.key-unack | flips acknowledged in the registry |
| Label | user.key-label | stores a friendly name in the registry |
Because the label and mark-known state live only in the provenance sidecar, they
never touch authorized_keys — labelling or acknowledging a key changes nothing on
disk about the key itself.
CLI & automation
Section titled “CLI & automation”Every action maps to an mz command on the box — the same engine the dashboard
drives. SSH in and run them directly, or let an on-box AI (ClaudeCode) run them:
mz user key-audit --json # the box-wide audit this page showsmz user key-add <user> "ssh-ed25519 AAAA…" --json # authorise a public keymz user key-remove <user> <fingerprint> --json # revoke by fingerprintmz user key-label <fingerprint> "CI deploy" --json # store a friendly labelkey-ack <user> <fingerprint> / key-unack <fingerprint> toggle the “known” flag.
See The mz CLI and the command catalog.
Gotchas & troubleshooting
Section titled “Gotchas & troubleshooting”- Provenance is a signal, not proof. “Foreign” means only “not added through MZPanel.” A hand-added key that happens to reuse a fingerprint MZPanel once managed will still read as Panel.
- MZPanel never auto-deletes foreign keys. Removing a key is destructive and it might be a legitimate key of your own — you always make that call. Reviewed one you trust? Mark known to silence its chip.
- Needs the agent online. The audit reads through a live agent; when the server is offline the tab shows “Agent offline” rather than stale rows.
- The private key is shown once. After Generate SSH key, copy or download the private half immediately — MZPanel keeps nothing, and dismissing the panel loses it.
- Per-user key management also lives in the Users tab. This tab is the cross-user audit lens; the same add/remove for a single user is available inside that user’s drawer under Users.
Related
Section titled “Related”- The mz CLI — driving the box from the command line.
- Command catalog — every
mzsubcommand.