Download this file
| 1 | [Unit] |
| 2 | Description=lchat cloud provisioner (self-serve space creation) |
| 3 | After=network-online.target lchat-control.service |
| 4 | Wants=network-online.target |
| 5 | |
| 6 | [Service] |
| 7 | # /data/cloud.env holds LCHAT_ADMIN_TOKEN (gates caller-token minting), |
| 8 | # LCHAT_CLOUD_BASE_DOMAIN, and optional LCHAT_CLOUD_QUOTA. |
| 9 | EnvironmentFile=/data/cloud.env |
| 10 | # The control token is root-only on disk; LoadCredential hands it to this unit |
| 11 | # alone — a compromised instance (same lchat uid) can't read it. |
| 12 | LoadCredential=control-token:/etc/lchat/control.token |
| 13 | ExecStart=/opt/lchat/lchat cloud --socket /run/lchat/cloud.sock --db /data/cloud.db |
| 14 | Restart=always |
| 15 | RestartSec=1 |
| 16 | |
| 17 | # --- hardening (see docs/instance-router.md § Hardening) --- |
| 18 | User=lchat |
| 19 | Group=lchat |
| 20 | CapabilityBoundingSet= |
| 21 | NoNewPrivileges=yes |
| 22 | ProtectSystem=strict |
| 23 | ProtectHome=yes |
| 24 | ReadWritePaths=/data /run/lchat |
| 25 | PrivateTmp=yes |
| 26 | PrivateDevices=yes |
| 27 | ProtectClock=yes |
| 28 | ProtectHostname=yes |
| 29 | ProtectKernelTunables=yes |
| 30 | ProtectKernelModules=yes |
| 31 | ProtectKernelLogs=yes |
| 32 | ProtectControlGroups=yes |
| 33 | ProtectProc=invisible |
| 34 | RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX |
| 35 | RestrictNamespaces=yes |
| 36 | RestrictRealtime=yes |
| 37 | RestrictSUIDSGID=yes |
| 38 | LockPersonality=yes |
| 39 | MemoryDenyWriteExecute=yes |
| 40 | SystemCallFilter=@system-service |
| 41 | SystemCallErrorNumber=EPERM |
| 42 | SystemCallArchitectures=native |
| 43 | MemoryMax=256M |
| 44 | TasksMax=256 |
| 45 | |
| 46 | [Install] |
| 47 | WantedBy=multi-user.target |
| 48 | |