Overview
Chromatic Core is a next-generation control panel engine for Linux servers, written from the ground up in Rust. It targets the architectural insecurity of legacy web control panels (such as HestiaCP, VestaCP, or cPanel) by completely replacing vulnerable shell-spawning PHP scripts and wrapper utilities with a single, compile-time type-safe system daemon.
Built on defensive programming invariants, Chromatic Core rejects dynamic command building and global configuration overrides. Instead, the engine enforces kernel-level privilege separation, deterministic directory traversal limits (combating symlink/TOCTOU races), and strictly typed IPC payloads.
Core Architectural Pillars
Absolute Separation of Privilege
- Sandboxed Web UI: The administrative web panel UI runs under a completely unprivileged system user (
chromatic-admin) with zero write capability to system configuration files. - State Machine Daemon: Privileged operations are executed solely by the compiled
chromatic-core-daemonrunning asroot(or with confined capabilities likeCAP_CHOWN,CAP_DAC_OVERRIDE, andCAP_NET_ADMIN). Communication is conducted via strongly-typed IPC messages over Unix Domain Sockets (UDS).
TOCTOU Symlink Race Defenses
- FD-Relative Operations: Path-based operations are vulnerable to Time-of-Check to Time-of-Use (TOCTOU) symlink substitution exploits. Chromatic Core caches file descriptors of base directories (e.g.,
HOME_DIR_FDfor/home) at startup during single-threaded boot initialization. - Strict Confined APIs: Tenant folder creation and file writes utilize relative file descriptor operations (
openat(2)andmkdirat(2)) withO_NOFOLLOW | O_DIRECTORY | O_CLOEXECflags. File permissions are set directly on active descriptors (viafchmod/fchown), bypassing processumaskand directory swap windows. - Hardlink Audits: Immediately after opening any descriptor inside tenant homes, the daemon calls
fstatand aborts ifst_nlink > 1to block hardlink hijack tricks.
Kernel-Level Socket Segmentation
- Segmented UDS Channels: The system isolates connections at the kernel boundary. The global socket at
/run/chromatic/admin.sockhandles non-tenant requests, while individual tenants communicate via isolated sockets at/run/chromatic/tenants/<tenant>.sockowned strictly byroot:<tenant>. - Peer Authorization: The daemon validates callers at the kernel boundary via
SO_PEERCREDon incoming connections, matching tenant socket bindings directly to the connecting UID. - Frame Size Limiting: Streams are immediately wrapped in a length-delimited reader enforcing a maximum payload size of
64KB(65536 bytes), disconnecting clients instantly if exceeded to prevent memory exhaustion DoS.
Direct Netlink Firewall Driver
- No Subprocess Spawning: Bypasses spawning external
iptablesornftcommand wrappers. Chromatic Core binds directly to Netlink sockets to perform atomic firewall ruleset updates via nativelibnftableslibrary contexts.
Isolated Tenant Mail SQLite Shards
- No Monolithic Databases: Rejects central mail databases. Mail accounts are sharded per tenant (e.g. stored at
/home/<tenant>/mail/mail.db), initialized in WAL (Write-Ahead Logging) mode with connection pools and a5000msbusy timeout handler.
Developer & Sandbox Testing
Chromatic Core includes a robust developer compilation feature that allows compiling and executing the UDS socket listener sandboxed without requiring system root privileges.
1. Running Tests in User Sandbox
Compile and run workspace unit and integration tests with developer-level credential authorization active:
2. Linting & Style Checks
Validate the codebase for formatting adherence and security warnings: