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 router (TLS terminator + host router)
3After=network-online.target
4Wants=network-online.target
5
6[Service]
7# Optional overrides, e.g. LCHAT_FALLBACK_URL (where unknown hosts redirect
8# instead of 404 — pairs with a wildcard DNS record; see cloud-provisioner.md).
9EnvironmentFile=-/data/router.env
10ExecStart=/opt/lchat/lchat router --registry /data/registry.db --acme-cache /data/acme
11# add-instance triggers `systemctl reload lchat-router` to re-read the route table.
12ExecReload=/bin/kill -HUP $MAINPID
13Restart=always
14RestartSec=1
15
16# --- hardening (see docs/instance-router.md § Hardening) ---
17User=lchat
18Group=lchat
19# The router is the ONLY unit that binds privileged ports (:80 + :443); this cap
20# lets it do so as a non-root user. Every other unit binds a unix socket only.
21AmbientCapabilities=CAP_NET_BIND_SERVICE
22CapabilityBoundingSet=CAP_NET_BIND_SERVICE
23NoNewPrivileges=yes
24ProtectSystem=strict
25ProtectHome=yes
26ReadWritePaths=/data /run/lchat
27PrivateTmp=yes
28PrivateDevices=yes
29ProtectClock=yes
30ProtectHostname=yes
31ProtectKernelTunables=yes
32ProtectKernelModules=yes
33ProtectKernelLogs=yes
34ProtectControlGroups=yes
35ProtectProc=invisible
36RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
37RestrictNamespaces=yes
38RestrictRealtime=yes
39RestrictSUIDSGID=yes
40LockPersonality=yes
41# The Go binary never maps writable+executable memory, so this is safe (unlike the
42# Node sidecar, whose JIT needs it — see lchat-bot@.service).
43MemoryDenyWriteExecute=yes
44SystemCallFilter=@system-service
45SystemCallErrorNumber=EPERM
46SystemCallArchitectures=native
47MemoryMax=256M
48TasksMax=256
49
50[Install]
51WantedBy=multi-user.target
52