Download this file
| 1 | [Unit] |
| 2 | Description=lchat public SSH access ledger (one collect pass) |
| 3 | After=network-online.target |
| 4 | Wants=network-online.target |
| 5 | |
| 6 | [Service] |
| 7 | Type=oneshot |
| 8 | # Optional overrides: STATUS_BUCKET / STATUS_REGION (mirror status-publish.sh). |
| 9 | EnvironmentFile=-/data/status.env |
| 10 | # "+" = outside the sandbox: both ReadWritePaths must exist before |
| 11 | # ProtectSystem=strict mounts them, or the first-ever run fails to namespace. |
| 12 | ExecStartPre=+/usr/bin/mkdir -p /data/ssh-ledger /opt/lchat/status-pages |
| 13 | ExecStart=/opt/lchat/ssh-ledger-collect.sh |
| 14 | |
| 15 | # --- hardening (see docs/instance-router.md § Hardening) --- |
| 16 | # Runs as ROOT deliberately: the sshd journal is root/systemd-journal readable |
| 17 | # and /data/ssh-ledger + /opt/lchat/status-pages are its only writes — |
| 18 | # ProtectSystem=strict pins exactly those. It is fired by |
| 19 | # lchat-ssh-ledger.timer, never routed or listening, and publishes METADATA |
| 20 | # ONLY (see the script's privacy header). |
| 21 | ProtectSystem=strict |
| 22 | ReadWritePaths=/data/ssh-ledger /opt/lchat/status-pages |
| 23 | ProtectHome=yes |
| 24 | PrivateTmp=yes |
| 25 | PrivateDevices=yes |
| 26 | ProtectClock=yes |
| 27 | ProtectHostname=yes |
| 28 | ProtectKernelTunables=yes |
| 29 | ProtectKernelModules=yes |
| 30 | ProtectKernelLogs=yes |
| 31 | NoNewPrivileges=yes |
| 32 | RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX |
| 33 | RestrictNamespaces=yes |
| 34 | RestrictRealtime=yes |
| 35 | LockPersonality=yes |
| 36 | MemoryDenyWriteExecute=yes |
| 37 | MemoryMax=256M |
| 38 | TasksMax=64 |
| 39 | |