"Update API configuration and SSL certificates for enhanced security"
This commit is contained in:
@@ -33,10 +33,10 @@ FLASK_DEBUG = True
|
||||
SESSION_LIFETIME = timedelta(days=7)
|
||||
|
||||
# SSL-Konfiguration
|
||||
SSL_ENABLED = False
|
||||
SSL_ENABLED = True
|
||||
SSL_CERT_PATH = "instance/ssl/myp.crt"
|
||||
SSL_KEY_PATH = "instance/ssl/myp.key"
|
||||
SSL_HOSTNAME = "raspberrypi"
|
||||
SSL_HOSTNAME = "localhost"
|
||||
|
||||
# Scheduler-Konfiguration
|
||||
SCHEDULER_INTERVAL = 60 # Sekunden
|
||||
@@ -92,49 +92,21 @@ def get_ssl_context():
|
||||
if not os.path.exists(SSL_CERT_PATH) or not os.path.exists(SSL_KEY_PATH):
|
||||
ensure_ssl_directory()
|
||||
|
||||
# Prüfen, ob wir uns im Entwicklungsmodus befinden
|
||||
# Im Entwicklungsmodus versuchen wir, einfache Zertifikate zu erstellen
|
||||
if FLASK_DEBUG:
|
||||
print("SSL-Zertifikate nicht gefunden. Erstelle selbstsignierte Zertifikate...")
|
||||
|
||||
# Auf Windows prüfen
|
||||
import platform
|
||||
if platform.system() == "Windows":
|
||||
# Unter Windows verwenden wir OpenSSL direkt über subprocess
|
||||
import subprocess
|
||||
try:
|
||||
# Erstelle ein selbstsigniertes Zertifikat mit OpenSSL
|
||||
ssl_cmd = [
|
||||
"openssl", "req", "-new", "-x509", "-newkey", "rsa:2048",
|
||||
"-nodes", "-keyout", SSL_KEY_PATH, "-out", SSL_CERT_PATH,
|
||||
"-days", "365", "-subj", f"/CN={SSL_HOSTNAME}"
|
||||
]
|
||||
|
||||
result = subprocess.run(ssl_cmd, capture_output=True, text=True)
|
||||
if result.returncode != 0:
|
||||
print(f"Fehler beim Erstellen der SSL-Zertifikate: {result.stderr}")
|
||||
|
||||
# Fallback: Generiere einfache Schlüssel mit Python
|
||||
create_simple_ssl_cert()
|
||||
|
||||
except Exception as e:
|
||||
print(f"Fehler beim Ausführen von OpenSSL: {e}")
|
||||
|
||||
# Fallback: Generiere einfache Schlüssel mit Python
|
||||
create_simple_ssl_cert()
|
||||
else:
|
||||
# Unter Linux das vorhandene Skript verwenden
|
||||
script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
|
||||
"install", "create_ssl_cert.sh")
|
||||
print("SSL-Zertifikate nicht gefunden. Erstelle einfache selbstsignierte Zertifikate...")
|
||||
try:
|
||||
# Einfache Zertifikate mit Python erstellen
|
||||
create_simple_ssl_cert()
|
||||
|
||||
# Ausführungsrechte setzen
|
||||
if os.path.exists(script_path):
|
||||
os.system(f"chmod +x {script_path}")
|
||||
|
||||
# Zertifikate erstellen mit spezifischem Hostnamen
|
||||
os.system(f"{script_path} -c {SSL_CERT_PATH} -k {SSL_KEY_PATH} -h {SSL_HOSTNAME}")
|
||||
else:
|
||||
print(f"WARNUNG: SSL-Zertifikat-Generator nicht gefunden: {script_path}")
|
||||
# Prüfen, ob die Zertifikate erfolgreich erstellt wurden
|
||||
if not os.path.exists(SSL_CERT_PATH) or not os.path.exists(SSL_KEY_PATH):
|
||||
print("Konnte keine SSL-Zertifikate erstellen.")
|
||||
return None
|
||||
|
||||
except Exception as e:
|
||||
print(f"Fehler beim Erstellen der SSL-Zertifikate: {e}")
|
||||
return None
|
||||
else:
|
||||
print("WARNUNG: SSL-Zertifikate nicht gefunden und Nicht-Debug-Modus. SSL wird deaktiviert.")
|
||||
return None
|
||||
|
Binary file not shown.
@@ -70,6 +70,27 @@ html.dark body .bg-white.dark\:bg-dark-card {
|
||||
background-color: #1e293b !important;
|
||||
}
|
||||
|
||||
/* Spezifischere Selektoren für das Admin-Panel im Dark Mode */
|
||||
body.dark .admin-container .bg-white.dark\:bg-dark-card {
|
||||
background-color: #1e293b !important;
|
||||
}
|
||||
|
||||
body.dark #users-tab .bg-white.dark\:bg-dark-card,
|
||||
body.dark #printers-tab .bg-white.dark\:bg-dark-card,
|
||||
body.dark #scheduler-tab .bg-white.dark\:bg-dark-card,
|
||||
body.dark #system-tab .bg-white.dark\:bg-dark-card,
|
||||
body.dark #logs-tab .bg-white.dark\:bg-dark-card {
|
||||
background-color: #1e293b !important;
|
||||
}
|
||||
|
||||
body.dark .admin-stats .stat-card {
|
||||
background-color: #1e293b !important;
|
||||
}
|
||||
|
||||
body.dark .bg-slate-50.dark\:bg-slate-800 {
|
||||
background-color: #0f172a !important;
|
||||
}
|
||||
|
||||
/* Admin Panel Container */
|
||||
.admin-container {
|
||||
max-width: 1280px;
|
||||
@@ -841,6 +862,38 @@ html.dark body .bg-white.dark\:bg-dark-card {
|
||||
}
|
||||
|
||||
/* Additional utilities */
|
||||
.transition-colors {
|
||||
transition-property: color, background-color, border-color;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 300ms;
|
||||
}
|
||||
|
||||
/* Tailwind Dark Mode Overrides */
|
||||
html.dark body [class*="dark\:bg-dark-card"] {
|
||||
background-color: #1e293b !important;
|
||||
}
|
||||
|
||||
html.dark body [class*="dark\:bg-slate-800"] {
|
||||
background-color: #0f172a !important;
|
||||
}
|
||||
|
||||
html.dark body [class*="dark\:bg-slate-700"] {
|
||||
background-color: #1e293b !important;
|
||||
}
|
||||
|
||||
html.dark body div[class*="dark\:hover\:bg"] {
|
||||
background-color: #1e293b !important;
|
||||
}
|
||||
|
||||
html.dark body tr[class*="dark\:hover\:bg"] {
|
||||
background-color: #1e293b !important;
|
||||
}
|
||||
|
||||
html.dark body tr[class*="dark\:hover\:bg"]:hover {
|
||||
background-color: #334155 !important;
|
||||
}
|
||||
|
||||
/* Ensure proper transition */
|
||||
.transition-colors {
|
||||
transition-property: color, background-color, border-color;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
|
@@ -401,38 +401,38 @@
|
||||
<div class="bg-white dark:bg-dark-card rounded-xl shadow-lg p-6 transition-colors">
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-white mb-6 transition-colors">Dienste Status</h3>
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between items-center p-3 bg-slate-50 dark:bg-slate-800 rounded-lg">
|
||||
<div class="flex justify-between items-center p-3 bg-slate-50 dark:bg-slate-800 rounded-lg transition-colors">
|
||||
<div class="flex items-center">
|
||||
<div class="status-indicator status-running"></div>
|
||||
<span class="ml-3 text-slate-900 dark:text-white">Webserver</span>
|
||||
<span class="ml-3 text-slate-900 dark:text-white transition-colors">Webserver</span>
|
||||
</div>
|
||||
<span class="text-green-600 dark:text-green-400 font-medium">Online</span>
|
||||
<span class="text-green-600 dark:text-green-400 font-medium transition-colors">Online</span>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between items-center p-3 bg-slate-50 dark:bg-slate-800 rounded-lg">
|
||||
<div class="flex justify-between items-center p-3 bg-slate-50 dark:bg-slate-800 rounded-lg transition-colors">
|
||||
<div class="flex items-center">
|
||||
<div class="status-indicator {{ 'status-running' if scheduler_status.running else 'status-stopped' }}"></div>
|
||||
<span class="ml-3 text-slate-900 dark:text-white">Scheduler</span>
|
||||
<span class="ml-3 text-slate-900 dark:text-white transition-colors">Scheduler</span>
|
||||
</div>
|
||||
<span class="{{ 'text-green-600 dark:text-green-400' if scheduler_status.running else 'text-red-600 dark:text-red-400' }} font-medium">
|
||||
<span class="{{ 'text-green-600 dark:text-green-400' if scheduler_status.running else 'text-red-600 dark:text-red-400' }} font-medium transition-colors">
|
||||
{{ 'Online' if scheduler_status.running else 'Offline' }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between items-center p-3 bg-slate-50 dark:bg-slate-800 rounded-lg">
|
||||
<div class="flex justify-between items-center p-3 bg-slate-50 dark:bg-slate-800 rounded-lg transition-colors">
|
||||
<div class="flex items-center">
|
||||
<div class="status-indicator status-running"></div>
|
||||
<span class="ml-3 text-slate-900 dark:text-white">Datenbank</span>
|
||||
<span class="ml-3 text-slate-900 dark:text-white transition-colors">Datenbank</span>
|
||||
</div>
|
||||
<span class="text-green-600 dark:text-green-400 font-medium">Online</span>
|
||||
<span class="text-green-600 dark:text-green-400 font-medium transition-colors">Online</span>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between items-center p-3 bg-slate-50 dark:bg-slate-800 rounded-lg">
|
||||
<div class="flex justify-between items-center p-3 bg-slate-50 dark:bg-slate-800 rounded-lg transition-colors">
|
||||
<div class="flex items-center">
|
||||
<div class="status-indicator status-running"></div>
|
||||
<span class="ml-3 text-slate-900 dark:text-white">Drucker-Manager</span>
|
||||
<span class="ml-3 text-slate-900 dark:text-white transition-colors">Drucker-Manager</span>
|
||||
</div>
|
||||
<span class="text-green-600 dark:text-green-400 font-medium">Online</span>
|
||||
<span class="text-green-600 dark:text-green-400 font-medium transition-colors">Online</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -454,9 +454,9 @@
|
||||
<!-- Logs Tab -->
|
||||
{% if active_tab == 'logs' %}
|
||||
<div id="logs-tab" class="tab-pane active">
|
||||
<div class="bg-white dark:bg-dark-card rounded-xl shadow-lg p-6">
|
||||
<div class="bg-white dark:bg-dark-card rounded-xl shadow-lg p-6 transition-colors">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-white">System Logs</h3>
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-white transition-colors">System Logs</h3>
|
||||
<div class="flex space-x-4">
|
||||
<form action="{{ url_for('admin_page', tab='logs') }}" method="get">
|
||||
<div class="flex space-x-2">
|
||||
@@ -477,7 +477,7 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-slate-50 dark:bg-slate-800 rounded-lg p-4 max-h-[600px] overflow-y-auto">
|
||||
<div class="bg-slate-50 dark:bg-slate-800 rounded-lg p-4 max-h-[600px] overflow-y-auto transition-colors">
|
||||
{% if logs %}
|
||||
{% for log in logs %}
|
||||
<div class="log-entry log-{{ log.level|lower }}">
|
||||
|
Reference in New Issue
Block a user