Implementando Disclaimers en Zimbra 5 (CentOS o RedHat)
Recientemente se me presento la necesidad de implementar en un cliente disclaimers (Cuestiones legales) en una versión de Zimbra 5, esta versión no dispone de ninguna opción que haga esta tarea de manera simple.
Por lo que empece a investigar un poco en la red y consegui este par de articulos:
http://wiki.zimbra.com/wiki/Adding_a_disclaimer_(altermime)_or_footer
http://wiki.zimbra.com/index.php?title=Domain_Disclaimer_Extension_Admin_UI
Según esto el primer paso es instalar alterMIME el cual es un pequeño programa el cual es usado para alterar la codificacion mime, entre lo que podemos hacer con este software podemos encontrar lo siguiente:
* Insertar disclaimers
* Insertar X-headers arbitrarios
* Modificar cabeceras existentes.
* Eliminar attachments basado en el tipo de contenido
* Eliminar attachments basado en el nombre del fichero
Pero antes de instalar cualquier lo primero es un backup completo de toda la solución (Para mi es algo mandatorio, pero algunos pueden pensar de otra manera).
Procedemos a descargar los últimos fuentes de altermime de la siguiente web http://www.pldaniels.com/altermime/#download
Compilamos
tar zxvf altermime-x.y.zz.tar.gz
cd altermime-x.y.zz
make
Instalamos
cp altermime /usr/bin/
chown root:root /usr/bin/altermime
chmod 755 /usr/bin/altermime
Creamos un directorio para spool de correos
mkdir /var/spool/filter
cd /var/spool/filter/
chown 750 zimbra
Modificamos el master.cf /opt/zimbra/postfix/conf/master.cf
smtp inet n – n – – smtpd
-o content_filter=dfilt:
dfilt unix - n n – – pipe
flags=Rq user=filter argv=/opt/zimbra/postfix/conf/disclaimer -f ${sender} — ${recipient}
Nota: No cometer el error de comentar o eliminar la otra definición de smtp
Crear un fichero de disclaimer para html y otro txt
/opt/zimbra/postfix/conf/disclaimer.txt
____________________________________________________
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
Company X, Suite# 1, Street, City, Country, www.company.com
/opt/zimbra/postfix/conf/disclaimer.html
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
Company X, Suite# 1, Street, City, Country, www.company.com
Crear un script para los disclaimer /opt/zimbra/postfix/conf/disclaimer, tomen en consideración que el filtro envía toda la cola de correo al filtro, mas sin embargo se requiere un script que elija que correos modificar.
Un ejemplo de script podemos verlo a continuación:
#!/bin/sh
INSPECT_DIR=/var/spool/filter
SENDMAIL=/opt/zimbra/postfix/sbin/sendmail
FOLDER_DISCLAIMER=/opt/zimbra/postfix/conf
# Exit codes from
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; }
TEXT_DISCLAIMER=`grep “[a|A-z|Z]” ${FOLDER_DISCLAIMER}/disclaimer.txt | grep -v “_” | tail -2 | head -1`
cat > in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }
nohup grep “${TEXT_DISCLAIMER}” in.$$ > /dev/null 2>&1
if [ ! "$?" = 0 ]; then
/usr/bin/altermime –input=in.$$ –disclaimer=${FOLDER_DISCLAIMER}/disclaimer.txt –disclaimer-html=${FOLDER_DISCLAIMER}/disclaimer.html \
–xheader=”X-Copyrighted-Material: Please visit www.company.com/privacy.htm” || { echo Message content rejected; exit $EX_UNAVAILABLE; }
fi
$SENDMAIL -i “$@” < in.$$
exit $?
Cambiamos los permisos de filtro
chgrp zimbra /opt/zimbra/postfix/conf/disclaimer
chmod 750 /opt/zimbra/postfix/conf/disclaimer
Reiniciamos el MTA dentro de Zimbra
su – zimbra
zmmtactl stop
zmmtactl start
Por lo que empece a investigar un poco en la red y consegui este par de articulos:
http://wiki.zimbra.com/wiki/Adding_a_disclaimer_(altermime)_or_footer
http://wiki.zimbra.com/index.php?title=Domain_Disclaimer_Extension_Admin_UI
Según esto el primer paso es instalar alterMIME el cual es un pequeño programa el cual es usado para alterar la codificacion mime, entre lo que podemos hacer con este software podemos encontrar lo siguiente:
* Insertar disclaimers
* Insertar X-headers arbitrarios
* Modificar cabeceras existentes.
* Eliminar attachments basado en el tipo de contenido
* Eliminar attachments basado en el nombre del fichero
Pero antes de instalar cualquier lo primero es un backup completo de toda la solución (Para mi es algo mandatorio, pero algunos pueden pensar de otra manera).
Procedemos a descargar los últimos fuentes de altermime de la siguiente web http://www.pldaniels.com/altermime/#download
Compilamos
tar zxvf altermime-x.y.zz.tar.gz
cd altermime-x.y.zz
make
Instalamos
cp altermime /usr/bin/
chown root:root /usr/bin/altermime
chmod 755 /usr/bin/altermime
Creamos un directorio para spool de correos
mkdir /var/spool/filter
cd /var/spool/filter/
chown 750 zimbra
Modificamos el master.cf /opt/zimbra/postfix/conf/master.cf
smtp inet n – n – – smtpd
-o content_filter=dfilt:
dfilt unix - n n – – pipe
flags=Rq user=filter argv=/opt/zimbra/postfix/conf/disclaimer -f ${sender} — ${recipient}
Nota: No cometer el error de comentar o eliminar la otra definición de smtp
Crear un fichero de disclaimer para html y otro txt
/opt/zimbra/postfix/conf/disclaimer.txt
____________________________________________________
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
Company X, Suite# 1, Street, City, Country, www.company.com
/opt/zimbra/postfix/conf/disclaimer.html
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
Company X, Suite# 1, Street, City, Country, www.company.com
Crear un script para los disclaimer /opt/zimbra/postfix/conf/disclaimer, tomen en consideración que el filtro envía toda la cola de correo al filtro, mas sin embargo se requiere un script que elija que correos modificar.
Un ejemplo de script podemos verlo a continuación:
#!/bin/sh
INSPECT_DIR=/var/spool/filter
SENDMAIL=/opt/zimbra/postfix/sbin/sendmail
FOLDER_DISCLAIMER=/opt/zimbra/postfix/conf
# Exit codes from
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; }
TEXT_DISCLAIMER=`grep “[a|A-z|Z]” ${FOLDER_DISCLAIMER}/disclaimer.txt | grep -v “_” | tail -2 | head -1`
cat > in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }
nohup grep “${TEXT_DISCLAIMER}” in.$$ > /dev/null 2>&1
if [ ! "$?" = 0 ]; then
/usr/bin/altermime –input=in.$$ –disclaimer=${FOLDER_DISCLAIMER}/disclaimer.txt –disclaimer-html=${FOLDER_DISCLAIMER}/disclaimer.html \
–xheader=”X-Copyrighted-Material: Please visit www.company.com/privacy.htm” || { echo Message content rejected; exit $EX_UNAVAILABLE; }
fi
$SENDMAIL -i “$@” < in.$$
exit $?
Cambiamos los permisos de filtro
chgrp zimbra /opt/zimbra/postfix/conf/disclaimer
chmod 750 /opt/zimbra/postfix/conf/disclaimer
Reiniciamos el MTA dentro de Zimbra
su – zimbra
zmmtactl stop
zmmtactl start
Comentarios