docs: Installationsanleitung, gehärtete systemd-Unit und Beispielkonfiguration
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NBHF4R9EAejDJUMdwr6C68
This commit is contained in:
parent
2d223c5823
commit
4b287f9b1b
4 changed files with 633 additions and 0 deletions
65
deploy/vpnportal.service
Normal file
65
deploy/vpnportal.service
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
[Unit]
|
||||
Description=VPN-Konfig-Portal für OPNsense
|
||||
Documentation=file:/usr/share/doc/vpnportal/README.md
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/vpnportal serve --config /etc/vpnportal/config.yaml
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
# Dedizierter, zustandsloser Dienstbenutzer. Das Portal hält keinen Zustand
|
||||
# auf der Platte außer dem Audit-Log, deshalb genügt DynamicUser.
|
||||
# Alternativ einen festen Systembenutzer anlegen und User=/Group= setzen —
|
||||
# siehe README, Abschnitt "Installation".
|
||||
DynamicUser=yes
|
||||
|
||||
# Audit-Log: systemd legt /var/log/vpnportal an und übergibt es dem Dienst.
|
||||
# In der config.yaml dann: audit_log: "/var/log/vpnportal/audit.log"
|
||||
LogsDirectory=vpnportal
|
||||
LogsDirectoryMode=0750
|
||||
|
||||
# Secrets werden nicht als Umgebungsvariablen übergeben, sondern als Dateien
|
||||
# unter $CREDENTIALS_DIRECTORY. In der config.yaml dann z. B.:
|
||||
# ad:
|
||||
# bind_password_file: "/run/credentials/vpnportal.service/ad-bind-password"
|
||||
# opnsense:
|
||||
# api_secret_file: "/run/credentials/vpnportal.service/opnsense-api-secret"
|
||||
LoadCredential=ad-bind-password:/etc/vpnportal/secrets/ad-bind-password
|
||||
LoadCredential=opnsense-api-secret:/etc/vpnportal/secrets/opnsense-api-secret
|
||||
|
||||
# ---------- Härtung ----------
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
NoNewPrivileges=yes
|
||||
ProtectKernelTunables=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelLogs=yes
|
||||
ProtectControlGroups=yes
|
||||
ProtectClock=yes
|
||||
ProtectProc=invisible
|
||||
ProcSubset=pid
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
RestrictSUIDSGID=yes
|
||||
RestrictAddressFamilies=AF_INET AF_INET6
|
||||
LockPersonality=yes
|
||||
MemoryDenyWriteExecute=yes
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=@system-service
|
||||
SystemCallFilter=~@privileged @resources
|
||||
CapabilityBoundingSet=
|
||||
ReadOnlyPaths=/etc/vpnportal
|
||||
UMask=0077
|
||||
|
||||
# Soll das Portal direkt auf 443 lauschen, stattdessen:
|
||||
# AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
# CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
# Besser: auf 8443 lauschen lassen und davor per nftables umleiten.
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Add table
Add a link
Reference in a new issue