berth

Security

Security model

How Berth is built to contain mistakes and attacks, from the unprivileged panel and the root agent's per-operation policy to validated config, per-customer isolation, sealed secrets, signed releases and an audit trail the panel cannot rewrite.

Updated 8 min readsecurity · architecture · whitepaper · defence in depth · hardening · supply chainView as Markdown

On this page
  1. The layers at a glance
  2. An unprivileged panel and a root agent
  3. Configuration that is validated before it goes live
  4. Isolation between customers
  5. Protecting what faces the internet
  6. Secrets at rest
  7. Signed releases and a verifiable supply chain
  8. Accountability: who did what
  9. Compliance
  10. Data stays with you

This article is the overview of how Berth protects a hosting server: what the layers are, why they exist, and which other articles go into each one. It is written for the people who have to sign off on a hosting platform, such as a security officer, an auditor or the sysadmin who will be woken up when something goes wrong.

The guiding idea is defence in depth. No single component is trusted to be perfect. The web-facing panel is assumed to be a target, customer sites are assumed to get hacked sometimes, and a bad configuration change is assumed to happen. Each layer limits what the failure of the layer above it can do.

The layers at a glance

LayerWhat it protects againstRead more
Unprivileged panel, root agent with per-operation policyA compromised or buggy panel taking over the serverArchitecture
Declarative, validated configurationA bad change taking services downHow changes go live
Per-subscription isolationOne customer's hacked site reaching another customerIsolation
Sign-in security, SSO, rolesStolen or guessed credentialsSign-in security, Single sign-on, Roles and permissions
WAF, malware scanning, firewall, bansAttacks on websites and servicesWAF, Malware scanning, Firewall and bans
Vulnerability managementKnown flaws staying unpatchedVulnerability management
Sealed secrets, signed releases, SBOMLeaked database dumps, tampered updatesThis article
Audit trail, approvals, integrity checksInsiders, account takeover, covering tracksAudit trail and approvals

An unprivileged panel and a root agent

Berth runs as separate processes with very different privileges.

  • berthd is the panel: the web interface, the REST API, the MCP endpoint for AI assistants, and the panel database. It runs as its own unprivileged user, listens only on loopback behind nginx, and is not a member of any customer group. It cannot read a webspace, a mailbox or a customer database by itself.
  • berth-agent runs as root and does the work that needs root: writing configuration, creating system users, managing services, restoring backups. It is reachable only over a local socket.
  • berth is the command-line tool. It talks to the agent, or runs in-process as root on the server itself.

The panel daemon runs inside a systemd sandbox (NoNewPrivileges, ProtectSystem=strict, ProtectHome, PrivateTmp, PrivateDevices, RestrictSUIDSGID, plus memory and task limits). It has no route to customer data except through the agent.

Typed operations with an explicit policy

The panel and the agent speak a typed protocol, not a shell. Each of the several hundred operations is a structured request with its own validation: domain names, paths, user names and every other field are checked before anything runs.

The agent identifies the caller with kernel peer credentials on the socket, so it knows for certain whether a request comes from the panel or from root. Every operation then has an explicit rule:

  • allowed for the panel, with a recorded reason;
  • root only, so it works from the command line on the server but never from the panel;
  • or allowed only after a named check passes, for example that a path really lies inside the subscription it claims to belong to.

An operation without a rule is refused to the panel. The test suite fails when a new operation is added without one, so the policy cannot silently fall behind the code. Each operation also carries a sensitivity class (read, access, export, destroy, security), which feeds the agent's own audit trail.

Each operation runs in its own short-lived subprocess with a timeout, an output cap and a clean kill of the whole process group. Long or heavy work runs at low CPU and disk priority, so it does not starve the sites.

The practical consequence: even a fully compromised panel process cannot do what the agent's policy forbids. A few powerful actions are deliberately kept out of the panel's reach altogether. Enabling the browser root terminal, dismissing a critical rootkit finding and allowing a SIEM manager to run commands as root are all things only root on the server can do.

Configuration that is validated before it goes live

The desired state of every service lives in the panel database. Configuration files are never patched in place. Each change follows the same steps:

  1. Render the complete files for the affected service into a staging area.
  2. Swap them in atomically, keeping the previous version.
  3. Run the service's own config test: nginx -t, apachectl configtest, postfix check, doveconf -n, named-checkzone and the PHP-FPM pool test.
  4. If the test fails, roll back to the previous version. If it passes, reload in a safe order.

