automated whitelist

This commit is contained in:
Andreas Knuth 2026-01-30 16:52:26 -06:00
parent fd3c9bedda
commit 2026e6afcd
2 changed files with 29 additions and 4 deletions

View File

@ -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
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

22
DMS/update-whitelist.sh Normal file
View File

@ -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