#!/bin/bash # --- FÜHRT DIE BEFEHLE VOR DER ACME-ERSTELLUNG AUS (Proxy OFF) --- stop_challenge() { echo "Stopping normal proxy operation and preparing for ACME challenge (Proxy OFF)..." a2disconf 10-remoteip-proxyproto.conf a2enconf 10-remoteip-proxyproto-off.conf systemctl reload apache2 echo "Preparation complete." } # --- FÜHRT DIE BEFEHLE NACH DER ACME-ERSTELLUNG AUS (Proxy ON) --- start_normal() { echo "Starting normal proxy operation after ACME challenge (Proxy ON)..." a2disconf 10-remoteip-proxyproto-off.conf a2enconf 10-remoteip-proxyproto.conf systemctl reload apache2 echo "Normal operation restored." } case "$1" in stop) # Führt die Befehle VOR der Zertifikatserstellung aus stop_challenge ;; start) # Führt die Befehle NACH der Zertifikatserstellung aus start_normal ;; *) # Fallback: Führt das komplette Skript wie ursprünglich aus echo "Usage: $0 {stop|start|full}" echo "Defaulting to full run for compatibility." stop_challenge echo "" echo "--- Executing ACME Certificate Renewal ---" /usr/bin/certbot renew --no-self-upgrade /root/.acme.sh/acme.sh --cron --force --home /root/.acme.sh start_normal ;; esac