Update Socket.IO deployment documentation and fixCertPermissions.sh script for improved service user configuration

This commit enhances the Socket.IO deployment documentation by adding a new section on configuring the systemd service to run as `www-data`, ensuring proper permissions for SSL certificate access. It also updates the fixCertPermissions.sh script to handle cases where the service user is not defined or is set to `nobody`, defaulting to `www-data` and verifying its existence. These changes improve the overall security and functionality of the deployment process.
This commit is contained in:
Torsten Schulz (local)
2025-11-16 09:50:26 +01:00
parent 56c708d3a0
commit a81c3453b5
3 changed files with 85 additions and 10 deletions

View File

@@ -20,9 +20,17 @@ fi
# Prüfe, welcher Benutzer den systemd-Service ausführt
SERVICE_USER=$(sudo systemctl show -p User tt-tagebuch.service 2>/dev/null | cut -d= -f2)
if [ -z "$SERVICE_USER" ]; then
echo "⚠️ Konnte Service-Benutzer nicht ermitteln. Verwende 'www-data' als Standard."
# Wenn kein User definiert ist oder "nobody", verwende www-data
if [ -z "$SERVICE_USER" ] || [ "$SERVICE_USER" = "nobody" ]; then
echo "⚠️ Service-Benutzer ist '$SERVICE_USER' oder nicht definiert."
echo " Verwende 'www-data' als Standard (empfohlen für Webserver-Services)."
SERVICE_USER="www-data"
# Prüfe, ob www-data existiert
if ! id "$SERVICE_USER" &>/dev/null; then
echo "❌ Benutzer '$SERVICE_USER' existiert nicht!"
exit 1
fi
fi
echo "🔧 Konfiguriere SSL-Zertifikat-Berechtigungen..."