menambah disclaimer (altermime) pada zimbra 6.0.6

| Posted in Linux Server, Zimbra

Contoh sebuah disclaimer pada sebuah email sebagai berikut :

—-
© 2010 copyright PT. XYZ.

The contents of this email and any attachments are confidential to the intended recipient.
They may not be disclosed to or used by anyone other than the intended recipient. If this email is
received in error, please email IT@xyz.co.id, quoting the name of the sender and
the email address to which it has been sent and then delete it.


Untuk membuat semua email-email karyawan mendapat footer seperti itu, pada mailserver Zimbra dibutuhkan tool bernama altermime, berikut proses konfigurasinya :

[root@mail gtoms]# su – zimbra
[zimbra@mail ~]$ zmcontrol -v

Release 6.0.6_GA_2324.RHEL5_20100406144520 CentOS5 FOSS edition.

[zimbra@mail ~]$

[root@mail gtoms]# wget http://www.pldaniels.com/altermime/altermime-0.3.10.tar.gz

—10:49:13—  http://www.pldaniels.com/altermime/altermime-0.3.10.tar.gz
Resolving www.pldaniels.com… 202.130.35.19
Connecting to www.pldaniels.com|202.130.35.19|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 85396 (83K) [application/x-gzip]—10:49:26—  (try: 2)  http://www.pldaniels.com/altermime/altermime-0.3.10.tar.gz
Reusing existing connection to www.pldaniels.com:80.
HTTP request sent, awaiting response… 200 OK
Length: 85396 (83K) [application/x-gzip]
Saving to: `altermime-0.3.10.tar.gz’————cutt——————[root@mail gtoms]#

[root@mail gtoms]# tar zxvf altermime0.3.10.tar.gz
altermime-0.3.10/
altermime-0.3.10/altermime.c
altermime-0.3.10/mime_alter.c
altermime-0.3.10/mime_alter.h
altermime-0.3.10/logger.c
altermime-0.3.10/logger.h
altermime-0.3.10/ffget.c
altermime-0.3.10/ffget.h
altermime-0.3.10/pldstr.c
altermime-0.3.10/pldstr.h
altermime-0.3.10/filename-filters.c
altermime-0.3.10/filename-filters.h
altermime-0.3.10/MIME_headers.c
altermime-0.3.10/MIME_headers.h
altermime-0.3.10/libmime-decoders.c
altermime-0.3.10/libmime-decoders.h
altermime-0.3.10/boundary-stack.c
altermime-0.3.10/boundary-stack.h
altermime-0.3.10/strstack.c
altermime-0.3.10/strstack.h
altermime-0.3.10/qpe.c
altermime-0.3.10/qpe.h
altermime-0.3.10/Makefile
altermime-0.3.10/LICENCE
altermime-0.3.10/INSTALL
altermime-0.3.10/README
altermime-0.3.10/CHANGELOG
[root@mail gtoms]#

[root@mail gtoms]# cd altermime-0.3.10

[root@mail altermime-0.3.10]# make
cc -Wall -Werror -g -I. -O2  -c strstack.c
cc -Wall -Werror -g -I. -O2  -c mime_alter.c
cc -Wall -Werror -g -I. -O2  -c ffget.c
cc -Wall -Werror -g -I. -O2  -c pldstr.c
cc Wall -Werror -g -I. -O2  -c filenamefilters.c
cc -Wall -Werror -g -I. -O2  -c logger.c
cc -Wall -Werror -g -I. -O2  -c MIME_headers.c
cc Wall -Werror -g -I. -O2  -c libmimedecoders.c
cc Wall -Werror -g -I. -O2  -c boundarystack.c
cc -Wall -Werror -g -I. -O2  -c qpe.c
cc Wall -Werror -g -I. -O2  altermime.c strstack.o mime_alter.o ffget.o pldstr.o filenamefilters.o logger.o MIME_headers.o libmime-decoders.o boundary-stack.o qpe.o -o altermime
[root@mail altermime-0.3.10]#

[root@mail altermime-0.3.10]# make install
strip altermime
cp altermime /usr/local/bin
chmod a+rx /usr/local/bin/altermime
[root@mail altermime-0.3.10]#

[root@mail altermime-0.3.10]# chown root.root /usr/local/bin/altermime
[root@mail altermime-0.3.10]# chmod 755 /usr/local/bin/altermime

[root@mail altermime-0.3.10]# useradd -r -c “Postfix Filters” -d /var/spool/filter filter

[root@mail altermime-0.3.10]# mkdir /var/spool/filter
[root@mail altermime-0.3.10]# chown filter.filter /var/spool/filter
[root@mail altermime-0.3.10]# chmod 750 /var/spool/filter

[root@mail altermime-0.3.10]# cp /opt/zimbra/postfix/conf/master.cf /opt/zimbra/postfix/conf/master.cf.orig

[root@mail altermime-0.3.10]# vi /opt/zimbra/postfix/conf/master.cf.in

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}

[root@mail altermime-0.3.10]# vi /opt/zimbra/postfix/conf/disclaimer.txt
—-
2010 copyright PT. XYZ.

The contents of this email and any attachments are confidential to the intended recipient. They may not be disclosed to or used by anyone other than
the intended recipient. If this email is received in error, please email IT@xyz.co.id, quoting the name of the sender and the email
address to which it has been sent and then delete it.

[root@mail altermime-0.3.10]# vi /opt/zimbra/postfix/conf/disclaimer.html

The contents of this email and any attachments are confidential to the intended recipient. They may not be disclosed to or used by anyone other than the intended recipient. If this email is received in error, please email href=”mailto:IT@xyz.co.id”>IT@xyz.co.id, quoting the name of the sender and the email address to which it has been sent and then delete it.

[root@mail altermime-0.3.10]# vi /opt/zimbra/postfix/conf/disclaimer
#!/bin/sh
   INSPECT_DIR=/var/spool/filter
   SENDMAIL=/opt/zimbra/postfix/sbin/sendmail
   FOLDER_DISCLAIMER=/opt/zimbra/postfix/conf
   DOMAIN="xyz.co.id"

   # 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; }

   TEXT_DISCLAIMER=`grep "[[:alnum:]]" ${FOLDER_DISCLAIMER}/disclaimer.txt | grep -v "_" | tail -4 | head -1`
   cat > in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }

   # Verify if is there the disclaimer present in the mail body
   grep -q "${TEXT_DISCLAIMER}" in.$$
   let R1="$?"

   # Verify if the sender is from DOMAIN
   #grep "From:" in.$$ | head -1 | grep -i $DOMAIN > /dev/null 2>&1
   echo "$2" | grep -i -q "$DOMAIN"
   let R2="$?"

   # Verify if the recipient is from DOMAIN
   echo "$4" | grep -i -q "$DOMAIN"
   let R3="$?"

   if [[ $R1 != 0 && $R2 == 0 && $R3 != 0 ]]; then
       /usr/local/bin/altermime --input=in.$$
                      --disclaimer=${FOLDER_DISCLAIMER}/disclaimer.txt
                      --disclaimer-html=${FOLDER_DISCLAIMER}/disclaimer.html ||
                      { echo -e n Message content rejected; exit $EX_UNAVAILABLE; }
   fi

   $SENDMAIL -i "$@" < in.$$

   exit $?
jangan lupa sesuaikan domain dan path altermime.

[root@mail altermime-0.3.10]# chgrp filter /opt/zimbra/postfix/conf/disclaimer
[root@mail altermime-0.3.10]# chmod 750 /opt/zimbra/postfix/conf/disclaimer

[root@mail gtoms]#  su – zimbra

[zimbra@mail ~]$ zmmtactl stop
Stopping zmmtaconfig…done.
postfix/postfix-script: stopping the Postfix mail system
Stopping saslauthd…done.

[zimbra@mail ~]$ zmmtactl start
Rewriting configuration files…done.
Starting zmmtaconfig…done.
postfix/postfix-script: starting the Postfix mail system
Starting saslauthd…done.
[zimbra@mail ~]$

Test kirim email menggunakan webmail,mail client,dan selalu perhatikan jika ada masalah di /var/log/zimbra.log

Comments (4)

ko sy coba hasil nya berantakan ya om, service zimbra pada down.. apa yang salah yah..? domain saya sesuaikan tp path nya yang dimaksd yg mana yah yg mesti disesuaikan ?

coba dilihat dan ditelusuri zimbra lognya..

Setelah diretart, posfix g mau running..napa y?

Setelah direstart, postfix g mau running..napa y?

Write a comment