diff --git a/DMS/Dockerfile b/DMS/Dockerfile index 8b722ec..5ef59f2 100644 --- a/DMS/Dockerfile +++ b/DMS/Dockerfile @@ -4,7 +4,6 @@ LABEL maintainer="andreas.knuth@bayarea-cc.com" LABEL description="Custom DMS with Python3 support and Sieve Sync" # 1. Python, pip und dependencies installieren -# croniter hinzufügen! RUN apt-get update && \ apt-get install -y --no-install-recommends \ python3 \ @@ -20,9 +19,13 @@ WORKDIR /scripts COPY sync_dynamodb_to_sieve.py /scripts/sync.py RUN chmod +x /scripts/sync.py -# 4. Schedule Konfiguration kopieren (Der Cron-String) +# 4. Schedule Konfiguration kopieren COPY sieve-schedule /etc/sieve-schedule # 5. Supervisor Konfiguration kopieren -# DMS scannt diesen Ordner beim Start -COPY sieve-supervisor.conf /etc/supervisor/conf.d/sieve-sync.conf \ No newline at end of file +COPY sieve-supervisor.conf /etc/supervisor/conf.d/sieve-sync.conf + +# --- NEU: Startup-Skript für Whitelist --- +# DMS führt Skripte in /docker-entrypoint-init.d/ beim Start automatisch aus +COPY update-whitelist.sh /docker-entrypoint-init.d/update-whitelist.sh +RUN chmod +x /docker-entrypoint-init.d/update-whitelist.sh \ No newline at end of file diff --git a/DMS/update-whitelist.sh b/DMS/update-whitelist.sh new file mode 100644 index 0000000..b3b8197 --- /dev/null +++ b/DMS/update-whitelist.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Pfade im Container +ACCOUNTS_FILE="/tmp/docker-mailserver/postfix-accounts.cf" +WHITELIST_FILE="/etc/rspamd/override.d/docker_whitelist.map" + +echo "Startup-Script: Generiere Rspamd Whitelist aus Accounts..." + +if [ -f "$ACCOUNTS_FILE" ]; then + # 1. Alles vor dem Pipe (|) nehmen -> user@domain.com + # 2. Alles nach dem @ nehmen -> domain.com + # 3. Sortieren und Duplikate entfernen + # 4. In die Whitelist schreiben + awk -F'|' '{print $1}' "$ACCOUNTS_FILE" | cut -d'@' -f2 | sort | uniq > "$WHITELIST_FILE" + + # Berechtigung setzen (zur Sicherheit) + chmod 644 "$WHITELIST_FILE" + + echo "Whitelist aktualisiert. Gefundene Domains:" + cat "$WHITELIST_FILE" +else + echo "WARNUNG: $ACCOUNTS_FILE nicht gefunden!" +fi \ No newline at end of file