eleven / messenger Public

Clone
git clone https://amadan.net/eleven/messenger

Plain git — no account needed to clone.

Download

Download this file

1[Unit]
2Description=lchat instance %i
3After=network-online.target
4Wants=network-online.target
5
6[Service]
7# add-instance writes /data/<host>.env (0600) with LCHAT_ADMIN_TOKEN + per-instance
8# config. The leading '-' makes it optional so a self-provisioning instance still boots.
9EnvironmentFile=-/data/%i.env
10# Execs a per-instance symlink (/opt/lchat/live/<host> → /opt/lchat/versions/<ver>/
11# lchat) rather than one shared binary, so each instance runs its own version and a
12# build can be canaried on one instance before it's promoted. add-instance /
13# init-versions create the link; `lchat deploy --version` repoints it. See
14# docs/instance-router.md § Versioned deploys.
15ExecStart=/opt/lchat/live/%i --socket /run/lchat/%i.sock --db /data/%i.db
16Restart=always
17RestartSec=1
18
19# --- hardening (see docs/instance-router.md § Hardening) ---
20User=lchat
21Group=lchat
22# Binds a unix socket only — no capabilities needed.
23CapabilityBoundingSet=
24NoNewPrivileges=yes
25ProtectSystem=strict
26ProtectHome=yes
27ReadWritePaths=/data /run/lchat
28PrivateTmp=yes
29PrivateDevices=yes
30ProtectClock=yes
31ProtectHostname=yes
32ProtectKernelTunables=yes
33ProtectKernelModules=yes
34ProtectKernelLogs=yes
35ProtectControlGroups=yes
36ProtectProc=invisible
37RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
38RestrictNamespaces=yes
39RestrictRealtime=yes
40RestrictSUIDSGID=yes
41LockPersonality=yes
42MemoryDenyWriteExecute=yes
43SystemCallFilter=@system-service
44SystemCallErrorNumber=EPERM
45SystemCallArchitectures=native
46MemoryMax=512M
47TasksMax=256
48
49[Install]
50WantedBy=multi-user.target
51