feat: Implement SSL support and kiosk mode enhancements
- Added SSL configuration to the backend, including self-signed certificate generation and management. - Updated `setup_myp.sh` to create SSL certificates during installation. - Enhanced `app.py` to support SSL context for secure communication. - Introduced a new SSL management menu in the setup script for easier certificate handling. - Updated frontend API calls to use HTTPS for secure data transmission. - Implemented kiosk mode features, including automatic browser launch with SSL support. - Improved documentation in `SUMMARY.md` to reflect new features and network topology changes.
This commit is contained in:
@@ -61,6 +61,7 @@ show_main_menu() {
|
||||
echo "7) MYP-Dienst starten/stoppen/neustarten"
|
||||
echo "8) Logs anzeigen"
|
||||
echo "9) Dokumentation anzeigen"
|
||||
echo "10) SSL-Zertifikat-Management"
|
||||
echo ""
|
||||
echo "q) Beenden"
|
||||
echo ""
|
||||
@@ -98,6 +99,9 @@ process_main_menu() {
|
||||
9)
|
||||
show_documentation
|
||||
;;
|
||||
10)
|
||||
show_ssl_management
|
||||
;;
|
||||
q|Q)
|
||||
echo -e "${GREEN}Auf Wiedersehen!${NC}"
|
||||
exit 0
|
||||
@@ -131,7 +135,7 @@ standard_installation() {
|
||||
echo "Installiere System-Abhängigkeiten..."
|
||||
apt update
|
||||
apt install -y python3.11 python3.11-pip python3.11-venv python3.11-dev \
|
||||
build-essential git curl
|
||||
build-essential git curl openssl
|
||||
|
||||
# Verzeichnis für MYP erstellen/aktualisieren
|
||||
mkdir -p /opt/myp
|
||||
@@ -156,6 +160,9 @@ standard_installation() {
|
||||
# Datenbank-Verzeichnis erstellen
|
||||
mkdir -p /opt/myp/data
|
||||
|
||||
# SSL-Verzeichnis erstellen
|
||||
mkdir -p /opt/myp/ssl
|
||||
|
||||
# Python-Umgebung und Abhängigkeiten einrichten
|
||||
echo "Richte Python-Umgebung ein..."
|
||||
cd /opt/myp
|
||||
@@ -166,12 +173,18 @@ standard_installation() {
|
||||
pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
# SSL-Zertifikate erstellen
|
||||
echo "Erstelle SSL-Zertifikate..."
|
||||
chmod +x /opt/myp/install/create_ssl_cert.sh
|
||||
/opt/myp/install/create_ssl_cert.sh -d /opt/myp/ssl
|
||||
|
||||
# Berechtigungen setzen
|
||||
echo "Setze Berechtigungen..."
|
||||
chown -R www-data:www-data /opt/myp
|
||||
chmod -R 755 /opt/myp
|
||||
chmod -R 775 /opt/myp/logs
|
||||
chmod -R 775 /opt/myp/data
|
||||
chmod 600 /opt/myp/ssl/myp.key
|
||||
|
||||
echo -e "${GREEN}Installation abgeschlossen.${NC}"
|
||||
echo ""
|
||||
@@ -181,6 +194,7 @@ standard_installation() {
|
||||
echo " cd /opt/myp && source .venv/bin/activate && python3.11 app/app.py"
|
||||
echo ""
|
||||
echo -e "${BLUE}Oder verwenden Sie Option 7 für Dienst-Management${NC}"
|
||||
echo -e "${GREEN}MYP V2 ist unter https://$(hostname -I | awk '{print $1}'):5000 erreichbar${NC}"
|
||||
|
||||
read -p "Drücken Sie eine Taste, um zum Hauptmenü zurückzukehren..."
|
||||
show_main_menu
|
||||
@@ -1267,40 +1281,61 @@ system_status() {
|
||||
echo -e "${GREEN}System-Status${NC}"
|
||||
echo ""
|
||||
|
||||
# MYP-Status
|
||||
# Systeminfos anzeigen
|
||||
echo -e "${YELLOW}Systeminformationen:${NC}"
|
||||
echo -e "Hostname: $(hostname)"
|
||||
echo -e "IP-Adresse: $(hostname -I | awk '{print $1}')"
|
||||
echo -e "Betriebssystem: $(lsb_release -ds 2>/dev/null || cat /etc/*release 2>/dev/null | head -n1 || uname -om)"
|
||||
echo -e "Kernel: $(uname -r)"
|
||||
echo -e "CPU: $(grep -c ^processor /proc/cpuinfo) Kerne"
|
||||
echo -e "RAM: $(free -h | awk '/^Mem/ {print $2}')"
|
||||
echo -e "Festplatte: $(df -h / | awk 'NR==2 {print $2}')"
|
||||
echo ""
|
||||
|
||||
# MYP-Status anzeigen
|
||||
echo -e "${YELLOW}MYP-Status:${NC}"
|
||||
if is_myp_installed; then
|
||||
echo "MYP ist installiert in /opt/myp"
|
||||
if systemctl is-active --quiet myp.service; then
|
||||
echo -e "MYP-Dienst: ${GREEN}Aktiv${NC}"
|
||||
echo -e "MYP ist installiert: ${GREEN}Ja${NC}"
|
||||
|
||||
# Prüfen, ob der MYP-Service läuft
|
||||
if systemctl is-active --quiet myp.service 2>/dev/null; then
|
||||
echo -e "MYP-Service: ${GREEN}Aktiv${NC}"
|
||||
else
|
||||
echo -e "MYP-Dienst: ${RED}Inaktiv${NC}"
|
||||
echo -e "MYP-Service: ${RED}Inaktiv${NC}"
|
||||
fi
|
||||
|
||||
# Pfadangaben
|
||||
echo -e "Installationspfad: /opt/myp"
|
||||
echo -e "Datenbank: /opt/myp/data"
|
||||
echo -e "Logs: /opt/myp/logs"
|
||||
echo -e "SSL-Zertifikate: /opt/myp/ssl"
|
||||
|
||||
# SSL-Status überprüfen
|
||||
if [ -f "/opt/myp/ssl/myp.crt" ] && [ -f "/opt/myp/ssl/myp.key" ]; then
|
||||
echo -e "SSL-Zertifikate: ${GREEN}Vorhanden${NC}"
|
||||
|
||||
# Zertifikatsinformationen anzeigen
|
||||
if command -v openssl &> /dev/null; then
|
||||
cert_expiry=$(openssl x509 -enddate -noout -in /opt/myp/ssl/myp.crt | cut -d= -f 2)
|
||||
cert_subject=$(openssl x509 -subject -noout -in /opt/myp/ssl/myp.crt | sed 's/^subject=//')
|
||||
echo -e "Zertifikat für: ${BLUE}$cert_subject${NC}"
|
||||
echo -e "Gültig bis: ${BLUE}$cert_expiry${NC}"
|
||||
fi
|
||||
else
|
||||
echo -e "SSL-Zertifikate: ${RED}Fehlen${NC}"
|
||||
fi
|
||||
|
||||
# MYP-URLs anzeigen
|
||||
echo -e ""
|
||||
echo -e "${YELLOW}MYP-Zugriff:${NC}"
|
||||
ip_address=$(hostname -I | awk '{print $1}')
|
||||
echo -e "${GREEN}https://$ip_address:5000${NC} (verschlüsselt)"
|
||||
echo -e "${YELLOW}http://$ip_address:5000${NC} (unverschlüsselt)"
|
||||
else
|
||||
echo -e "MYP ist ${RED}nicht installiert${NC}"
|
||||
echo -e "MYP ist installiert: ${RED}Nein${NC}"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Netzwerkstatus
|
||||
echo -e "${YELLOW}Netzwerkstatus:${NC}"
|
||||
ip -o addr show | awk '$3 == "inet" {print $2 ": " $4}'
|
||||
echo ""
|
||||
|
||||
# DNS-Server
|
||||
echo -e "${YELLOW}DNS-Server:${NC}"
|
||||
grep "nameserver" /etc/resolv.conf 2>/dev/null || echo "Keine DNS-Server konfiguriert."
|
||||
echo ""
|
||||
|
||||
# Systemressourcen
|
||||
echo -e "${YELLOW}Systemressourcen:${NC}"
|
||||
echo "CPU-Auslastung:"
|
||||
top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4 "% genutzt"}'
|
||||
echo "Speichernutzung:"
|
||||
free -h | grep "Mem:" | awk '{print $3 " von " $2 " genutzt"}'
|
||||
echo "Festplattenbelegung:"
|
||||
df -h / | grep -v "Filesystem" | awk '{print $3 " von " $2 " genutzt (" $5 ")"}'
|
||||
echo ""
|
||||
|
||||
read -p "Drücken Sie eine Taste, um zum Hauptmenü zurückzukehren..."
|
||||
show_main_menu
|
||||
}
|
||||
@@ -1491,6 +1526,57 @@ show_documentation() {
|
||||
show_main_menu
|
||||
}
|
||||
|
||||
# 10) SSL-Zertifikat-Management
|
||||
show_ssl_management() {
|
||||
print_header
|
||||
echo -e "${GREEN}SSL-Zertifikat-Management${NC}"
|
||||
echo ""
|
||||
|
||||
echo -e "Bitte wählen Sie eine Option:"
|
||||
echo ""
|
||||
echo "1) SSL-Zertifikatsstatus anzeigen"
|
||||
echo "2) Neue SSL-Zertifikate erstellen"
|
||||
echo "3) SSL-Einstellungen in settings.py anzeigen/bearbeiten"
|
||||
echo ""
|
||||
echo "b) Zurück zum Hauptmenü"
|
||||
echo ""
|
||||
read -p "Ihre Auswahl: " ssl_option
|
||||
|
||||
case $ssl_option in
|
||||
1)
|
||||
# SSL-Status anzeigen
|
||||
chmod +x /opt/myp/install/ssl_check.sh
|
||||
/opt/myp/install/ssl_check.sh
|
||||
;;
|
||||
2)
|
||||
# Neue Zertifikate erstellen
|
||||
echo -e "${YELLOW}Erstelle neue SSL-Zertifikate...${NC}"
|
||||
chmod +x /opt/myp/install/create_ssl_cert.sh
|
||||
/opt/myp/install/create_ssl_cert.sh -d /opt/myp/ssl
|
||||
;;
|
||||
3)
|
||||
# SSL-Einstellungen anzeigen/bearbeiten
|
||||
if command -v nano &> /dev/null; then
|
||||
nano /opt/myp/app/config/settings.py
|
||||
else
|
||||
vi /opt/myp/app/config/settings.py
|
||||
fi
|
||||
;;
|
||||
b|B)
|
||||
show_main_menu
|
||||
return
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}Ungültige Option.${NC}"
|
||||
sleep 2
|
||||
show_ssl_management
|
||||
;;
|
||||
esac
|
||||
|
||||
read -p "Drücken Sie eine Taste, um zum SSL-Menü zurückzukehren..."
|
||||
show_ssl_management
|
||||
}
|
||||
|
||||
# Hauptprogramm
|
||||
check_root
|
||||
show_main_menu
|
Reference in New Issue
Block a user