Architecture
ScalPanel's components, the trust boundaries between them, what each one can access, and how web and panel requests flow.
ScalPanel has two halves. The control plane holds the truth: accounts, websites, policies, keys and the audit log. The node runs the websites. The control plane decides what should exist, and an agent on the node makes it so.
The standard installer sets up an all-in-one server: both halves run on one host as Docker containers.
Components
Internet
| 80, 443, 21 2083, 2087, 2096 ... 25, 465, 587, 53 2222
| 993, 995, 110
v v v v v
+---------------------+ +----------+ +-----------+ +------+ +-------+
| node (privileged) | | panel | | mail | | pdns | | sshgw |
| edge nginx | | nginx | | Postfix | | DNS | +---+---+
| FTP server | +----+-----+ | Dovecot | +------+ |
| scalpanel-agent | | | Rspamd | |
| Docker (nested) | v +-----------+ |
| +-------------+ | +----------+ |
| | website A | | | api | PostgreSQL (control plane) |
| | website B | | | worker |<----------------------------------------+
| | ... | | +----------+ MariaDB (customer databases)
| +-------------+ | ^ backup store (restic)
+----------+----------+ | local image registry
| |
+---- agent dials the worker: mutual TLS 1.3
| Component | What it does | Runs as |
|---|---|---|
| panel | nginx in front of the panels: hosting panel (2083), admin panel (2087), webmail (2096) and the other panel ports. | Container |
| api | The HTTP API behind every panel. Checks sessions, permissions and tenant scope on every request. | Container |
| worker | Background jobs and reconciliation. The only control-plane process that talks to agents. | Container |
| PostgreSQL | The control-plane database: accounts, policies, encrypted secrets, the audit log. | Container |
| node | Docker-in-Docker container that stands in for a web server host. It runs the agent, the edge nginx, the optional FTP server and every website container. | Privileged container |
| scalpanel-agent | Applies what the worker asks for, through a fixed list of typed operations. Talks to the node's own Docker Engine. | Root, inside the node |
| edge nginx | Terminates TLS, routes by host name to the right website, applies rate limits. Never reads website files. ScalWS can take its place (Request limits → Edge web server). | Inside the node |
| scalpanel-relay | The database proxies and the website mail relay on the gateway address. Unprivileged. | Inside the node |
| website containers | One per website: its web server (nginx, Apache or LiteSpeed) and PHP-FPM, or a Node.js, Python or Ruby application. | Website's own UID |
| Postfix, Dovecot and Rspamd for every mail domain on the server. | Container | |
| MariaDB | Customer databases. Websites reach it only through the node's database proxy. | Container |
| pdns | PowerDNS, the authoritative DNS server, on the public address port 53. | Container |
| sshgw | SSH and SFTP gateway on port 2222. Authorizes each login with the worker, then opens a session container on the website's node. | Container |
| backup store | restic REST server. Nodes can only append to it. | Container |
| registry | Local image registry for the release's signed images, on loopback only. | Container |
Trust boundaries
- Internet → edge and panels. Everything that arrives here is untrusted. The edge serves websites; the panels require a session or an API token.
- Website → node. Website code is treated as hostile. It runs in a container with no capabilities, a seccomp filter and a read-only system. It can reach only its own files, the internet on the allowed ports, and four services on the node's gateway address (database proxies and mail relay).
- Account users → API. Every request is checked for permission and for tenant scope. A resource of another account answers
404, the same as a resource that does not exist. - Reseller → provider. A reseller can only act inside its own subtree and within the limits the provider granted.
- Node → control plane. The agent dials out to the worker over mutual TLS 1.3. Its identity is its certificate. The control plane accepts reports only about the node's own websites and never takes desired state from a node.
- Control plane → node. The worker sends typed operations, such as "apply this website" or "apply these edge routes". The agent protocol has no generic "run this command" operation, and an automated test fails if one is added. The single exception, cron jobs, can only run a command inside the website's own sandbox.
- SSH gateway → node. The gateway opens a session only with a ticket signed by the control plane. A ticket is valid for 30 seconds, for one node and one use.
What each component can access
| Component | Can read or change | Cannot |
|---|---|---|
| Website code | Its own directory (/srv/site), its own databases with its own credentials, mail sending through the relay as its account's domains | Other websites' files or processes, the node, the Docker socket, private networks, the control plane |
| Account user (panel) | Its account's websites, files, databases, mail, DNS and backups, as its role allows | Other accounts; anything above its account |
| Reseller | Accounts in its subtree, within its grant | Its own limits; sibling resellers; provider settings |
| Agent | Everything on its own node | Other nodes; control-plane data beyond what its websites need |
| Worker and API | The whole platform | Nothing is out of their reach: they are the platform |
| Provider administrators | The whole platform, through the panel and the server | (by design) |
How a web request flows
- A visitor connects to port 80 or 443 on the node.
- The node's firewall table (if you set rules in Admin → Firewall) is checked first.
- The edge nginx terminates TLS with the domain's certificate and finds the website by host name. A suspended account gets a
503page instead. - The edge passes the request to the website container on its private address, port 8080.
- Inside the container, the website's own web server (running as the website's user) applies its
.htaccessrules and hands PHP to PHP-FPM in the same container. - If the code connects to
localhostfor a database, a small forwarder in the container passes the connection to the node's database proxy, which passes it to the database server.
How a panel change flows
- A user signs in to the hosting panel or admin panel. The API checks the password and second factor and creates a session bound to that panel.
- A change, such as new PHP settings, is checked against the user's permissions, the account's scope and its package policy, then written to PostgreSQL with an audit event in the same transaction.
- The worker sees the new desired state and sends a typed operation to the agent of the website's node over the agent's open mTLS stream.
- The agent validates the operation, writes a journal entry, renders the configuration, validates it (for example with
nginx -t) and only then replaces the running website. - The result travels back to the control plane and shows in the panel.
Secrets
- Panel passwords are stored as argon2id hashes. Session and API tokens are stored only as SHA-256 hashes.
- Other secrets that the platform must use again (database passwords, TLS and DKIM private keys, TOTP seeds, backup keys) are encrypted with AES-256-GCM under a key-encryption key. That key is the keyring file in
/etc/scalpanel/secrets, outside the database. - A database dump without the keyring cannot be decrypted. Back the keyring up separately (see the hardening checklist).
- Secrets are kept out of logs by typed secret wrappers, and are shown once when created.
Updates and images
- Releases are signed with an Ed25519 key. The installer and
scalpanelctl updateverify the channel file, the release descriptor and every downloaded file before using them. - Every image is referenced by its SHA-256 digest. On the server, the API and worker check the cosign signature of the images they hand to nodes and refuse to start if one is not signed.
- Base images in the build are pinned by digest, and each release has a CycloneDX software bill of materials.