email-amazon/DMS/docker-data/dms/config/user-patches.sh

42 lines
1.5 KiB
Bash

#!/bin/bash
set -euo pipefail
CFG_ROOT="/tmp/docker-mailserver"
SRC_DIR="$CFG_ROOT/postfix"
DST_DIR="/etc/postfix"
echo "[user-patches.sh] Starting Postfix customizations..."
# Existing patches (header_checks, etc.)
install -D -m 0644 "$SRC_DIR/header_checks" "$DST_DIR/header_checks"
install -D -m 0644 "$SRC_DIR/smtp_header_checks" "$DST_DIR/maps/sender_header_filter.pcre"
# NEW: Append content filter configuration to main.cf
if [ -f "$SRC_DIR/main.cf.append" ]; then
echo "[user-patches.sh] Appending content filter config to main.cf..."
cat "$SRC_DIR/main.cf.append" >> "$DST_DIR/main.cf"
echo "[user-patches.sh] ✓ main.cf updated"
else
echo "[user-patches.sh] ⚠ main.cf.append not found, skipping"
fi
# NEW: Append content filter services to master.cf
if [ -f "$SRC_DIR/master.cf.append" ]; then
echo "[user-patches.sh] Appending content filter services to master.cf..."
cat "$SRC_DIR/master.cf.append" >> "$DST_DIR/master.cf"
echo "[user-patches.sh] ✓ master.cf updated"
else
echo "[user-patches.sh] ⚠ master.cf.append not found, skipping"
fi
# Verify content filter script exists and is executable
if [ -x "/usr/local/bin/content_filter.py" ]; then
echo "[user-patches.sh] ✓ Content filter script found"
else
echo "[user-patches.sh] ⚠ WARNING: content_filter.py not found or not executable!"
fi
echo "[user-patches.sh] Postfix customizations complete"
# Postfix neu laden (nachdem docker-mailserver seine eigene Konfig geladen hat)
postfix reload || true