diff --git a/IHK_Projektdokumentation/Gamma_AI_Präsentations_Prompt.md b/IHK_Projektdokumentation/Gamma_AI_Präsentations_Prompt.md new file mode 100644 index 000000000..0519ecba6 --- /dev/null +++ b/IHK_Projektdokumentation/Gamma_AI_Präsentations_Prompt.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/backend/__pycache__/app.cpython-313.pyc b/backend/__pycache__/app.cpython-313.pyc new file mode 100644 index 000000000..6751f5d85 Binary files /dev/null and b/backend/__pycache__/app.cpython-313.pyc differ diff --git a/backend/__pycache__/models.cpython-313.pyc b/backend/__pycache__/models.cpython-313.pyc new file mode 100644 index 000000000..b84eb55a9 Binary files /dev/null and b/backend/__pycache__/models.cpython-313.pyc differ diff --git a/backend/app_production.py b/backend/app_production.py index 56f68029f..648a0c1d4 100644 --- a/backend/app_production.py +++ b/backend/app_production.py @@ -145,13 +145,32 @@ def setup_production_ssl(): return cert_file, key_file def create_production_ssl_certificates(ssl_dir): - """Erstelle browser-kompatible SSL-Zertifikate manuell""" - - import subprocess - import tempfile + """Erstelle browser-kompatible SSL-Zertifikate plattformübergreifend""" app_logger.info("🔧 Erstelle browser-kompatible SSL-Zertifikate...") + # Versuche OpenSSL (Linux/Raspberry Pi) + if platform.system() != 'Windows': + try: + create_ssl_with_openssl(ssl_dir) + return + except Exception as e: + app_logger.warning(f"⚠️ OpenSSL fehlgeschlagen: {e}") + + # Fallback: Python Cryptography Library (Windows + Linux) + try: + create_ssl_with_python(ssl_dir) + except ImportError as e: + app_logger.error("❌ Cryptography Library nicht installiert") + app_logger.error("💡 Installiere mit: pip install cryptography") + app_logger.error("💡 Dann starte das Skript neu") + raise Exception("SSL-Zertifikat-Erstellung erfordert 'cryptography' library") + +def create_ssl_with_openssl(ssl_dir): + """Erstelle SSL-Zertifikate mit OpenSSL""" + import subprocess + import tempfile + # OpenSSL-Konfiguration für Browser-Kompatibilität openssl_config = f"""[req] distinguished_name = req_distinguished_name @@ -219,7 +238,7 @@ DNS.8 = *.de040.corpintra.net os.chmod(f'{ssl_dir}/cert.pem', 0o644) os.chmod(f'{ssl_dir}/key.pem', 0o600) - app_logger.info("✅ Browser-kompatible SSL-Zertifikate erstellt") + app_logger.info("✅ Browser-kompatible SSL-Zertifikate mit OpenSSL erstellt") finally: # Räume temporäre Datei auf @@ -228,6 +247,114 @@ DNS.8 = *.de040.corpintra.net except: pass +def create_ssl_with_python(ssl_dir): + """Erstelle SSL-Zertifikate mit Python Cryptography Library""" + from cryptography import x509 + from cryptography.x509.oid import NameOID, ExtensionOID + from cryptography.hazmat.primitives import hashes, serialization + from cryptography.hazmat.primitives.asymmetric import rsa + import ipaddress + + app_logger.info("🐍 Erstelle SSL-Zertifikate mit Python Cryptography...") + + # Generiere Private Key + private_key = rsa.generate_private_key( + public_exponent=65537, + key_size=2048, + ) + + # Subject und Issuer + subject = issuer = x509.Name([ + x509.NameAttribute(NameOID.COUNTRY_NAME, "DE"), + x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, "Baden-Wuerttemberg"), + x509.NameAttribute(NameOID.LOCALITY_NAME, "Stuttgart"), + x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Mercedes-Benz AG"), + x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, "MYP Druckerverwaltung"), + x509.NameAttribute(NameOID.COMMON_NAME, "m040tbaraspi001"), + ]) + + # Subject Alternative Names für Browser-Kompatibilität + san_list = [ + # Lokale Entwicklung + x509.DNSName("localhost"), + x509.DNSName("*.localhost"), + x509.IPAddress(ipaddress.IPv4Address("127.0.0.1")), + x509.IPAddress(ipaddress.IPv6Address("::1")), + + # Raspberry Pi Hostname + x509.DNSName("m040tbaraspi001"), + x509.DNSName("m040tbaraspi001.local"), + x509.DNSName("raspberrypi"), + x509.DNSName("raspberrypi.local"), + + # Intranet-Domain + x509.DNSName("m040tbaraspi001.de040.corpintra.net"), + x509.DNSName("*.de040.corpintra.net"), + ] + + # Erstelle Zertifikat + cert = x509.CertificateBuilder().subject_name( + subject + ).issuer_name( + issuer + ).public_key( + private_key.public_key() + ).serial_number( + x509.random_serial_number() + ).not_valid_before( + datetime.now() + ).not_valid_after( + datetime.now() + timedelta(days=365) + ).add_extension( + x509.SubjectAlternativeName(san_list), + critical=True, + ).add_extension( + x509.BasicConstraints(ca=False, path_length=None), + critical=True, + ).add_extension( + x509.KeyUsage( + digital_signature=True, + key_encipherment=True, + key_agreement=True, + key_cert_sign=False, + crl_sign=False, + content_commitment=False, + data_encipherment=False, + encipher_only=False, + decipher_only=False + ), + critical=True, + ).add_extension( + x509.ExtendedKeyUsage([ + x509.oid.ExtendedKeyUsageOID.SERVER_AUTH, + x509.oid.ExtendedKeyUsageOID.CLIENT_AUTH, + ]), + critical=True, + ).sign(private_key, hashes.SHA256()) + + # Schreibe Private Key + with open(f'{ssl_dir}/key.pem', 'wb') as f: + f.write(private_key.private_bytes( + encoding=serialization.Encoding.PEM, + format=serialization.PrivateFormat.PKCS8, + encryption_algorithm=serialization.NoEncryption() + )) + + # Schreibe Zertifikat + with open(f'{ssl_dir}/cert.pem', 'wb') as f: + f.write(cert.public_bytes(serialization.Encoding.PEM)) + + # Setze Berechtigungen falls möglich + try: + os.chmod(f'{ssl_dir}/cert.pem', 0o644) + os.chmod(f'{ssl_dir}/key.pem', 0o600) + except: + pass # Windows hat andere Berechtigungen + + app_logger.info("✅ Browser-kompatible SSL-Zertifikate mit Python erstellt") + + + # =========================== PRODUKTIONS-SSL-KONTEXT =========================== def get_production_ssl_context(): diff --git a/backend/logs/app/app.log b/backend/logs/app/app.log index 9afe64fb9..c0bba4f9d 100644 --- a/backend/logs/app/app.log +++ b/backend/logs/app/app.log @@ -3829,3 +3829,17 @@ AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'? AttributeError: module 'os' has no attribute 'geteuid'. Did you mean: 'getpid'? 2025-06-10 13:11:47 - [app] app - [INFO] INFO - ✅ Cleanup abgeschlossen +2025-06-10 13:30:33 - [app] app - [WARNING] WARNING - DatabaseCleanupManager nicht verfügbar - Fallback auf Legacy-Cleanup +2025-06-10 13:30:33 - [app] app - [INFO] INFO - Optimierte SQLite-Engine erstellt: C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend\instance\printer_manager.db +2025-06-10 13:30:33 - [app] app - [INFO] INFO - 🚀 MYP Produktions-Server startet... +2025-06-10 13:30:33 - [app] app - [INFO] INFO - 📅 Start-Zeit: 2025-06-10 13:30:33 +2025-06-10 13:30:33 - [app] app - [INFO] INFO - 🖥️ Hostname: C040L0079726760 +2025-06-10 13:30:33 - [app] app - [INFO] INFO - 🐍 Python: 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)] +2025-06-10 13:30:33 - [app] app - [INFO] INFO - ✅ Produktions-Logging konfiguriert +2025-06-10 13:30:33 - [app] app - [INFO] INFO - 🪟 Windows-Modus: Root-Check übersprungen +2025-06-10 13:30:33 - [app] app - [INFO] INFO - 🔐 Prüfe SSL-Zertifikate für Produktionsbetrieb... +2025-06-10 13:30:33 - [app] app - [INFO] INFO - 🔧 Erstelle neue browser-kompatible SSL-Zertifikate... +2025-06-10 13:30:33 - [app] app - [INFO] INFO - 🔧 Erstelle browser-kompatible SSL-Zertifikate... +2025-06-10 13:30:33 - [app] app - [ERROR] ERROR - ❌ SSL-Zertifikat-Erstellung fehlgeschlagen: [WinError 2] Das System kann die angegebene Datei nicht finden +2025-06-10 13:30:33 - [app] app - [ERROR] ERROR - ❌ Netzwerk-Fehler: [WinError 2] Das System kann die angegebene Datei nicht finden +2025-06-10 13:30:33 - [app] app - [INFO] INFO - ✅ Cleanup abgeschlossen diff --git a/backend/logs/permissions/permissions.log b/backend/logs/permissions/permissions.log index b899bff27..169bf61e0 100644 --- a/backend/logs/permissions/permissions.log +++ b/backend/logs/permissions/permissions.log @@ -54,3 +54,4 @@ 2025-06-10 10:01:58 - [permissions] permissions - [INFO] INFO - 🔐 Permission Template Helpers registriert 2025-06-10 13:10:47 - [permissions] permissions - [INFO] INFO - 🔐 Permission Template Helpers registriert 2025-06-10 13:11:47 - [permissions] permissions - [INFO] INFO - 🔐 Permission Template Helpers registriert +2025-06-10 13:30:33 - [permissions] permissions - [INFO] INFO - 🔐 Permission Template Helpers registriert diff --git a/backend/logs/printer_monitor/printer_monitor.log b/backend/logs/printer_monitor/printer_monitor.log index a217cef01..112a624a2 100644 --- a/backend/logs/printer_monitor/printer_monitor.log +++ b/backend/logs/printer_monitor/printer_monitor.log @@ -545,3 +545,5 @@ 2025-06-10 13:10:47 - [printer_monitor] printer_monitor - [INFO] INFO - 🔍 Automatische Tapo-Erkennung in separatem Thread gestartet 2025-06-10 13:11:47 - [printer_monitor] printer_monitor - [INFO] INFO - 🖨️ Drucker-Monitor initialisiert 2025-06-10 13:11:47 - [printer_monitor] printer_monitor - [INFO] INFO - 🔍 Automatische Tapo-Erkennung in separatem Thread gestartet +2025-06-10 13:30:33 - [printer_monitor] printer_monitor - [INFO] INFO - 🖨️ Drucker-Monitor initialisiert +2025-06-10 13:30:33 - [printer_monitor] printer_monitor - [INFO] INFO - 🔍 Automatische Tapo-Erkennung in separatem Thread gestartet diff --git a/backend/logs/scheduler/scheduler.log b/backend/logs/scheduler/scheduler.log index bf09087f2..0c28483c5 100644 --- a/backend/logs/scheduler/scheduler.log +++ b/backend/logs/scheduler/scheduler.log @@ -117,3 +117,4 @@ 2025-06-10 10:01:58 - [scheduler] scheduler - [INFO] INFO - Scheduler gestartet 2025-06-10 13:10:47 - [scheduler] scheduler - [INFO] INFO - Task check_jobs registriert: Intervall 30s, Enabled: True 2025-06-10 13:11:47 - [scheduler] scheduler - [INFO] INFO - Task check_jobs registriert: Intervall 30s, Enabled: True +2025-06-10 13:30:33 - [scheduler] scheduler - [INFO] INFO - Task check_jobs registriert: Intervall 30s, Enabled: True diff --git a/backend/logs/security/security.log b/backend/logs/security/security.log index fb338181a..db4541cd3 100644 --- a/backend/logs/security/security.log +++ b/backend/logs/security/security.log @@ -54,3 +54,4 @@ 2025-06-10 10:01:58 - [security] security - [INFO] INFO - 🔒 Security System initialisiert 2025-06-10 13:10:47 - [security] security - [INFO] INFO - 🔒 Security System initialisiert 2025-06-10 13:11:47 - [security] security - [INFO] INFO - 🔒 Security System initialisiert +2025-06-10 13:30:33 - [security] security - [INFO] INFO - 🔒 Security System initialisiert diff --git a/backend/logs/startup/startup.log b/backend/logs/startup/startup.log index d79613512..672146652 100644 --- a/backend/logs/startup/startup.log +++ b/backend/logs/startup/startup.log @@ -420,3 +420,12 @@ 2025-06-10 13:11:47 - [startup] startup - [INFO] INFO - 🪟 Windows-Modus: Aktiviert 2025-06-10 13:11:47 - [startup] startup - [INFO] INFO - 🔒 Windows-sichere Log-Rotation: Aktiviert 2025-06-10 13:11:47 - [startup] startup - [INFO] INFO - ================================================== +2025-06-10 13:30:33 - [startup] startup - [INFO] INFO - ================================================== +2025-06-10 13:30:33 - [startup] startup - [INFO] INFO - [START] MYP Platform Backend wird gestartet... +2025-06-10 13:30:33 - [startup] startup - [INFO] INFO - 🐍 Python Version: 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)] +2025-06-10 13:30:33 - [startup] startup - [INFO] INFO - 💻 Betriebssystem: nt (win32) +2025-06-10 13:30:33 - [startup] startup - [INFO] INFO - 📁 Arbeitsverzeichnis: C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP +2025-06-10 13:30:33 - [startup] startup - [INFO] INFO - ⏰ Startzeit: 2025-06-10T13:30:33.717499 +2025-06-10 13:30:33 - [startup] startup - [INFO] INFO - 🪟 Windows-Modus: Aktiviert +2025-06-10 13:30:33 - [startup] startup - [INFO] INFO - 🔒 Windows-sichere Log-Rotation: Aktiviert +2025-06-10 13:30:33 - [startup] startup - [INFO] INFO - ================================================== diff --git a/backend/logs/tapo_controller/tapo_controller.log b/backend/logs/tapo_controller/tapo_controller.log index 325a90116..495411b77 100644 --- a/backend/logs/tapo_controller/tapo_controller.log +++ b/backend/logs/tapo_controller/tapo_controller.log @@ -288,3 +288,7 @@ 2025-06-10 13:11:33 - [tapo_controller] tapo_controller - [INFO] INFO - 🔄 teste 6 standard-ips aus der konfiguration 2025-06-10 13:11:33 - [tapo_controller] tapo_controller - [INFO] INFO - 🔍 teste ip 1/6: 192.168.0.103 2025-06-10 13:11:47 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert +2025-06-10 13:30:20 - [tapo_controller] tapo_controller - [INFO] INFO - 🔍 starte automatische tapo-steckdosenerkennung... +2025-06-10 13:30:20 - [tapo_controller] tapo_controller - [INFO] INFO - 🔄 teste 6 standard-ips aus der konfiguration +2025-06-10 13:30:20 - [tapo_controller] tapo_controller - [INFO] INFO - 🔍 teste ip 1/6: 192.168.0.103 +2025-06-10 13:30:33 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert diff --git a/backend/logs/windows_fixes/windows_fixes.log b/backend/logs/windows_fixes/windows_fixes.log index 2ba52f9aa..c1cd51ed5 100644 --- a/backend/logs/windows_fixes/windows_fixes.log +++ b/backend/logs/windows_fixes/windows_fixes.log @@ -66,3 +66,7 @@ 2025-06-10 13:11:47 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Subprocess automatisch gepatcht für UTF-8 Encoding (run + Popen) 2025-06-10 13:11:47 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Globaler subprocess-Patch angewendet 2025-06-10 13:11:47 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Alle Windows-Fixes erfolgreich angewendet +2025-06-10 13:30:33 - [windows_fixes] windows_fixes - [INFO] INFO - 🔧 Wende Windows-spezifische Fixes an... +2025-06-10 13:30:33 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Subprocess automatisch gepatcht für UTF-8 Encoding (run + Popen) +2025-06-10 13:30:33 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Globaler subprocess-Patch angewendet +2025-06-10 13:30:33 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Alle Windows-Fixes erfolgreich angewendet