Till Tomczak 0d5b87f163 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.
2025-05-25 20:59:13 +02:00

99 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# MYP SSL-Zertifikat-Prüfskript
# Prüft den Status der SSL-Zertifikate und gibt Informationen aus
# Fehlerabbruch aktivieren
set -e
# Farben für bessere Lesbarkeit
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Standardwerte
CERT_PATH="/opt/myp/ssl/myp.crt"
KEY_PATH="/opt/myp/ssl/myp.key"
# Argumente verarbeiten
while [[ $# -gt 0 ]]; do
case $1 in
-c|--cert)
CERT_PATH="$2"
shift 2
;;
-k|--key)
KEY_PATH="$2"
shift 2
;;
*)
echo -e "${RED}Unbekannte Option: $1${NC}"
exit 1
;;
esac
done
# Header anzeigen
echo -e "${BLUE}================================================================${NC}"
echo -e "${BLUE} MYP V2 - SSL-Zertifikat-Statusprüfung ${NC}"
echo -e "${BLUE}================================================================${NC}"
echo ""
# Prüfen, ob OpenSSL installiert ist
if ! command -v openssl &> /dev/null; then
echo -e "${RED}OpenSSL ist nicht installiert!${NC}"
exit 1
fi
# Prüfen, ob Zertifikat existiert
if [ ! -f "$CERT_PATH" ]; then
echo -e "${RED}Zertifikat nicht gefunden: $CERT_PATH${NC}"
echo -e "${YELLOW}Führen Sie 'create_ssl_cert.sh' aus, um ein neues Zertifikat zu erstellen.${NC}"
exit 1
fi
# Prüfen, ob Schlüssel existiert
if [ ! -f "$KEY_PATH" ]; then
echo -e "${RED}Schlüssel nicht gefunden: $KEY_PATH${NC}"
echo -e "${YELLOW}Führen Sie 'create_ssl_cert.sh' aus, um einen neuen Schlüssel zu erstellen.${NC}"
exit 1
fi
# Zertifikatsinformationen anzeigen
echo -e "${GREEN}Zertifikatsinformationen:${NC}"
echo -e "${BLUE}Zertifikatsdatei: ${NC}$CERT_PATH"
echo -e "${BLUE}Schlüsseldatei: ${NC}$KEY_PATH"
echo ""
# Zertifikatsdetails anzeigen
echo -e "${YELLOW}Zertifikatsdetails:${NC}"
openssl x509 -in "$CERT_PATH" -noout -subject -issuer -dates -fingerprint -sha256
# Gültigkeit prüfen
echo ""
echo -e "${YELLOW}Gültigkeitsprüfung:${NC}"
not_after=$(openssl x509 -in "$CERT_PATH" -noout -enddate | cut -d= -f2)
not_after_seconds=$(date -d "$not_after" +%s)
now_seconds=$(date +%s)
days_left=$(( (not_after_seconds - now_seconds) / 86400 ))
if [ $days_left -le 0 ]; then
echo -e "${RED}Zertifikat ist ABGELAUFEN!${NC}"
elif [ $days_left -le 30 ]; then
echo -e "${YELLOW}Zertifikat läuft in $days_left Tagen ab!${NC}"
else
echo -e "${GREEN}Zertifikat ist noch $days_left Tage gültig.${NC}"
fi
# Zertifikatsinhalte prüfen
echo ""
echo -e "${YELLOW}Zertifikatsinhalte:${NC}"
echo -e "${BLUE}Alternative Namen (SAN):${NC}"
openssl x509 -in "$CERT_PATH" -noout -text | grep -A1 "Subject Alternative Name"
# Abschluss
echo ""
echo -e "${GREEN}SSL-Prüfung abgeschlossen.${NC}"
echo -e "${BLUE}Um die Zertifikate zu erneuern, führen Sie 'create_ssl_cert.sh' aus.${NC}"
echo ""