# MYP Production HTTPS-Only Setup ## 🎯 Ziel - **ERR_SSL_KEY_USAGE_INCOMPATIBLE** beheben - Nur Port 443 (HTTPS) verwenden - Port 5000 (HTTP) komplett deaktivieren - Kiosk-Modus automatisch starten - Firewall: Nur Port 443 offen ## 🚀 Schnelle Lösung (Raspberry Pi) ### Super-Skript (Das EINZIGE was du brauchst!) ```bash # Intelligentes Super-Skript für ALLE Probleme: cd /opt/myp sudo ./setup_https_only.sh # Das Super-Skript erkennt und behebt automatisch: # ✅ ERR_SSL_KEY_USAGE_INCOMPATIBLE # ✅ graphical session target not found # ✅ connection refused # ✅ Port-Konflikte (5000 blockieren, 443 öffnen) # ✅ SSL-Zertifikat-Probleme # ✅ Service-Dependencies # ✅ Kiosk-Konfiguration (Desktop/Headless automatisch) # ✅ Firewall-Optimierung ``` ### 3. Services prüfen ```bash # Status prüfen: sudo systemctl status myp-production sudo systemctl status myp-kiosk # Logs anzeigen: sudo journalctl -u myp-production -f ``` ## 📋 Manuelle Schritte (falls Skripte nicht verfügbar) ### 1. Alte Services stoppen ```bash sudo systemctl stop myp-https myp-app myp-kiosk sudo systemctl disable myp-https myp-app ``` ### 2. Browser-kompatible SSL-Zertifikate erstellen ```bash # SSL-Verzeichnis erstellen sudo mkdir -p /opt/myp/ssl cd /opt/myp/ssl # Browser-kompatible OpenSSL-Konfiguration sudo tee ssl.conf << 'EOF' [req] distinguished_name = req_distinguished_name req_extensions = v3_req prompt = no [req_distinguished_name] C = DE ST = Baden-Wuerttemberg L = Stuttgart O = Mercedes-Benz AG OU = MYP Druckerverwaltung CN = m040tbaraspi001 [v3_req] # KRITISCH für Browser-Kompatibilität basicConstraints = critical, CA:FALSE keyUsage = critical, digitalSignature, keyEncipherment, keyAgreement extendedKeyUsage = critical, serverAuth, clientAuth subjectAltName = critical, @alt_names nsCertType = server [alt_names] DNS.1 = localhost DNS.2 = m040tbaraspi001 DNS.3 = m040tbaraspi001.local DNS.4 = m040tbaraspi001.de040.corpintra.net IP.1 = 127.0.0.1 EOF # Zertifikate generieren sudo openssl genrsa -out key.pem 2048 sudo openssl req -new -x509 -key key.pem -out cert.pem \ -days 365 -config ssl.conf -extensions v3_req -sha256 # Berechtigungen setzen sudo chmod 644 cert.pem sudo chmod 600 key.pem sudo rm ssl.conf ``` ### 3. Production Service installieren ```bash # Service-Datei kopieren sudo cp /opt/myp/systemd/myp-production.service /etc/systemd/system/ # Service aktivieren sudo systemctl daemon-reload sudo systemctl enable myp-production sudo systemctl start myp-production ``` ### 4. Kiosk-Service für HTTPS aktualisieren ```bash # Aktualisierte Kiosk-Service-Datei kopieren sudo cp /opt/myp/systemd/myp-kiosk.service /etc/systemd/system/ # Service neu laden und starten sudo systemctl daemon-reload sudo systemctl enable myp-kiosk sudo systemctl start myp-kiosk ``` ### 5. Firewall für HTTPS-Only konfigurieren ```bash # UFW installieren falls nicht vorhanden sudo apt update && sudo apt install -y ufw # Firewall zurücksetzen sudo ufw --force reset # Restriktive Policies sudo ufw default deny incoming sudo ufw default deny outgoing sudo ufw default deny forward # Loopback erlauben sudo ufw allow in on lo sudo ufw allow out on lo # SSH beibehalten (falls aktiv) sudo ufw allow 22/tcp # Nur HTTPS Port 443 öffnen sudo ufw allow 443/tcp # HTTP-Ports explizit blockieren sudo ufw deny 80/tcp sudo ufw deny 5000/tcp # System-Updates erlauben sudo ufw allow out 53/udp # DNS sudo ufw allow out 80/tcp # HTTP für Updates sudo ufw allow out 443/tcp # HTTPS für Updates sudo ufw allow out 123/udp # NTP # Lokales Netzwerk für Drucker sudo ufw allow out on eth0 to 192.168.0.0/16 sudo ufw allow out on wlan0 to 192.168.0.0/16 # UFW aktivieren sudo ufw --force enable ``` ## 🔧 Problembehandlung ### SSL-Zertifikat-Fehler beheben ```bash # SSL-Fix-Skript ausführen (falls vorhanden) sudo /opt/myp/fix_ssl_raspberry.sh # Oder manuell neue Zertifikate erstellen (siehe oben) ``` ### Connection Refused beheben ```bash # Quick Fix ausführen sudo /opt/myp/quick_fix_connection.sh # Oder detaillierte Diagnose sudo /opt/myp/debug_connection_refused.sh ``` ### Service-Status prüfen ```bash # Alle Services prüfen sudo systemctl status myp-production myp-kiosk # Logs anzeigen sudo journalctl -u myp-production -f sudo journalctl -u myp-kiosk -f # Port-Status prüfen sudo netstat -tlnp | grep :443 sudo ss -tlnp | grep :443 ``` ### Verbindungstest ```bash # HTTPS-Verbindung testen curl -k -v https://localhost curl -k -v https://m040tbaraspi001.de040.corpintra.net # Port-Erreichbarkeit testen timeout 5 bash -c '