[postfix-es] altermime duplica correo
mlorente
mlorente en renr.es
Mar Nov 5 11:45:19 CET 2013
Buenos días, tengo un postfix mail_version = 2.6.6 sobre CentOS release
6.4 (Final) al que le aplicado altermime para firmar correos. El proceso
funciona bien, salvo por el hecho de que se genera un correo adicional
vacío cuando pasa por el script del disclaimer. Este correo rebota como
no entregado al no existir el destinatario y se intenta mandar al
usuario ???
La configuración del master.cf
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd
-o content_filter=dfilt:
#submission inet n - n - - smtpd
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
smtps inet n - n - - smtpd
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o content_filter=dfilt:
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - n - - smtp
-o smtp_fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
# ====================================================================
#
# Other external delivery methods.
#
dfilt unix - n n - - pipe
flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} —
${recipient}
el script de disclaimer es:
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail
# Define our company address lists
disclaimer_dominio_1=/etc/postfix/disclaimer_1
disclaimer_dominio_2=/etc/postfix/disclaimer_2
disclaimer_dominio_D/EFAULT=/etc/postfix/disclaimer_DEFAULT
# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69
# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15
# Start processing.
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit
$EX_TEMPFAIL; }
cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }
# Obtain From address domain
from_address=`grep -m 1 "From:" in.$$ | cut -d "@" -f 2 | cut -d ">" -f 1`
# If the from address matches companya then apply the appropiate disclaimed
if [ `grep -wi ^${from_address}$ ${disclaimer_dominio_1}` ]; then
/usr/bin/altermime --debug --log-syslog --input=in.$$
--disclaimer=/etc/postfix/disclaimer_1.txt
--disclaimer-html=/etc/postfix/disclaimer_1.html --force-for-bad-html||
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
fi
if [ `grep -wi ^${from_address}$ ${disclaimer_dominio_2}` ]; then
/usr/bin/altermime --debug --log-syslog --input=in.$$
--disclaimer=/etc/postfix/disclaimer_2.txt
--disclaimer-html=/etc/postfix/disclaimer_2.html --force-for-bad-html||
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
fi
# Send the email on as per the Postfix stack
$SENDMAIL "$@" <in.$$
exit $?
La salida del log:
Nov 5 10:34:41 mtadesarrollo postfix/smtpd[9621]: connect from
mlorente.dominio1.com[10.162.133.89]
Nov 5 10:34:41 mtadesarrollo postfix/smtpd[9621]: setting up TLS
connection from mlorente.dominio1.com[10.162.133.89]
Nov 5 10:34:41 mtadesarrollo postfix/smtpd[9621]: Anonymous TLS
connection established from mlorente.dominio1.com[10.162.133.89]: TLSv1
with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)
Nov 5 10:34:41 mtadesarrollo cbpolicyd[1311]: module=Quotas,
mode=update, host=10.162.133.89, helo=[10.162.133.89],
from=mlorente en dominio2.com, to=mlorente en dominio1.com,
reason=quota_update, policy=2, quota=2, limit=32,
track=Sender:mlorente en dominio2.com, counter=MessageCount, quota=2.33/100
(2.3%)
Nov 5 10:34:41 mtadesarrollo postfix/smtpd[9621]: 6AEFEA02BE:
client=mlorente.dominio1.com[10.162.133.89], sasl_method=PLAIN,
sasl_username=mlorente
Nov 5 10:34:41 mtadesarrollo postfix/cleanup[9625]: 6AEFEA02BE:
message-id=<5278BBB1.8010606 en dominio2.com>
Nov 5 10:34:41 mtadesarrollo postfix/cleanup[9625]: 6AEFEA02BE: warning:
header Subject: hola from mlorente.dominio1.com[10.162.133.89];
from=<mlorente en dominio2.com> to=<mlorente en dominio1.com> proto=ESMTP
helo=<[10.162.133.89]>
Nov 5 10:34:41 mtadesarrollo postfix/qmgr[8092]: 6AEFEA02BE:
from=<mlorente en dominio2.com>, size=592, nrcpt=1 (queue active)
Nov 5 10:34:41 mtadesarrollo postfix/smtpd[9621]: disconnect from
mlorente.dominio1.com[10.162.133.89]
Nov 5 10:34:41 mtadesarrollo postfix/pickup[8091]: 8EDADA02FA: uid=495
from=<mlorente en dominio2.com>
Nov 5 10:34:41 mtadesarrollo postfix/cleanup[9625]: 8EDADA02FA:
message-id=<5278BBB1.8010606 en dominio2.com>
Nov 5 10:34:41 mtadesarrollo postfix/cleanup[9625]: 8EDADA02FA: warning:
header Subject: hola from local; from=<mlorente en dominio2.com>
to=<mlorente en dominio1.com>
Nov 5 10:34:41 mtadesarrollo postfix/pipe[9626]: 6AEFEA02BE:
to=<mlorente en dominio1.com>, relay=dfilt, delay=0.33,
delays=0.24/0.01/0/0.08, dsn=2.0.0, status=sent (delivered via dfilt
service)
Nov 5 10:34:41 mtadesarrollo postfix/qmgr[8092]: 6AEFEA02BE: removed
Nov 5 10:34:41 mtadesarrollo postfix/qmgr[8092]: 8EDADA02FA:
from=<mlorente en dominio2.com>, size=729, nrcpt=2 (queue active)
Nov 5 10:34:42 mtadesarrollo postfix/smtp[9639]: 8EDADA02FA:
to=<???@dominio1.com>, orig_to=<???>, relay=10.1.17.203[10.1.17.203]:25,
delay=0.49, delays=0.05/0.01/0.04/0.39, dsn=5.1.1, status=bounced (host
10.1.17.203[10.1.17.203] said: 550 5.1.1 < @dominio1.com>: Recipient
address rejected: User unknown in virtual mailbox table (in reply to
RCPT TO command))
Nov 5 10:34:42 mtadesarrollo postfix/smtp[9639]: 8EDADA02FA:
to=<mlorente en dominio1.com>, relay=10.1.17.203[10.1.17.203]:25,
delay=0.51, delays=0.05/0.01/0.04/0.41, dsn=2.0.0, status=sent (250
2.0.0 Ok: queued as C1A2B9F704)
Nov 5 10:34:42 mtadesarrollo postfix/cleanup[9625]: 0E86FA02C0:
message-id=<20131105093442.0E86FA02C0 en smtp.dominio2.com>
Nov 5 10:34:42 mtadesarrollo postfix/qmgr[8092]: 0E86FA02C0: from=<>,
size=2668, nrcpt=1 (queue active)
Nov 5 10:34:42 mtadesarrollo postfix/bounce[9640]: 8EDADA02FA: sender
non-delivery notification: 0E86FA02C0
Nov 5 10:34:42 mtadesarrollo postfix/qmgr[8092]: 8EDADA02FA: removed
Nov 5 10:34:42 mtadesarrollo postfix/smtp[9639]: 0E86FA02C0:
to=<mlorente en dominio2.com>, relay=10.1.17.203[10.1.17.203]:25,
delay=0.17, delays=0.01/0/0.04/0.12, dsn=2.0.0, status=sent (250 2.0.0
Ok: queued as 1F3AA9F70C)
Nov 5 10:34:42 mtadesarrollo postfix/qmgr[8092]: 0E86FA02C0: removed
Desactivo el altermime y funciona con normalidad. ¿De donde puede estar
sacando la segunda dirección de envío?
Gracias.
Más información sobre la lista de distribución postfix-es