Files
lpra/deploy/lpra-server.service
T
2026-10-13 16:16:31 +03:00

56 lines
1.9 KiB
Desktop File

# systemd unit for the LPRA host (server).
#
# The server runs as root so that the panel can open forwarded ports in ufw;
# it listens on a high local port (127.0.0.1:8091) behind nginx.
#
# Install:
# sudo mkdir -p /opt/lpra
# sudo cp bin/lpra-server /opt/lpra/
# sudo cp -r dist /opt/lpra/dist # agent binaries served at /download/
# sudo cp deploy/lpra-server.service /etc/systemd/system/
# sudo systemctl daemon-reload && sudo systemctl enable --now lpra-server
#
# Direct port forwarding (tcp/udp modes) uses port 8446 on the host — open it in
# the firewall: ufw allow 8446/tcp ; ufw allow 8446/udp
# (The "http" forward mode and terminal/files go through nginx :8445 and need
# nothing extra.) Override with LPRA_TUNNEL_ADDR, or set it empty to disable.
# The port, and the host agents dial for it, can also be changed in the panel
# settings; agents pick the new address up from the panel by themselves.
#
# ufw integration (the panel opening forwarded ports itself) needs root and a
# writable /etc/ufw and /run — see ReadWritePaths below.
[Unit]
Description=LPRA remote access host (admin panel + agent rendezvous)
After=network-online.target
Wants=network-online.target
[Service]
WorkingDirectory=/opt/lpra
ExecStart=/opt/lpra/lpra-server \
-addr 127.0.0.1:8091 \
-db /opt/lpra/lpra.db \
-dist /opt/lpra/dist
Restart=always
RestartSec=3
# --- hardening ---
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictSUIDSGID=true
# The SQLite database, plus what ufw writes: its rules in /etc/ufw and the
# ufw/xtables locks in /run. Without the last two "ufw status" works but
# "ufw allow" fails with "'/etc/ufw/user.rules' is not writable".
ReadWritePaths=/opt/lpra /etc/ufw /run
ReadWritePaths-=/etc/ufw /run
[Install]
WantedBy=multi-user.target