Security model
This page explains how MoorCP Shared protects the panel, hosting servers, and customer accounts: agent identity, isolation between accounts, tokens, permissions, origin separation, 2FA, and a hardening checklist for production.
Overview
Staff browser ──HTTPS :8443──▶ ┌──────────────────────────────┐
Billing (API key, mTLS) ──────▶│ moorcp-shared (control plane)│
Client browser ──HTTPS :2083──▶│ PostgreSQL · secrets · audit │
└──────────────┬───────────────┘
│ mTLS (internal CA)
▼ :7443
moorcp-agent on each hosting server
(allowlisted operations only)- The panel is the only one that can command agents.
- Agents only run registered operations (
area.action). There are no free shell commands from the panel. - Every change is recorded in the audit log with its actor.
Agent identity (mTLS)
The panel and agents recognize each other with certificates from the panel's internal CA.
| Rule | Notes |
|---|---|
| Registration | A new server registers with a one-time registration token. The panel decides the agent certificate's CN and SAN, not the agent. |
| Hostname | Must be a valid lowercase host name. The panel's certificate names are refused. |
| Re-enrollment | An already registered server can only be re-enrolled with a token for that specific server, so an ordinary token cannot overwrite an existing server. |
| Commands to agents | Agents only accept client-auth certificates with the panel's CN. Every command has issued_at and expires_at (max 24 hours). |
| Connection direction | Panel → agent on port 7443 (TLS 1.3). Agent → panel for heartbeats every 30 seconds on port 8443. |
| Validity | Agent certificates last 1 year and renew automatically when less than 30 days remain. Old certificates (for example from a backup) are refused once the agent uses the new one. |
| Manual rotation | Servers › server › mTLS certificate › rotate, or POST /v1/servers/{id}/cert/rotate |
The agent_cert_expiring and cp_cert_expiring alerts appear when automatic renewal fails.
WARNING
The /etc/moorcp-shared/pki/ directory holds the CA key. Anyone who has that key can issue agent certificates. Limit root access to the panel server and include this directory in an encrypted panel backup.
Isolation between accounts
Isolation depends on the server driver:
| Driver | When | Isolation |
|---|---|---|
cloudlinux | CloudLinux servers with LVE and CageFS | LVE for CPU, RAM, IO, processes; CageFS for a per-account file system |
generic | AlmaLinux, Rocky Linux, RHEL 9 | systemd slice per user (CPU, RAM, processes, IO), XFS quotas for disk and inodes, /proc hidepid, /home 0711, account home 750 |
Extra layers on every driver:
- Web terminal, SSH, and cron run in a bubblewrap jail: read-only system,
/homecontains only the account's home, private/tmp, other accounts' processes are invisible, and panel directories are hidden. - Packages without the SSH feature only get chrooted SFTP. TCP, agent, and X11 forwarding and tunnels are off.
- PHP-FPM runs with a pool per account per version.
- Apache
.htaccessis restricted:Options +ExecCGI,+Includes, and+FollowSymLinksproduce a 500 error. Use+SymLinksIfOwnerMatch. Rewrite, auth, header, and other safe directives work. Handler directives (SetHandler,AddHandler,Action) are ignored instead of giving an error, so a migrated cPanel.htaccesswith anAddHandlerline for a PHP version keeps working; choose the PHP version in the panel instead. PHP settings cannot be passed throughPHP_VALUEorPHP_ADMIN_VALUE; use the panel's PHP settings. - Symlinks are only followed when the link and its target have the same owner, checked along the whole path from the account's home to the file (Nginx and Apache), so a symlinked folder between the home and the document root cannot point into another account.
- Backup restore: database dumps from an account backup are restored with the account's own database user, not as the MariaDB admin, and only into the account's own databases.
- MariaDB: database and user names always carry the account prefix, and the
_/%wildcards are escaped in GRANT. - cPanel import: SQL from the archive runs as a database user owned by the account, not as the MariaDB root.
- Domains: the panel refuses a domain already owned by another account, including a parent domain when another account owns one of its subdomains. Reserved names cannot be used by any account as a main domain, website, alias, or DNS zone, including their subdomains: server hostnames, the panel hostnames (admin, client, and application URLs), the panel nameservers, and external DNSOnly node hosts. The parent domain itself, for example the hosting provider's own domain, stays allowed.
- Files owned by accounts are treated as untrusted when root reads or writes them: the home copy during a cPanel sync never follows symlinks, and the cron history only reads regular files (at most the last 8 MiB).
- Client SFTP/SSH: clients can get their own SFTP/SSH port, served by a separate SSH service that only accepts hosting accounts, while the root SSH port stays unchanged. Password login for clients is off by default per server, and each account can limit SFTP/SSH to an IP allowlist.
A server's detail page shows a weak isolation badge when the driver does not give strong isolation. See CloudLinux for converting a server.
Email
- SMTP login only on ports 587 (STARTTLS) and 465 (SSL). The sender must match the login account. Port 25 does not accept logins.
- DKIM signing only happens when the From domain equals the login account's domain.
- Aliases/forwarders have at most 20 destinations. Catch-all only to the account's own mailboxes.
- Send spikes and outgoing spam block the mailbox from sending (
mail_send_blockedalert). - The Rspamd web UI (Servers › server name › Settings › Email & webmail) is for admins only. The panel signs you in; the Rspamd controller password never reaches the browser. Local processes on the server, including hosting accounts, cannot use the Rspamd controller without that password.
Tokens and links
| Type | Lifetime | Notes |
|---|---|---|
| Client panel SSO link | 60 seconds, single use | Section and target are signed. Free-form destination URLs are refused. |
| Client panel session | 8 hours | Revoked on logout, client password change/removal, or 2FA turned off/reset |
| Staff session | 12 hours absolute, 2 hours idle | Revoked when the staff member's role, password, status, or 2FA changes |
| File and backup download links | Short, signed | Separate token type; tokens for other features cannot download files |
| phpMyAdmin, AdminNeo, Softaculous, webmail links | Single use | Created per request |
| Rspamd web UI link | 60 seconds, single use | Opens a session of 1 hour on the admin apps origin (2086) |
| API key | Until revoked or expiresAt | Only the hash is stored |
Stored secrets
Secrets in the database (TOTP secrets, SMTP passwords, Telegram tokens, migration source SSH keys and tokens, the panel backup recovery key, webhook secrets) are encrypted with AES-256-GCM using a versioned data key. The data key is wrapped by a master key from the environment (MOORCP_SECRETS_KEY), so a database dump alone is not enough to open the secrets.
- The data key rotates automatically every 90 days (
MOORCP_SECRETS_ROTATE_DAYS). - Manual rotation: Settings › Secrets & encryption › Rotate data key, or
moorcp-shared secrets rotate.
Permissions
| Role | Permissions |
|---|---|
| admin | All operations |
| technician | Everything except staff, API keys, secrets, notification channels, and the admin-only operations below |
| support | Read only, plus suspend/unsuspend, server ping, post-migration checks, alert ack |
| billing (API key) | Provisioning and client operations on accounts of the key's owner |
Only an admin may:
- change login (brute force) protection;
- move an account's billing owner;
- reboot a server;
- add a server over SSH, and change a server's hostname;
- change and test a server's SMTP relay (smarthost);
- remove account backup snapshots;
- change the default nameservers;
- add, remove, and promote nameserver nodes, manage cPanel DNSOnly replicas, and release replica zone holds;
- open and close server firewall ports, and turn on firewalld;
- change SSH settings of a server (root SSH port, client SFTP/SSH port and password login);
- open the Rspamd web UI;
- download the panel backup recovery kit (with password and 2FA typed again; API keys are refused);
- manage staff, API keys, secrets, webhooks, and the license (activate, install, remove).
The last active admin cannot be demoted or deactivated. Risky actions (suspend, terminate, changing access controls) require a reason that is recorded in the audit log.
Clients only see a summary of their own account's activity, without staff email or IPs and without agent output.
When an admin turns off management from billing for an account, billing API keys can still run the account lifecycle (suspend, package, terminate), but creating client login links, changing the client password or 2FA, and changing the contact are refused with 403 cp.billing_management_disabled.
Origin separation
Every interface has its own origin (port), so cookies and scripts from one interface cannot touch another.
| Port | Origin | Content |
|---|---|---|
| 8443 | Admin | Admin GUI, API v1, agent endpoints |
| 2083 | Client | Client panel. Only client session cookies are accepted; admin cookies and API keys are ignored. |
| 2085 | Client apps | Softaculous for clients |
| 2086 | Admin apps | Vendor admin UIs (Softaculous admin, CloudLinux Manager, Rspamd web UI) |
- The admin GUI is served with CSP
default-src 'self'andframe-ancestors 'none'. The staff session cookie is SameSite=Strict. - The admin apps origin (2086) refuses requests triggered by other pages, except one-time SSO links. Only the exact SSO entry paths are accepted, and a browser request whose
OriginorReferernames another site is refused. - Changing requests in the admin GUI and client panel require a CSRF token.
2FA
| User | Behavior |
|---|---|
| Staff | Optional TOTP, enabled from Profile & security. MOORCP_ADMIN_REQUIRE_2FA=true makes it required for all staff. Codes that were already used are refused. |
| Client | Optional TOTP for password login, enabled by the client in the client panel Settings. SSO and Login as do not ask for 2FA because they are already authenticated in billing or the admin panel. |
Resetting 2FA:
- staff:
moorcp-shared staff reset-2fa --email ops@example.comon the panel server; - client: an admin or billing with
DELETE /v1/accounts/{id}/client-totp.
Login protection
Wrong admin logins, client logins, and API keys are counted per IP, per user + IP, and per account:
| Rule | Default |
|---|---|
| Per IP | 10 failures / 15 minutes |
| Per user + IP | 5 failures / 15 minutes |
| Per account (from all IPs) | 20 failures / 15 minutes; only locks IPs that never logged in to that account successfully |
| Lock duration | 15 minutes, doubling when locked again within 24 hours, max 24 hours |
Locked requests get 429 cp.auth_locked. Failures are written to /var/log/moorcp-shared/auth.log, which CrowdSec on the panel server can read to block IPs in the firewall. The settings and lock list are under Security › Network & Access (Login protection and the Lockouts tab).
Websites
- ModSecurity WAF + OWASP CRS per website.
- CrowdSec per server to block IPs based on behavior.
- ClamAV malware scanning with quarantine.
See Security.
Server firewall ports
Admins can open and close TCP/UDP ports in firewalld on each server from Security › Network & Access › the Firewall ports tab.
- A single port or a range (max 10,000 ports), TCP or UDP, in the default firewalld zone. Rules are written to runtime and permanent at the same time, without a reload, so CrowdSec's block tables are not disturbed.
- These ports are protected and cannot be closed from the panel: SSH (from
Portinsshd_config, default 22), the client SFTP/SSH port, 80, 443/tcp, 443/udp, 8443, 2083, 2085, 2086, and the agent port (default 7443). The agent enforces this too, not only the GUI. - firewalld is only started when an admin asks for it. If firewalld is not installed or not running, the tab says so, and every port that a service listens on stays reachable. An admin can click Enable firewalld (or Install & enable firewalld). Before it starts, the SSH ports in use, the panel and agent ports, and the installed web, mail, FTP, and DNS services are opened. If the panel cannot reach the server again within 90 seconds, firewalld turns itself off so you are not locked out. See Security.
- Every change is audited as
server.port_openorserver.port_close.
API: GET /v1/servers/{id}/firewall, POST /v1/servers/{id}/firewall/ports ({"port": "3000", "proto": "tcp"}), and DELETE /v1/servers/{id}/firewall/ports?port=3000&proto=tcp.
Installer and releases
- Releases are signed with ed25519 and verified by the installer before installation. The panel also verifies the release list's signature every time it checks for a new release.
- Upgrade refuses downgrades unless
--allow-downgradeis given. - Upgrading from the panel does not give the panel root rights. The panel (user
moorcp) only writes a request; the root systemd unitmoorcp-shared-upgradeverifies the signed release and then runs the installer. The channel and mirror come from a root-owned file, not from the panel. - See Updates and releases.
Adding servers over SSH
Servers › Add server installs the agent on a new server over SSH, with the root login or a sudo user, by password or key:
- the SSH credentials are only kept in the panel's memory and are deleted when the installation ends; they are never stored in the database or the audit log;
- the connection test shows the server's SHA256 host key for you to confirm, and the installation only continues with that same key;
- the audit log records
server.install_start,server.install_reboot, andserver.install_finish, without secrets.
Hardening checklist
Do these after a production installation:
- Change the initial admin password, then delete
/etc/moorcp-shared/initial-admin-password. - Enable 2FA for all staff, then set
MOORCP_ADMIN_REQUIRE_2FA=true. - Limit admin GUI IPs with
MOORCP_ADMIN_ALLOWED_CIDRS(or a VPN), if staff have fixed IPs. - Install a Let's Encrypt certificate for the panel (not self-signed).
- Create one staff account per person with the smallest role that works. Do not share accounts.
- Create an API key per integration with the
billingrole, an owner,allowedNets, andexpiresAt. Consider mTLS. - Keep
MOORCP_ADMIN_API_KEYfor emergencies only; do not use it for integrations. - Turn on panel backup and store the recovery kit off the server.
- Limit port 7443 on hosting servers so only the panel IP can reach it.
- Open only the ports you need on the panel server (80, 8443, 2083, 2085, 2086). The Rspamd web UI and vendor admin UIs use 2086. On hosting servers, close unused ports from the Firewall ports tab. See Ports and services.
- Use CloudLinux on hosting servers where possible, for LVE and CageFS isolation.
- Install WAF and CrowdSec on every hosting server.
- Set up notification channels and send a test, so security alerts arrive.
- Run
dnf upgrade --securityregularly and reboot when asked. - Review Logs & Audit regularly.
