Architecture

Understanding how Simuzo's components work together to provide secure hosting isolation.

Overview

Simuzo leverages Linux kernel features and containerization to provide resource management and user isolation:

System Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        Simuzo Architecture                        │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  ┌──────────────┐         ┌──────────────┐         ┌───────────┐ │
│  │  Webuzo/     │         │   Simuzo     │         │  Apache   │ │
│  │  Plesk/cPanel│◄──────►│   Admin API   │◄──────► │  (Ports)  │ │
│  └──────────────┘         └──────────────┘         └───────────┘ │
│          │                        │                        │      │
│          ▼                        ▼                        ▼      │
│  ┌──────────────────────────────────────────────────────────────┐ │
│  │                    Simuzo Core                               │ │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐   │ │
│  │  │ User Mgmt   │  │ cGroup Mgr  │  │  CLI Interface      │   │ │
│  │  └─────────────┘  └─────────────┘  └─────────────────────┘   │ │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐   │ │
│  │  │ Stats Coll  │  │ Audit Trail │  │  Task Manager       │   │ │
│  │  └─────────────┘  └─────────────┘  └─────────────────────┘   │ │
│  └──────────────────────────────────────────────────────────────┘ │
│          │                        │                        │      │
│          ▼                        ▼                        ▼      │
│  ┌──────────────┐         ┌──────────────┐         ┌───────────┐  │
│  │ simuzofs-cmd │         │  cgroup.sh   │         │    PAM    │  │
│  │ (Jail Cmd)   │         │ (cGroup Mgr) │         │  Module   │  │
│  └──────────────┘         └──────────────┘         └───────────┘  │
│          │                        │                        │      │
└──────────┼────────────────────────┼────────────────────────┼──────┘
           │                        │                        │
           ▼                        ▼                        ▼
    ┌──────────────┐         ┌──────────────┐         ┌───────────┐
    │  /var/simuzo │         │ /sys/fs/     │         │  /etc/    │
    │     /fs/     │         │  cgroup/     │         │  pam.d/   │
    │  (Jail Root) │         │   simuzo/    │         │           │
    └──────────────┘         └──────────────┘         └───────────┘

Core Components

Core

The main application handles all web requests and business logic:

ComponentFilePurpose
Admin Paneladmin.phpServer administration interface
End User Panelenduser.phpUser self-service interface
CLI Interfacecli.phpCommand-line operations
Universal Loaderuniversal.phpMain entry point

SimuzoFS (Filesystem Isolation)

SimuzoFS provides jail isolation by isolating each user's filesystem view.

Components

ComponentPurpose
simuzofs-ld.soLD_PRELOAD for path restrictions
pam_simuzofs.soPAM authentication module
simuzofs-cmdExecute commands inside jail
simuzofs-initInitialize jail environment

Jail Filesystem Structure

/var/simuzo/fs/
├── user1/
│   ├── root/
│   │   └── simuzofs/       # Persistent Volume (Physical Source)
│   │       ├── etc/
│   │       │   ├── passwd  # User-specific filtered passwd
│   │       │   └── group   # User-specific filtered group
│   │       └── var/log/    # User-specific logs
│   ├── etc/                # Bind-mounted (rbind) from skeleton
│   ├── usr/                # Bind-mounted (rbind) from skeleton
│   ├── home/               # Bind-mounted from host
│   └── tmp/                # Bind-mounted from host
├── user2/
│   └── ...
└── simuzofs/               # Global Skeleton Template

How SimuzoFS Works

  1. User logs in via PAM module (pam_simuzofs.so)
  2. PAM sets up environment for jail access
  3. simuzofs-ld.so intercepts file operations via LD_PRELOAD
  4. File access is restricted to user's jail directory
  5. simuzofs-cmd executes commands within the jail context

cGroups v2 (Resource Limits)

Simuzo uses Linux cgroups v2 for resource management and throttling.

cGroup Hierarchy

/sys/fs/cgroup/simuzo/
├── user1-1000/
│   ├── cpu.max
│   ├── memory.max
│   ├── memory.high
│   ├── io.max
│   ├── pids.max
│   └── ...
└── user2-1001/
    └── ...

/sys/fs/cgroup/simuzo-db/
├── user1-1000/
│   └── (database-specific limits)
└── user2-1001/
    └── ...

Resource Controllers

ControllerFileLimits
CPUcpu.maxCPU percentage quota
Memorymemory.max, memory.highRAM allocation and throttling threshold
IOio.maxRead/write bandwidth and IOPS
PIDspids.maxMaximum process count

Entry Processes (EP) Limits

Entry processes limit concurrent connections/processes for each user.

Components

ComponentPurpose
simuzo-procmonMonitor process counts per user
simuzo-loadPrivilege escalation helper

How EP Limits Work

  1. simuzo-procmon runs as a daemon monitoring process events via Netlink.
  2. It identifies new user processes and automatically moves them to their assigned cgroups.
  3. Counts active processes per user via UID mapping to enforce Entry Processes (EP) limits.
  4. Writes real-time statistics to /run/simuzo/ep_stats.json.
  5. If a user exceeds their limit, new processes are terminated to prevent resource exhaustion.

MySQL Governor

MySQL Governor monitors and throttles database resource usage per user.

Components

Throttling Mechanism

  1. Governor reads active MySQL threads from performance_schema
  2. Maps MySQL users to system users via dbmap
  3. Applies throttling based on user's resource plan
  4. Slow queries exceeding limits are terminated

Data Flow

User Login

User ──► (Apache - PHP FPM) / Exim ──► Simuzo Core
                                              │
                                              ▼
            SSH / SU ──►            PAM Check
                                              │
                                              ▼
                                    pam_simuzofs.so ──► /etc/pam.d/simuzo
                                              │
                                              ▼
                                    Set UID/GID ──► Grant Jail Access
                                              │
                                              ▼
                                    simuzofs-ld.so ──► LD_PRELOAD
                                              │
                                              ▼
                                    Restricted FS Access ──► /var/simuzo/fs/{user}/

Resource Limit Enforcement

User Process ──► cgroups ──► Limits Applied
     │                 │
     │                 ├─► CPU throttle (%)
     │                 ├─► Memory limit (bytes)
     │                 ├─► IO throttle (bytes/sec, IOPS)
     │                 └─► Process count limit
     │
     └─► simuzofs-ld.so ──► Filesystem restriction

Panel Integration Details

Simuzo integrates with hosting panels to provide unified management.

Supported Panels

PanelStatus
WebuzoSupported
cPanelSupported
DirectAdminSupported
PleskSupported
InterworxSupported

Integration Points

Key Paths

PathPurpose
/usr/local/simuzo/Installation directory
/var/simuzo/Runtime data directory
/var/simuzo/fs/Jail filesystem root
/sys/fs/cgroups/simuzocGroup hierarchy mount
/sys/fs/cgroups/simuzo-dbDatabase cGroup hierarchy mount
/var/simuzo/users/Per-user configuration
/var/simuzo/logs/Log files
/run/simuzo/Runtime files (stats, PID files)
/run/simuzo/stats.jsonLive statistics
/run/simuzo/ep_stats.jsonEntry process stats
/run/simuzo/dbmapMySQL user mappings

Next Steps