When one customer's vhost or PHP pool is invalid, only that file is set aside and the administrator and customer are told. Everyone else's changes still go through. A typo in one site never takes the web server down for the rest. Every apply, including rolled-back attempts, is visible in the change log. See How changes go live.

Isolation between customers

Each subscription gets its own Linux user, its own PHP-FPM pool, its own systemd slice with CPU, memory, task and disk I/O limits, an enforced disk quota, and its own user namespace for rootless Podman containers. An outbound traffic fence stops customer code from reaching the panel's internal services and other subscriptions' app ports. An optional restricted mode limits outbound traffic to web and DNS, so a hacked site does not become a spam cannon. See Isolation and On-disk layout.

Protecting what faces the internet

  • Sign-in: argon2id password hashes, a breach-password check, CSRF protection on every write, host-only __Host- session cookies, optional two-step verification with TOTP or passkeys, and alerts for new devices. See Sign-in security.
  • Web applications: a WAF with the OWASP Core Rule Set in front of every site, app and container, plus scanning of uploads. See WAF.
  • Malware: weekly and realtime scanning of webspaces with ClamAV and Berth's own backdoor detector, with quarantine. See Malware scanning.
  • Network: an nftables firewall that rolls back by itself unless you confirm, fail2ban for every public service, and hardening of public services against slow and flooding connections. Administrative SSH is reachable only over a VPN. See Firewall and bans.
  • Outbound requests: every outbound fetch the panel makes (webhooks, notifications, log drains, S3, cron URLs, uptime checks, AI providers) goes through one HTTP client that refuses internal and private addresses unless an administrator explicitly allows them. That keeps the panel from being used to probe the internal network.

Secrets at rest

Secrets that the panel must be able to use again, such as SSO client secrets, TOTP seeds, provider API keys and SIEM credentials, are stored sealed with AES-256-GCM. The sealing key belongs to the installation and is not stored in the database, so a database dump on its own does not reveal them. berth security sealkey and berth doctor check that the key and the database still belong together, which matters after a restore.

Passwords are never stored in readable form. API tokens are shown once and stored as a hash. Backups are encrypted before they leave the server. See Backups overview.

Signed releases and a verifiable supply chain

  • Signed releases: every release ships a SHA256SUMS file signed with Ed25519. berth update verifies the signature and the checksums before it installs anything, refuses downgrades and plain-HTTP sources, and falls back to the previous version automatically if the new one does not come up healthy. You can verify a release yourself with berth release verify. See Updating Berth.
  • Signed packages: the .deb and .rpm packages and their repositories are signed, and the install script is signature-checked before it runs. Offline bundles for air-gapped servers are signed as well.
  • Third-party downloads: software Berth fetches from other vendors is verified with that vendor's PGP key, pinned by fingerprint.
  • Signed content bundles: virtual patches, offline vulnerability databases and extension updates are only accepted with a trusted signature.
  • SBOM: berth security sbom produces a CycloneDX 1.6 bill of materials for the server or a single subscription, and berth security vex the matching vulnerability statements.
  • Build checks: govulncheck runs before every release and blocks it when vulnerable code is actually reachable. The panel itself only links MIT, BSD, Apache and MPL licensed libraries. GPL tools such as Postfix and ClamAV run as separate processes.
  • Disclosure: every installation publishes /.well-known/security.txt (RFC 9116) with the contact you set in the panel.

Accountability: who did what

  • The activity log records every change with who, when, from where and what. It is hash-chained and verified continuously, so an edited or deleted entry is detected.
  • The agent keeps its own trail, independent of the panel and chained with a key the panel never has. It is anchored against the panel's log, so rewriting the panel's history is detected too.
  • An audit watchdog looks for patterns of misuse and turns findings into alerts or incidents.
  • Four-eyes approvals, just-in-time elevation and a break-glass account keep standing privileges small.
  • Integrity checks compare panel and critical system files against a baseline and against the vendor's signed packages, and look for signs of tampering and rootkits. They alert and never interrupt hosting.

All of it can be forwarded to a SIEM, and Wazuh rules ship with Berth. See Audit trail and approvals.

Compliance

The same data feeds the compliance tools: a GDPR data register with export and signed erasure, an incident dossier with NIS2 reporting clocks, and a signed evidence pack for BIO2, ISO 27001 and NIS2 audits. See GDPR, NIS2 and incidents and Evidence for audits.

Data stays with you

Berth is self-hosted. Customer data stays on your servers and in backup locations you choose. The panel's pages load nothing from third-party domains: no external fonts, scripts or analytics. Licensing never takes customer sites offline. When a licence lapses, existing sites, mail, databases and backups keep running and stay manageable. See Licence and trial.