How Berth works
Isolation between subscriptions
What keeps one customer from affecting another: a systemd slice with one resource budget per subscription, a PHP-FPM per subscription, PHP hardening, disk quotas, an outbound network fence, hidden processes and rootless containers in their own user namespace.
On this page
On a shared server, the question is not whether a site will be hacked, overloaded or misconfigured, but what that does to everyone else. Berth's answer is that it should only affect the subscription it happens in. This article explains each layer of separation, from CPU and memory to disk, network, processes and containers, and where you set the limits.
A subscription is the unit of isolation: one system user with its webspace, domains, mailboxes and databases, created from a package. A customer can have several subscriptions. See Domains and subscriptions.
A system user per subscription
Every subscription has its own Linux user and runs everything as that user: PHP, Node.js and Python apps, scheduled tasks, the file manager, SFTP, the shell and containers. Files in the webspace belong to that user. Other subscriptions cannot read them: the webspace root belongs to root and is open only to the web server group, and the document root belongs to the subscription. A system user ID is handed out only once, so a new subscription never inherits files or rights that a removed one left behind. See On-disk layout.
A systemd slice with one budget
Each subscription runs in its own systemd slice, a cgroup with its own limits. Inside it:
- the subscription's own PHP-FPM, one per PHP version it uses;
- its Node.js and Python apps and their background workers;
- its object cache (a Valkey instance on a unix socket);
- its browser terminal and SSH sessions;
- its scheduled tasks;
- its containers.
All of these share one budget. Web traffic, a cron job and an SSH session of the same subscription draw from the same CPU, memory, process and disk-IO limits, so a subscription cannot get twice its package by spreading work across services.
| Limit | Meaning |
|---|---|
| CPU | Without a package limit, subscriptions share the CPU equally when the server is busy, and one site may use more when it is quiet, up to a ceiling of 90 % of all cores by default. A package can set a fixed cap instead, as a percentage of one core (200 means two cores). |
| Memory | Hard limit, with swap capped per subscription as well; usage is measured as PSS, so shared pages are counted fairly. |
| Processes | Processes and threads together. A fork bomb stops at this limit. |
| Disk IO | Read/write throughput in MB/s and operations per second. |
In a package, 0 means the server default and -1 means deliberately no limit. The server default is set under Packages → Limits per subscription: CPU as a ceiling and memory as a share of the server, so a server that grows gives every subscription more. Changing a limit takes effect immediately; nothing restarts.
berth plan set --name basis --cpu-percent 100 --memory-mb 1024 --max-processes 256
berth plan isolation-defaults --cpu-share 90 --memory-share 50
berth subscription isolation --sysuser acmeAs memory gets close to the limit, the kernel first slows the subscription down; only at the limit does it stop a process, while the rest of the site keeps running. Because swap is capped too, one site that runs out of memory cannot push the whole server into swapping, and the database and the shared system services keep a guaranteed amount of memory. The alert engine notifies the administrator, the customer and the reseller when a subscription sits at its memory or process limit or is throttled on CPU for a sustained period.
Per-app limits narrow this further: inside a subscription, each app can have its own CPU, memory, process and IO limit, never above the subscription's own (berth app limits, or Apps → Limits on the domain).
Background work of the panel itself (backups, scans, statistics) runs in a separate low-priority slice, and the root agent caps how much work it does at once per subscription, per customer and per reseller. One customer's large restore cannot crowd out everyone else's panel actions.
PHP-FPM per subscription
Every subscription gets its own PHP-FPM master per PHP version, inside its slice. A PHP memory leak, a scraper hammering a slow page or a pool full of stuck requests affects only that subscription, not other sites on the same PHP version. An idle FPM costs roughly 15 to 20 MB of memory per subscription and version. On a small server with many subscriptions you can choose Only packages with limits, and the rest share one FPM per version.
PHP is hardened by default:
open_basediris the subscription's home, andsecurity.limit_extensionsallows only.php.- Process functions such as
exec,systemandproc_openare disabled. The package option PHP may start processes (--php-shell) allows them. mail()is off per package by default (--php-mailallows it), and when allowed it goes through Berth's mail gate, which counts it against the subscription's outbound budget. See Outbound mail.expose_phpis off, session cookies are hardened, and FPM runs with its own/tmpinside the subscription's webspace and a private view of/proc.
See PHP.
Disk quota
The disk space of a package is enforced by the file system where possible:
| File system | How | What counts |
|---|---|---|
xfs with pquota, ext4 with the quota and project features | Project quota | Webspace, Maildirs, MariaDB databases and container storage of the subscription together |
ext4 without the project feature (the Debian and Ubuntu default) | Per-user quota | What the subscription's user writes in its webspace; mail, databases and containers are measured and enforced separately |
| btrfs, ZFS, network file systems | Measure only | Measured hourly and reported |
The package value is the soft limit; the hard limit is slightly higher, and a subscription above the soft limit has a week of grace. At the hard limit, the file system refuses new files for that subscription only, so a customer or a hijacked site cannot fill the server's disk.
Packages also limit the number of files and folders (inodes): by default 100 per MB of disk space, at least 250,000, so a cache or session folder with millions of tiny files cannot exhaust the file system (berth plan set --inodes; -1 means no limit).
Temporary files and logs count as well. Each subscription gets its own /tmp and /var/tmp inside its webspace, for PHP, apps and the shell, and on Debian and Ubuntu for scheduled tasks too, so they count towards its quota and cannot fill the server's shared /tmp. PHP error and slow logs are rotated as soon as they grow large. Space that still falls outside the quota is capped: a domain's log folder that runs away is cut back with a notice, and a subscription's files in the shared temporary directories are removed above a limit (berth quota shared runs the same check by hand).
What the file system does not cover, Berth enforces itself:
- Databases over the hard limit are write-locked: MariaDB databases can still be read and cleaned up with
DELETE,DROPandTRUNCATE; PostgreSQL databases become read-only. The lock lifts by itself once usage is back under the package. - Containers over the hard limit are stopped, and the site falls back to its normal content; they start again when space is freed.
- Mailboxes have their own quota, enforced by Dovecot.
Quota is switched on under System → Disks → Disk quota with a dry run first, or berth quota enable --dry-run and berth quota enable. Berth never remounts a file system itself; when a mount option is needed, it takes effect at the next reboot. See Disks and snapshots.
Outbound network fence
Two layers control what a subscription can reach on the network.
Always on, for every subscription:
- No subscription can reach the panel's internal services over loopback: the panel API, the rescue service, the admin terminal, or the internal mail signing and spam services. A hacked site cannot talk to the panel from the inside.
- Ports of apps and containers on loopback answer only their own subscription and nginx. Another subscription is refused, and the attempt is shown to the customer.
- Outbound SMTP on port 25 from sites is closed by default; mail goes through authenticated submission and the outbound budget.
- New outbound connections and concurrent connections per subscription are limited, configurable per package.
Restricted mode, per package (Restrict outbound traffic): sites, apps, scheduled tasks, SSH sessions and containers can reach only the web, DNS and the server's own services. Exceptions are set per subscription. The customer sees what was blocked under Outbound traffic. A hacked site in restricted mode cannot become a spam relay or join a botnet.
berth plan set --name basis --egress-restricted
berth egress allow --subscription acme --proto tcp --ports 22 --dest 198.51.100.20
berth egress show --subscription acmeProcesses are hidden
/proc is mounted with hidepid=invisible. A customer sees only their own processes, in ps, top, the terminal and from PHP; command lines, environments and working directories of other subscriptions are invisible. PHP-FPM, apps and the object cache get their own /proc view from systemd as well.
Shell, SFTP and the browser terminal
- SFTP without shell is chrooted into the subscription's home.
- The shell and the browser terminal run as a transient systemd unit inside the subscription's slice, with its limits, and see only the subscription's own webspaces.
- SSH keys are managed by the panel and stored outside the webspace, so a PHP script cannot plant a key.
- Customers use a separate SSH port; administrative SSH on port 22 is reachable only through the VPN.
See Files, FTP and SSH.
Containers in a user namespace
Containers run with rootless Podman, without a Docker daemon. Each subscription has its own user namespace, so root inside a container maps to an unprivileged range on the host that belongs to that subscription alone. Containers run inside the subscription's slice and budget, from root-owned Quadlet units the customer cannot edit.
- Never privileged; no host network, PID or IPC namespace.
no-new-privileges, a seccomp profile, and an optional read-only root file system.- Ports are published only on loopback; nginx is the only way in.
- Volumes and images count toward the subscription's disk quota.
See Containers.
Databases on a shared server
MariaDB and PostgreSQL are shared services, so Berth separates customers inside them: database and user names carry the subscription prefix, a database user can be granted rights only on databases of its own subscription (checked in the panel and again in the agent), connections are limited per user and per subscription, and every database user has a query-time limit so one runaway query cannot hold the server. See Databases.
Web-facing helpers run on their own
Webmail and Adminer run on their own host names, never on the panel's address, and each as its own system user. The file manager in the panel runs as the subscription's user. A flaw in one of them does not reach the panel session or another customer's files.
Where to see it
- Per subscription: limits, live usage and its own PHP-FPMs on the subscription's usage page, or
berth subscription isolation --sysuser <name>. - Server-wide: Statistics for CPU, memory and IO per subscription with peaks; see Statistics and metrics.
- The alerts: System → Problems.
For the design of the root agent that enforces all of this, see Architecture and Security model.