[Unit] Description=Sea vHost privileged isolation agent After=local-fs.target mysqld.service mysql.service mariadb.service Before=sea-vhost-api.service [Service] Type=simple User=root Group=sea-vhost-agent-control EnvironmentFile=/etc/sea-vhost/sea-vhost.env ExecStart=/opt/sea-vhost/bin/sea-vhost-agent Restart=on-failure RestartSec=3 RuntimeDirectory=sea-vhost sea-vhost-php RuntimeDirectoryMode=0755 StateDirectory=sea-vhost-agent StateDirectoryMode=0711 UMask=0007 NoNewPrivileges=true PrivateTmp=true # A root-only directory view follows socket recreation after MySQL restarts. # Tenant PHP processes cannot traverse this 0700 configuration directory. ConfigurationDirectory=sea-vhost-mysql ConfigurationDirectoryMode=0700 BindReadOnlyPaths=/tmp:/etc/sea-vhost-mysql/host-tmp PrivateDevices=true # PHP-FPM masters are launched by this service after dropping to each host # UID/GID. They must retain host networking so ordinary PHP applications can # reach the local MySQL listener and outbound APIs. The agent itself exposes # only a token-authenticated Unix socket and does not listen on TCP. # The privileged quota agent must enumerate processes owned by each isolated # host UID. The unprivileged API keeps ProtectProc=invisible; this root-only, # token-authenticated agent therefore retains the default /proc visibility. ProcSubset=pid ProtectClock=true ProtectHostname=true ProtectHome=true ProtectSystem=strict ReadOnlyPaths=/usr /boot /opt /var/lib/sea-vhost /var/lib/sea-vhost-panel /www/server ReadWritePaths=/etc /www/wwwroot/seavHost/vHost /www/backup/sea-vhost /www/wwwlogs /www/server/panel/vhost/nginx /www/server/pure-ftpd/etc /www/server/nginx/logs/error.log /www/server/nginx/logs/nginx.pid -/www/server/nodejs/vhost/pids -/www/server/python_manager/versions -/www/server/php /var/lib/sea-vhost-agent /run/sea-vhost-php ProtectKernelTunables=true ProtectKernelModules=true ProtectKernelLogs=true ProtectControlGroups=true # The agent creates locked per-host identities, applies ACLs and starts each # PHP-FPM master after changing the forked child's UID/GID. The kernel clears # ambient capabilities on that root-to-tenant UID transition, so tenant PHP # processes do not inherit agent privileges. /etc remains writable because fixed useradd/usermod # operations must update the host account databases; all other system paths # stay read-only unless explicitly listed. RestrictRealtime=true LockPersonality=true MemoryDenyWriteExecute=true RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 CapabilityBoundingSet=CAP_CHOWN CAP_DAC_OVERRIDE CAP_FOWNER CAP_FSETID CAP_KILL CAP_LINUX_IMMUTABLE CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID AmbientCapabilities=CAP_SETGID CAP_SETUID LimitCORE=0 SystemCallArchitectures=native [Install] WantedBy=multi-user.target