- deploy/it-connect.service: eigener Benutzer, nur 127.0.0.1, Proxy-Header nur von Caddy, StateDirectory /var/lib/it-connect, systemd-Härtung - deploy/it-connect-backup.service/.timer: tägliches Backup nach /var/backups/it-connect - deploy/Caddyfile: HTTPS (interne CA oder Firmenzertifikat), Sicherheits-Header, Log - SETUP.md Teil 7: Installation, Konfiguration, Zertifikate, Backup, Update, Fehlerbehebung Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
1.4 KiB
Desktop File
52 lines
1.4 KiB
Desktop File
# systemd-Unit für it-connect
|
|
# Installation: siehe SETUP.md, Teil 7
|
|
# sudo cp deploy/it-connect.service /etc/systemd/system/
|
|
# sudo systemctl daemon-reload && sudo systemctl enable --now it-connect
|
|
|
|
[Unit]
|
|
Description=it-connect (FastAPI)
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=itconnect
|
|
Group=itconnect
|
|
WorkingDirectory=/opt/it-connect/backend
|
|
EnvironmentFile=/opt/it-connect/.env
|
|
# Nur lokal lauschen: von außen ist die App ausschließlich über Caddy (HTTPS) erreichbar.
|
|
# uvicorn übernimmt die Client-IP aus X-Forwarded-For nur von 127.0.0.1 (Caddy).
|
|
ExecStart=/opt/it-connect/.venv/bin/uvicorn app.main:app \
|
|
--host 127.0.0.1 --port 8000 \
|
|
--proxy-headers --forwarded-allow-ips 127.0.0.1 \
|
|
--no-server-header
|
|
Restart=on-failure
|
|
RestartSec=3
|
|
|
|
# Datenbankverzeichnis /var/lib/it-connect (wird von systemd angelegt, gehört itconnect)
|
|
StateDirectory=it-connect
|
|
StateDirectoryMode=0750
|
|
UMask=0077
|
|
|
|
# Härtung
|
|
NoNewPrivileges=true
|
|
ProtectSystem=strict
|
|
ProtectHome=true
|
|
PrivateTmp=true
|
|
PrivateDevices=true
|
|
ProtectKernelTunables=true
|
|
ProtectKernelModules=true
|
|
ProtectKernelLogs=true
|
|
ProtectControlGroups=true
|
|
ProtectClock=true
|
|
ProtectHostname=true
|
|
RestrictNamespaces=true
|
|
RestrictRealtime=true
|
|
RestrictSUIDSGID=true
|
|
LockPersonality=true
|
|
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
|
CapabilityBoundingSet=
|
|
SystemCallArchitectures=native
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|