Adding disclaimer
From Kolab wiki
This How To is pretty much a copy of the Postfix-alterMIME-HOWTO by Derrick J Houy, we had to change a few details to get AlterMIME to work with Kolab. We don't know how much use you will get from this, but we have posted it anyway in the hope it will help solve this issue for others. You can find the complete text of Derrick's HOWTO here
First thing you need to obtain is the AlterMIME package written by PLDaniels, you can get this from here [2].
Next install the package following the next few steps...
1. Download Altermime.
2. Untar Altermime package.
3. cd into altermime.xxxx.
4. type 'make' to create the executable (altermime).
5. Copy the executable into the location /usr/bin
6. chown root.root /usr/bin/altermime
7. chmod 755 /usr/bin/altermime
Now create a non privileged user to run the filter against...
useradd -r -c "Postfix Filters" -d /var/spool/filter filter
Once you have created this account you need to create the account's home directory
mkdir /var/spool/filter chown filter.filter /var/spool/filter chmod 750 /var/spool/filter
You now need to create the following script /kolab/etc/postfix/disclaimer
we entered the following for our script...
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail
# 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; }
/usr/bin/altermime --input=in.$$ \
--disclaimer=/kolab/etc/postfix/disclaimer.txt \
--disclaimer-html=/kolab/etc/postfix/disclaimer.txt \
--xheader="X-Copyrighted-Material:" || \
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
$SENDMAIL "$@" <in.$$
exit $?
#----------------------------------------
Note in the above we didn't bother with a html disclaimer we just used the text one.
Once you have created this script, set the permissions to allow it to be executed by the filter user
chgrp filter /kolab/etc/postfix/disclaimer chmod 750 /kolab/etc/postfix/disclaimer
OK so now we create the actual text file containing the disclaimer notification, this file is located in..
/kolab/etc/postfix/ (as the above directive in the script file) and called disclaimer.txt
Ours is similar to the following...
This email and its attachments are intended for the above named only and may be confidential. If you have received them in error please notify the sender immediately and delete all records of the email and its attachments from your computer. Unless you are the intended recipient you must not read, copy, distribute, use or retain this email or any attachments or any part of them. Although we aim to use efficient virus checking procedures for emails and attachments we accept no liability for viruses and it is the recipient's responsibility to ensure they are actually virus free.
So now Kolab's Postfix needs to be instructed to use the filter as part of the mail delivery process.
As you probably already know (but we'll go over it just in case you don't) Kolab uses a system of template files that are edited by the administrator and then after running the Kolab command 'kolabconf' any changes made to these template files are incorporated into the actual configuration files and the processes effected are restarted.
For example to make Kolab's Postfix aware of the disclaimer filter, change the /kolab/etc/kolab/templates/master.cf.template
Then while the Kolab services are running issue the command
/kolab/sbin/kolabconf
The changes we made to our /kolab/etc/kolab/templates/master.cf.template file (marked in Italic) were...
# (c) 2004 Steffen Hansen <steffen@klaralvdalens-datakonsult.se> (Klaralvdalens Datakonsult AB)
# (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
# (c) 2003 Martin Konold <martin.konold@erfrakon.de>
# (c) 2003 Achim Frank <achim.frank@erfrakon.de>
# This program is Free Software under the GNU General Public License (>=v2).
# Read the file COPYING that comes with this packages for details.
# this file is automatically written by the Kolab config backend
# manual additions are lost unless made to the template in the Kolab config directory
127.0.0.1:smtp inet n - n - - smtpd
10.101.2.18:smtp inet n - n - - smtpd
-o content_filter=dfilt:
#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 nqmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
smtp unix - - n - - smtp
showq unix n - n - - showq
error unix - - n - - error
local unix - n n - - local
#virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
tlsmgr unix - - n 1000? 1 tlsmgr
#cyrus unix - n n - - pipe flags=R user=cyrus argv=/kolab/bin/deliver -e -m ${extension}{user}
#uucp unix - n n - - pipe flags=Fqhu user=uucp argv=/kolab/bin/uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#ifmail unix - n n - - pipe flags=F user=ftn argv=/kolab/bin/ifmail -r $nexthop ($recipient)
#bsmtp unix - n n - - pipe flags=Fq. user=foo argv=/kolab/bin/bsmtp -f $sender $nexthop $recipient
465 inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
post-cleanup unix n - n - 0 cleanup -o virtual_maps=
smtp-amavis unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
# SMTP interface for injecting mail back into postfix
# from amavis
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=kolabfilter
-o cleanup_service_name=post-cleanup
-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 strict_rfc821_envelopes=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
# SMTP interface for injecting mail back into postfix
# from the automatic invitation handling script
127.0.0.1:10026 inet n - n - - smtpd
-o content_filter=
-o cleanup_service_name=post-cleanup
-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 strict_rfc821_envelopes=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
kolabpolicy unix - n n - - spawn user=kolab-n argv=/kolab/etc/kolab/kolab_smtpdpolicy
kolabfilter unix - n n - - pipe user=kolab-n flags=n argv=/kolab/bin/php
-c /kolab/etc/apache/php.ini
-f /kolab/etc/resmgr/kolabfilter.php
--
-h mailserver.domain.com
-s ${sender}
-r ${recipient}
-c ${client_address}
kolabmailboxfilter unix - n n - - pipe user=kolab-n flags=n argv=/kolab/bin/php
-c /kolab/etc/apache/php.ini
-f /kolab/etc/resmgr/kolabmailboxfilter.php
--
-h mailserver.domain.com
-s ${sender}
-r ${recipient}
-c ${client_address}
dfilt unix - n n - - pipe
flags=Rq user=filter argv=/kolab/etc/postfix/disclaimer -f ${sender} -- ${recipient}
---
OK so at this point we stopped and then started the services again using...
/kolab/bin/openpkg rc all stop
/kolab/bin/openpkg rc all start
Note the above may not be necessary (please let us know) however we found that the changes only took effect after running these commands.
Now using a mail client of your choice, send yourself a mail and look for the disclaimer at the bottom.
We hope this little HOWTO helps someone.
Thanks Ian and Marco.
