forward/reply solution for internal mails
This commit is contained in:
3
DMS/docker-data/dms/config/postfix/main.cf.append
Normal file
3
DMS/docker-data/dms/config/postfix/main.cf.append
Normal file
@@ -0,0 +1,3 @@
|
||||
# Content Filter Configuration
|
||||
# Routes all local deliveries through content filter on port 10025
|
||||
content_filter = smtp:[localhost]:10025
|
||||
34
DMS/docker-data/dms/config/postfix/master.cf.append
Normal file
34
DMS/docker-data/dms/config/postfix/master.cf.append
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Content Filter Setup
|
||||
# Two additional SMTP services for content filtering
|
||||
#
|
||||
|
||||
# Port 10025: Content filter input
|
||||
# Receives mail from main Postfix, passes to content_filter.py
|
||||
localhost:10025 inet n - n - - smtpd
|
||||
-o content_filter=
|
||||
-o local_recipient_maps=
|
||||
-o relay_recipient_maps=
|
||||
-o smtpd_restriction_classes=
|
||||
-o smtpd_client_restrictions=
|
||||
-o smtpd_helo_restrictions=
|
||||
-o smtpd_sender_restrictions=
|
||||
-o smtpd_recipient_restrictions=permit_mynetworks,reject
|
||||
-o mynetworks=127.0.0.0/8
|
||||
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
|
||||
-o receive_override_options=no_unknown_recipient_checks
|
||||
|
||||
# Port 10026: Content filter output (re-injection)
|
||||
# Receives processed mail from content_filter.py for final delivery
|
||||
localhost:10026 inet n - n - - smtpd
|
||||
-o content_filter=
|
||||
-o local_recipient_maps=
|
||||
-o relay_recipient_maps=
|
||||
-o smtpd_restriction_classes=
|
||||
-o smtpd_client_restrictions=
|
||||
-o smtpd_helo_restrictions=
|
||||
-o smtpd_sender_restrictions=
|
||||
-o smtpd_recipient_restrictions=permit_mynetworks,reject
|
||||
-o mynetworks=127.0.0.0/8
|
||||
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
|
||||
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
|
||||
@@ -5,20 +5,38 @@ CFG_ROOT="/tmp/docker-mailserver"
|
||||
SRC_DIR="$CFG_ROOT/postfix"
|
||||
DST_DIR="/etc/postfix"
|
||||
|
||||
# Dateien nach /etc/postfix kopieren (oder aktualisieren)
|
||||
# install -D -m 0644 "$SRC_DIR/transport" "$DST_DIR/transport"
|
||||
# install -D -m 0600 "$SRC_DIR/sasl_passwd" "$DST_DIR/sasl_passwd"
|
||||
install -D -m 0644 "$SRC_DIR/header_checks" "$DST_DIR/header_checks"
|
||||
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"
|
||||
|
||||
# Maps bauen
|
||||
# postmap "$DST_DIR/transport"
|
||||
# postmap "$DST_DIR/sasl_passwd"
|
||||
# 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
|
||||
|
||||
# Rechte auf die .db-Helferdatei
|
||||
# chmod 600 "$DST_DIR/sasl_passwd.db" || true
|
||||
# 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
|
||||
|
||||
# rm -f /etc/dovecot/conf.d/95-sieve-redirect.conf
|
||||
# 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
|
||||
Reference in New Issue
Block a user