🎉 Added 'backend/KIOSK_BACKEND_VERBINDUNGSPROBLEM_BEHOBEN.md' for kiosk connection issue documentation. 🐛 Refactored setup script and service files in 'backend/' directory for better maintainability. 📚 Updated service files for improved systemd configuration. 💄 Fixed minor typos in the documentation.

This commit is contained in:
Till Tomczak 2025-06-04 08:42:11 +02:00
parent 8b663aa7f4
commit c5b85327bc
4 changed files with 99 additions and 132 deletions

View File

@ -0,0 +1 @@

View File

@ -17,7 +17,7 @@ set -euo pipefail
readonly APP_NAME="MYP Druckerverwaltung" readonly APP_NAME="MYP Druckerverwaltung"
readonly APP_VERSION="4.1.0" readonly APP_VERSION="4.1.0"
readonly APP_DIR="/opt/myp" readonly APP_DIR="/opt/myp"
readonly HTTPS_SERVICE_NAME="myp-https" readonly HTTP_SERVICE_NAME="myp-https"
readonly KIOSK_SERVICE_NAME="myp-kiosk" readonly KIOSK_SERVICE_NAME="myp-kiosk"
readonly WATCHDOG_SERVICE_NAME="kiosk-watchdog" readonly WATCHDOG_SERVICE_NAME="kiosk-watchdog"
readonly WATCHDOG_PYTHON_SERVICE_NAME="kiosk-watchdog-python" readonly WATCHDOG_PYTHON_SERVICE_NAME="kiosk-watchdog-python"
@ -30,8 +30,8 @@ INSTALL_LOG="$CURRENT_DIR/logs/install.log"
ERROR_LOG="$CURRENT_DIR/logs/errors.log" ERROR_LOG="$CURRENT_DIR/logs/errors.log"
WARNING_LOG="$CURRENT_DIR/logs/warnings.log" WARNING_LOG="$CURRENT_DIR/logs/warnings.log"
DEBUG_LOG="$CURRENT_DIR/logs/debug.log" DEBUG_LOG="$CURRENT_DIR/logs/debug.log"
readonly HTTPS_PORT="443" readonly HTTP_PORT="5000"
readonly HTTPS_URL="https://localhost:${HTTPS_PORT}" readonly HTTP_URL="http://localhost:${HTTP_PORT}"
readonly SYSTEMD_DIR="$CURRENT_DIR/systemd" readonly SYSTEMD_DIR="$CURRENT_DIR/systemd"
readonly SYSTEM_SYSTEMD_DIR="/etc/systemd/system" readonly SYSTEM_SYSTEMD_DIR="/etc/systemd/system"
@ -1326,11 +1326,11 @@ if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = "1" ]; then
# Setze DISPLAY-Variable # Setze DISPLAY-Variable
export DISPLAY=:0 export DISPLAY=:0
# Warte auf HTTPS-Backend # Warte auf HTTP-Backend
echo "Warte auf HTTPS-Backend..." echo "Warte auf HTTP-Backend..."
for i in {1..60}; do for i in {1..60}; do
if curl -k -s https://localhost:443 >/dev/null 2>&1; then if curl -s http://localhost:5000 >/dev/null 2>&1; then
echo "HTTPS-Backend erreichbar" echo "HTTP-Backend erreichbar"
break break
fi fi
echo "Warte... ($i/60)" echo "Warte... ($i/60)"
@ -1395,12 +1395,11 @@ if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = "1" ]; then
--ignore-certificate-errors-spki-list \ --ignore-certificate-errors-spki-list \
--disable-web-security \ --disable-web-security \
--allow-running-insecure-content \ --allow-running-insecure-content \
--unsafely-treat-insecure-origin-as-secure=https://localhost:443 \ http://localhost:5000
https://localhost:443
else else
exec firefox-esr \ exec firefox-esr \
--kiosk \ --kiosk \
https://localhost:443 http://localhost:5000
fi fi
fi fi
EOF EOF
@ -1739,29 +1738,8 @@ install_npm_dependencies() {
log "✅ NPM-Abhängigkeiten verarbeitet" log "✅ NPM-Abhängigkeiten verarbeitet"
} }
# =========================== SSL-ZERTIFIKAT GENERIERUNG =========================== # =========================== SSL-ZERTIFIKAT GENERIERUNG (ENTFERNT) ===========================
generate_ssl_certificate() { # SSL-Zertifikate nicht mehr benötigt - verwende HTTP statt HTTPS
log "=== SSL-ZERTIFIKAT GENERIERUNG ==="
progress "Generiere selbstsigniertes SSL-Zertifikat für localhost..."
local cert_dir="$APP_DIR/certs/localhost"
mkdir -p "$cert_dir"
# Generiere privaten Schlüssel
openssl genrsa -out "$cert_dir/localhost.key" 2048 || error "Fehler beim Generieren des privaten Schlüssels"
# Generiere Zertifikat
openssl req -new -x509 -key "$cert_dir/localhost.key" -out "$cert_dir/localhost.crt" -days 365 \
-subj "/C=DE/ST=Baden-Wuerttemberg/L=Stuttgart/O=Mercedes-Benz/OU=IT/CN=localhost" \
|| error "Fehler beim Generieren des SSL-Zertifikats"
# Berechtigungen setzen
chmod 600 "$cert_dir/localhost.key"
chmod 644 "$cert_dir/localhost.crt"
log "✅ SSL-Zertifikat erfolgreich generiert"
}
# =========================== ROBUSTE SYSTEMD-SERVICES INSTALLATION =========================== # =========================== ROBUSTE SYSTEMD-SERVICES INSTALLATION ===========================
install_systemd_services() { install_systemd_services() {
@ -1785,7 +1763,7 @@ install_systemd_services() {
# Definiere Service-Dateien mit Priorität # Definiere Service-Dateien mit Priorität
local essential_services=( local essential_services=(
"$HTTPS_SERVICE_NAME.service" "$HTTP_SERVICE_NAME.service"
) )
local optional_services=( local optional_services=(
@ -1868,14 +1846,14 @@ enable_and_start_services() {
local successful_services=0 local successful_services=0
local failed_services=0 local failed_services=0
# HTTPS-Service (kritisch) # HTTP-Backend-Service (kritisch)
progress "Aktiviere und starte HTTPS-Service (kritisch)..." progress "Aktiviere und starte HTTP-Backend-Service (kritisch)..."
if systemctl enable "$HTTPS_SERVICE_NAME" 2>/dev/null; then if systemctl enable "$HTTP_SERVICE_NAME" 2>/dev/null; then
success "✅ HTTPS-Service erfolgreich aktiviert" success "✅ HTTP-Backend-Service erfolgreich aktiviert"
if systemctl start "$HTTPS_SERVICE_NAME" 2>/dev/null; then if systemctl start "$HTTP_SERVICE_NAME" 2>/dev/null; then
success "✅ HTTPS-Service erfolgreich gestartet" success "✅ HTTP-Backend-Service erfolgreich gestartet"
# Warte und prüfe Status gründlich # Warte und prüfe Status gründlich
local startup_timeout=15 local startup_timeout=15
@ -1883,31 +1861,31 @@ enable_and_start_services() {
local elapsed=0 local elapsed=0
while [ $elapsed -lt $startup_timeout ]; do while [ $elapsed -lt $startup_timeout ]; do
if systemctl is-active --quiet "$HTTPS_SERVICE_NAME"; then if systemctl is-active --quiet "$HTTP_SERVICE_NAME"; then
success "✅ HTTPS-Service läuft stabil nach ${elapsed}s" success "✅ HTTP-Backend-Service läuft stabil nach ${elapsed}s"
((successful_services++)) ((successful_services++))
break break
fi fi
sleep $check_interval sleep $check_interval
elapsed=$((elapsed + check_interval)) elapsed=$((elapsed + check_interval))
progress "Warte auf HTTPS-Service Startup... (${elapsed}/${startup_timeout}s)" progress "Warte auf HTTP-Backend-Service Startup... (${elapsed}/${startup_timeout}s)"
done done
if [ $elapsed -ge $startup_timeout ]; then if [ $elapsed -ge $startup_timeout ]; then
error "❌ HTTPS-Service Timeout nach ${startup_timeout}s - Service nicht verfügbar" error "❌ HTTP-Backend-Service Timeout nach ${startup_timeout}s - Service nicht verfügbar"
# Debugging-Informationen # Debugging-Informationen
info "HTTPS-Service Status-Debug:" info "HTTP-Backend-Service Status-Debug:"
systemctl status "$HTTPS_SERVICE_NAME" --no-pager -l || true systemctl status "$HTTP_SERVICE_NAME" --no-pager -l || true
journalctl -u "$HTTPS_SERVICE_NAME" --no-pager -n 10 || true journalctl -u "$HTTP_SERVICE_NAME" --no-pager -n 10 || true
((failed_services++)) ((failed_services++))
fi fi
else else
error "❌ HTTPS-Service konnte nicht gestartet werden" error "❌ HTTP-Backend-Service konnte nicht gestartet werden"
((failed_services++)) ((failed_services++))
fi fi
else else
error "❌ HTTPS-Service konnte nicht aktiviert werden" error "❌ HTTP-Backend-Service konnte nicht aktiviert werden"
((failed_services++)) ((failed_services++))
fi fi
@ -1988,28 +1966,28 @@ test_application() {
# Test 1: Service-Status prüfen # Test 1: Service-Status prüfen
progress "Teste Service-Status..." progress "Teste Service-Status..."
if systemctl is-active --quiet "$HTTPS_SERVICE_NAME"; then if systemctl is-active --quiet "$HTTP_SERVICE_NAME"; then
success "✅ HTTPS-Service ist aktiv" success "✅ HTTP-Backend-Service ist aktiv"
else else
warning "⚠️ HTTPS-Service ist nicht aktiv" warning "⚠️ HTTP-Backend-Service ist nicht aktiv"
((test_warnings++)) ((test_warnings++))
# Debug-Informationen # Debug-Informationen
info "Service-Status Debug:" info "Service-Status Debug:"
systemctl status "$HTTPS_SERVICE_NAME" --no-pager -l || true systemctl status "$HTTP_SERVICE_NAME" --no-pager -l || true
fi fi
# Test 2: Port-Verfügbarkeit # Test 2: Port-Verfügbarkeit
progress "Teste Port-Verfügbarkeit..." progress "Teste Port-Verfügbarkeit..."
if ss -tlnp | grep -q ":443 "; then if ss -tlnp | grep -q ":5000 "; then
success "✅ Port 443 ist geöffnet" success "✅ Port 5000 ist geöffnet"
else else
warning "⚠️ Port 443 ist nicht geöffnet" warning "⚠️ Port 5000 ist nicht geöffnet"
((test_warnings++)) ((test_warnings++))
fi fi
# Test 3: HTTPS-Verbindung (robust mit mehreren Methoden) # Test 3: HTTP-Backend-Verbindung (robust mit mehreren Methoden)
progress "Teste HTTPS-Verbindung (robust)..." progress "Teste HTTP-Backend-Verbindung (robust)..."
local max_attempts=20 local max_attempts=20
local attempt=1 local attempt=1
@ -2017,45 +1995,48 @@ test_application() {
while [ $attempt -le $max_attempts ]; do while [ $attempt -le $max_attempts ]; do
# Methode 1: curl mit verschiedenen Optionen # Methode 1: curl mit verschiedenen Optionen
if curl -k -s --connect-timeout 3 --max-time 8 "$HTTPS_URL" >/dev/null 2>&1; then if curl -s --connect-timeout 3 --max-time 8 "$HTTP_URL" >/dev/null 2>&1; then
connection_successful=true connection_successful=true
break break
fi fi
# Methode 2: wget als Fallback # Methode 2: wget als Fallback
if command -v wget >/dev/null 2>&1; then if command -v wget >/dev/null 2>&1; then
if wget -q --no-check-certificate --timeout=3 --tries=1 "$HTTPS_URL" -O /dev/null 2>/dev/null; then if wget -q --timeout=3 --tries=1 "$HTTP_URL" -O /dev/null 2>/dev/null; then
connection_successful=true connection_successful=true
break break
fi fi
fi fi
# Methode 3: openssl s_client als direkter Test # Methode 3: nc als direkter Port-Test
if echo "GET / HTTP/1.0" | openssl s_client -connect localhost:443 -quiet 2>/dev/null | grep -q "HTTP"; then if command -v nc >/dev/null 2>&1; then
if echo "GET / HTTP/1.0" | nc -w 3 localhost 5000 2>/dev/null | grep -q "HTTP"; then
connection_successful=true connection_successful=true
break break
fi fi
fi
progress "Warte auf HTTPS-Backend... ($attempt/$max_attempts)" progress "Warte auf HTTP-Backend... ($attempt/$max_attempts)"
sleep 3 sleep 3
((attempt++)) ((attempt++))
done done
if [ "$connection_successful" = true ]; then if [ "$connection_successful" = true ]; then
success "✅ HTTPS-Backend erreichbar unter $HTTPS_URL" success "✅ HTTP-Backend erreichbar unter $HTTP_URL"
# Erweiterte Verbindungstests # Erweiterte Verbindungstests
progress "Führe erweiterte HTTPS-Tests durch..." progress "Führe erweiterte HTTP-Tests durch..."
# Test Antwortzeit # Test Antwortzeit
local response_time=$(curl -k -s -w "%{time_total}" -o /dev/null "$HTTPS_URL" 2>/dev/null || echo "timeout") local response_time=$(curl -s -w "%{time_total}" -o /dev/null "$HTTP_URL" 2>/dev/null || echo "timeout")
if [ "$response_time" != "timeout" ]; then if [ "$response_time" != "timeout" ]; then
info "🕐 HTTPS Antwortzeit: ${response_time}s" info "🕐 HTTP Antwortzeit: ${response_time}s"
# Bewerte Antwortzeit # Bewerte Antwortzeit (ohne bc für bessere Kompatibilität)
if [ "$(echo "$response_time < 2.0" | bc 2>/dev/null || echo "0")" -eq 1 ]; then local response_ms=$(echo "$response_time * 1000" | awk '{print int($1)}' 2>/dev/null || echo "9999")
if [ "$response_ms" -lt 2000 ]; then
success "✅ Gute Antwortzeit" success "✅ Gute Antwortzeit"
elif [ "$(echo "$response_time < 5.0" | bc 2>/dev/null || echo "0")" -eq 1 ]; then elif [ "$response_ms" -lt 5000 ]; then
info " Akzeptable Antwortzeit" info " Akzeptable Antwortzeit"
else else
warning "⚠️ Langsame Antwortzeit" warning "⚠️ Langsame Antwortzeit"
@ -2064,7 +2045,7 @@ test_application() {
fi fi
# Test HTTP-Status # Test HTTP-Status
local http_status=$(curl -k -s -o /dev/null -w "%{http_code}" "$HTTPS_URL" 2>/dev/null || echo "000") local http_status=$(curl -s -o /dev/null -w "%{http_code}" "$HTTP_URL" 2>/dev/null || echo "000")
if [ "$http_status" = "200" ]; then if [ "$http_status" = "200" ]; then
success "✅ HTTP Status 200 OK" success "✅ HTTP Status 200 OK"
else else
@ -2072,42 +2053,34 @@ test_application() {
fi fi
else else
error "❌ HTTPS-Backend nicht erreichbar nach $max_attempts Versuchen" error "❌ HTTP-Backend nicht erreichbar nach $max_attempts Versuchen"
((test_errors++)) ((test_errors++))
# Debugging-Informationen # Debugging-Informationen
info "HTTPS-Debug Informationen:" info "HTTP-Debug Informationen:"
netstat -tlnp | grep ":443" || info "Port 443 nicht gefunden" netstat -tlnp | grep ":5000" || info "Port 5000 nicht gefunden"
ss -tlnp | grep ":443" || info "Port 443 nicht in ss gefunden" ss -tlnp | grep ":5000" || info "Port 5000 nicht in ss gefunden"
fi fi
# Test 4: SSL-Zertifikat (erweitert) # Test 4: HTTP-Header und Content-Type Prüfung
progress "Teste SSL-Zertifikat (erweitert)..." progress "Teste HTTP-Header und Content-Type..."
# Methode 1: openssl s_client
if echo | openssl s_client -connect localhost:443 -servername localhost 2>/dev/null | openssl x509 -noout -text >/dev/null 2>&1; then
success "✅ SSL-Zertifikat ist gültig"
# Zertifikat-Details extrahieren
local cert_info=$(echo | openssl s_client -connect localhost:443 -servername localhost 2>/dev/null | openssl x509 -noout -subject -dates 2>/dev/null || echo "Nicht verfügbar")
info "📜 Zertifikat-Info: $cert_info"
if [ "$connection_successful" = true ]; then
# Test Content-Type Header
local content_type=$(curl -s -I "$HTTP_URL" 2>/dev/null | grep -i "content-type:" | head -1 | cut -d: -f2 | tr -d ' \r\n' || echo "unknown")
if [[ "$content_type" == *"text/html"* ]]; then
success "✅ Korrekte HTML-Antwort erkannt"
else else
warning "⚠️ SSL-Zertifikat-Test fehlgeschlagen" info " Content-Type: $content_type"
((test_warnings++)) fi
# Alternative: Teste ob Zertifikat-Dateien existieren # Test Server Header
if [ -f "$APP_DIR/certs/localhost/localhost.crt" ] && [ -f "$APP_DIR/certs/localhost/localhost.key" ]; then local server_header=$(curl -s -I "$HTTP_URL" 2>/dev/null | grep -i "server:" | head -1 | cut -d: -f2 | tr -d ' \r\n' || echo "unknown")
info "📁 SSL-Zertifikat-Dateien sind vorhanden" if [ "$server_header" != "unknown" ]; then
info "🖥️ Server: $server_header"
# Teste Zertifikat-Datei direkt fi
if openssl x509 -in "$APP_DIR/certs/localhost/localhost.crt" -noout -text >/dev/null 2>&1; then
success "✅ SSL-Zertifikat-Datei ist gültig"
else else
warning "⚠️ SSL-Zertifikat-Datei ist ungültig" info " HTTP-Header Test übersprungen (Backend nicht erreichbar)"
((test_warnings++))
fi
fi
fi fi
# Test 5: Python-Anwendung Import-Test # Test 5: Python-Anwendung Import-Test
@ -2274,7 +2247,6 @@ install_dependencies_only() {
# Anwendung deployen # Anwendung deployen
deploy_application deploy_application
install_npm_dependencies install_npm_dependencies
generate_ssl_certificate
# Services für manuelles Testen vorbereiten # Services für manuelles Testen vorbereiten
install_systemd_services install_systemd_services
@ -2306,8 +2278,8 @@ install_dependencies_only() {
log " 🔧 Services: Installiert und gestartet" log " 🔧 Services: Installiert und gestartet"
info "" info ""
info "🚀 System bereit für manuelle Tests und Entwicklung!" info "🚀 System bereit für manuelle Tests und Entwicklung!"
info "🌐 HTTPS-Backend sollte verfügbar sein: $HTTPS_URL" info "🌐 HTTP-Backend sollte verfügbar sein: $HTTP_URL"
info "⚙️ Manuelle App-Start Alternative: cd /opt/myp && python3 app.py" info "⚙️ Manuelle App-Start Alternative: cd /opt/myp && python3 app.py --production"
# Fehler-Zusammenfassung anzeigen # Fehler-Zusammenfassung anzeigen
show_error_summary show_error_summary
@ -2330,9 +2302,9 @@ install_dependencies_only() {
echo -e " 1. Testen Sie die Anwendung:" echo -e " 1. Testen Sie die Anwendung:"
echo -e " ${CYAN}cd $APP_DIR && python3 app.py${NC}" echo -e " ${CYAN}cd $APP_DIR && python3 app.py${NC}"
echo -e " 2. Oder prüfen Sie den Service:" echo -e " 2. Oder prüfen Sie den Service:"
echo -e " ${CYAN}sudo systemctl status $HTTPS_SERVICE_NAME${NC}" echo -e " ${CYAN}sudo systemctl status $HTTP_SERVICE_NAME${NC}"
echo -e " 3. Zugriff über Browser:" echo -e " 3. Zugriff über Browser:"
echo -e " ${CYAN}$HTTPS_URL${NC}" echo -e " ${CYAN}$HTTP_URL${NC}"
echo "" echo ""
echo -e "${GREEN}✅ System bereit für manuelle Tests!${NC}" echo -e "${GREEN}✅ System bereit für manuelle Tests!${NC}"
echo -e "${GREEN}=================================================================${NC}" echo -e "${GREEN}=================================================================${NC}"
@ -2366,7 +2338,6 @@ install_full_production_system() {
install_python_packages install_python_packages
deploy_application deploy_application
install_npm_dependencies install_npm_dependencies
generate_ssl_certificate
else else
info "Anwendung bereits deployed - überspringe Basis-Installation" info "Anwendung bereits deployed - überspringe Basis-Installation"
# Trotzdem Netzwerk-Sicherheit aktualisieren # Trotzdem Netzwerk-Sicherheit aktualisieren
@ -2436,7 +2407,7 @@ install_full_production_system() {
log " 🖥️ RDP-Zugang: root:744563017196A (Port 3389)" log " 🖥️ RDP-Zugang: root:744563017196A (Port 3389)"
log " 🔒 Firewall: Konfiguriert und aktiv" log " 🔒 Firewall: Konfiguriert und aktiv"
log " ⚡ Performance: Optimiert für Raspberry Pi" log " ⚡ Performance: Optimiert für Raspberry Pi"
log " 🌐 HTTPS-Backend: $HTTPS_URL" log " 🌐 HTTP-Backend: $HTTP_URL"
log " 🛡️ Sicherheit: IPv6 deaktiviert, erweiterte Netzwerk-Sicherheit" log " 🛡️ Sicherheit: IPv6 deaktiviert, erweiterte Netzwerk-Sicherheit"
info "" info ""
success "🚀 Produktionssystem vollständig einsatzbereit!" success "🚀 Produktionssystem vollständig einsatzbereit!"

View File

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=MYP Druckerverwaltung HTTPS Backend (Port 443) Description=MYP Druckerverwaltung HTTP Backend (Port 5000)
Documentation=https://github.com/MYP-Druckerverwaltung Documentation=https://github.com/MYP-Druckerverwaltung
After=network.target network-online.target After=network.target network-online.target
Wants=network-online.target Wants=network-online.target
@ -10,41 +10,36 @@ Type=simple
User=root User=root
Group=root Group=root
WorkingDirectory=/opt/myp WorkingDirectory=/opt/myp
ExecStartPre=/usr/bin/python3 -c "from utils.ssl_config import ensure_ssl_certificates; ensure_ssl_certificates('/opt/myp')" # Vereinfachter Start-Befehl - startet direkt die Python-App im Produktionsmodus
ExecStart=/usr/bin/python3 -c "import sys; sys.path.insert(0, '/opt/myp'); from app import app; from utils.ssl_config import get_ssl_context; ssl_ctx = get_ssl_context('/opt/myp'); app.run(host='0.0.0.0', port=443, debug=False, ssl_context=ssl_ctx, threaded=True)" ExecStart=/usr/bin/python3 /opt/myp/app.py --production
Restart=always Restart=always
RestartSec=10 RestartSec=10
StartLimitBurst=5 StartLimitBurst=5
StartLimitInterval=300 StartLimitInterval=300
# Umgebungsvariablen für Debian/Linux-Optimierung # Umgebungsvariablen für optimale Performance
Environment=PYTHONUNBUFFERED=1 Environment=PYTHONUNBUFFERED=1
Environment=FLASK_ENV=production Environment=FLASK_ENV=production
Environment=FLASK_HOST=0.0.0.0 Environment=FLASK_HOST=0.0.0.0
Environment=FLASK_PORT=443 Environment=FLASK_PORT=5000
Environment=PYTHONPATH=/opt/myp Environment=PYTHONPATH=/opt/myp
Environment=LC_ALL=C.UTF-8 Environment=LC_ALL=C.UTF-8
Environment=LANG=C.UTF-8 Environment=LANG=C.UTF-8
Environment=SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt Environment=KIOSK_MODE=true
Environment=REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt Environment=USE_OPTIMIZED_CONFIG=true
Environment=CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
# Logging-Konfiguration # Logging-Konfiguration
StandardOutput=journal StandardOutput=journal
StandardError=journal StandardError=journal
SyslogIdentifier=myp-https SyslogIdentifier=myp-backend
# Sicherheitseinstellungen für Produktionsumgebung # Sicherheitseinstellungen (gelockert für bessere Kompatibilität)
NoNewPrivileges=true NoNewPrivileges=true
PrivateTmp=false PrivateTmp=false
ProtectSystem=strict ProtectSystem=false
ReadWritePaths=/opt/myp ReadWritePaths=/opt/myp
ReadWritePaths=/var/log ReadWritePaths=/var/log
ReadWritePaths=/tmp ReadWritePaths=/tmp
# Netzwerk-Capabilities für Port 443 (privilegierter Port)
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -33,14 +33,14 @@ ExecStartPre=/bin/bash -c '\
sleep 2; \ sleep 2; \
done; \ done; \
\ \
# Warte auf HTTPS-Backend mit verbesserter Erkennung \ # Warte auf HTTP-Backend mit verbesserter Erkennung \
echo "🔍 Warte auf HTTPS Backend..."; \ echo "🔍 Warte auf HTTP Backend..."; \
for i in {1..120}; do \ for i in {1..120}; do \
if curl -k -s --connect-timeout 3 --max-time 5 https://localhost:443/api/kiosk/status >/dev/null 2>&1; then \ if curl -s --connect-timeout 3 --max-time 5 http://localhost:5000/api/kiosk/status >/dev/null 2>&1; then \
echo " HTTPS Backend erreichbar und API verfügbar"; \ echo " HTTP Backend erreichbar und API verfügbar"; \
break; \ break; \
elif curl -k -s --connect-timeout 3 --max-time 5 https://localhost:443 >/dev/null 2>&1; then \ elif curl -s --connect-timeout 3 --max-time 5 http://localhost:5000 >/dev/null 2>&1; then \
echo " HTTPS Backend erreichbar"; \ echo " HTTP Backend erreichbar"; \
break; \ break; \
fi; \ fi; \
echo " Warte auf Backend... ($i/120)"; \ echo " Warte auf Backend... ($i/120)"; \
@ -149,7 +149,7 @@ ExecStart=/bin/bash -c '\
--ignore-certificate-errors-spki-list \ --ignore-certificate-errors-spki-list \
--disable-web-security \ --disable-web-security \
--allow-running-insecure-content \ --allow-running-insecure-content \
--unsafely-treat-insecure-origin-as-secure=https://localhost:443 \ --disable-extensions \
--disable-blink-features=AutomationControlled \ --disable-blink-features=AutomationControlled \
--disable-ipc-flooding-protection"; \ --disable-ipc-flooding-protection"; \
else \ else \
@ -163,7 +163,7 @@ ExecStart=/bin/bash -c '\
fi; \ fi; \
\ \
# URL mit Fallback \ # URL mit Fallback \
TARGET_URL="https://localhost:443"; \ TARGET_URL="http://localhost:5000"; \
\ \
# Browser starten mit Fehlerbehandlung \ # Browser starten mit Fehlerbehandlung \
echo "🖥 Starte $BROWSER im Kiosk-Modus..."; \ echo "🖥 Starte $BROWSER im Kiosk-Modus..."; \