# The root instance-control service (isolated-exec design §5). Socket- # activated, so it runs only while there is work. Its whole job is # systemctl start/stop/set-property on the three instance templates' units # and their host slices, on the agent's request, plus running the readiness # probe. Every unit name it passes to systemctl is built from a validated # host by the platform's own naming; nothing from a request reaches # systemctl as a string. # # Runs as ROOT deliberately, with no new-privileges lockout and no syscall # filter, for the systemctl child (the same rationale as # carlos-stage.service). It accepts a connection only from the edge unit's # main process (SO_PEERCRED uid carlos, pid == MainPID of # carlos-edge.service): a flat tenant is a child of that pid, never the pid # itself, and a nested tenant cannot reach the socket at all. # # At start it also looks UNDER the two instance bind mounts (unshare -m in # a private namespace, umount, list; design §8.2, "Recovery for a layout # that was unmounted anyway"). Files left in the raw mountpoint directory # while the layout was unmounted would otherwise be hidden by the mount and # invisible to the layout pass's destination check; a held file is a # failing line in every probe report and keeps /ready refusing nested wakes # until an operator moves or removes it and restarts this service. Root is # what makes that inspection possible: the private namespace and the umount # need CAP_SYS_ADMIN. ProtectSystem=strict leaves /data and /run visible. [Unit] Description=carlos instance control (root: start/stop carlos-instance*@ units for the agent) Requires=carlos-instance-control.socket data-instances.mount run-carlos-instances.mount run-carlos-logs.mount After=data-instances.mount run-carlos-instances.mount run-carlos-logs.mount [Service] ExecStart=/opt/carlos/carlos instance-control ProtectSystem=strict # /run/systemd/system: the per-generation runtime drop-in (zero-downtime # deploys, plan 2 D1); nothing else is written there. ReadWritePaths=/run/carlos-control /run/systemd/system ProtectHome=yes PrivateTmp=yes PrivateDevices=yes ProtectKernelTunables=yes ProtectKernelModules=yes ProtectKernelLogs=yes RestrictAddressFamilies=AF_UNIX MemoryDenyWriteExecute=yes MemoryMax=64M