Disclaimer : Postfix-alterMIME-HOWTO March 7, 2007
Posted by invaleed in Linux.trackback
- Installing alterMIME
- Adding a Non-Privileged User To Run alterMIME
- Creating The Script To Run alterMIME
- Creating The Disclaimer Files
- Postfix Configuration
- Restart Postfix
# wget http://www.pldaniels.com/altermime/altermime-0.2.2.tar.gz
# tar -xzvf altermime-0.2.2.tar.gz
# cd altermime-0.2.2
# make
# cp altermime /usr/bin/
# chown root.root /usr/bin/altermime
# chmod 755 /usr/bin/altermime
# useradd -r -c “Postfix Filters” -d /var/spool/filter filter
# mkdir /var/spool/filter
# chown filter.filter /var/spool/filter
# chmod 750 /var/spool/filter
# vi /etc/postfix/disclaimer
#!/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=/etc/postfix/disclaimer.txt \
–disclaimer-html=/etc/postfix/disclaimer.txt \
–xheader=”X-Copyrighted-Material: Please visit http://www.company.com/privacy.htm” || \
{ echo Message content rejected; exit $EX_UNAVAILABLE; }$SENDMAIL “$@” <in.$$
exit $?
# chgrp filter /etc/postfix/disclaimer
# chmod 750 /etc/postfix/disclaimer
# vi /etc/postfix/disclaimer.txt
This message is confidential. It may also be privileged or otherwise protected by work product immunity or other legal rules. If you have received it by mistake, please let us know by e-mail reply and delete it from your system; you may not copy this message or disclose its contents to anyone. Please send us by fax any message containing deadlines as incoming e-mails are not screened for response deadlines. The integrity and security of this message cannot be guaranteed on the Internet.
-www.invalid.web.id-
Edit master.cf :
# vi /etc/postfix/master.cf
127.0.0.1:smtp inet n – y – – smtpd
smtp inet n – y – – smtpd
-o content_filter=dfilt:
dfilt unix – n n – – pipe
flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} — ${recipient}
# postfix reload
Source : Postfix-alterMIME-HOWTO
I have tried the above procedure and this de error am getting:
fatal: bind 0.0.0.0 port 25: Address already in use
thax for the guide
The arguments to altermime should have double hyphens not single (e.g. –input=). Once I spotted that, works peachy. Cheers.
This seemingly works for both inbound and outbound emails. Is there a similar script/configuration that may work for only outbound emails only?
Cheers
Yes… work for only outbound email, if you wanted alterMIME could work in both inbound and outbound, you must have two ethernet , one for outbound and one for inbound…
this worked for me.
I need to how to use Altermine on two different domains on same server.
one as virtual domain.
please assist
Hi I just installed altermime and compiled and built it but it throws an error of port 25 being used already Im pasting hte script below
#!/bin/bash
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail
# 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; }
cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }
/usr/bin/altermime –input=in.$$ \
–disclaimer=/etc/postfix/disclaimer.txt \
–disclaimer-html=/etc/postfix/disclaimer.txt \
–xheader=”X-Copyrighted-Material: Please visit http://www.company.com/privacy.htm” || \
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
$SENDMAIL “$@” <in.$$
search hit BOTTOM, continuing at TOP
and te master.cf file entries are given below
127.0.0.1:smtp inet n – y – - smtpd
smtp inet n – y – - smtpd
-o content_filter=dfilt:
dfilt unix – n n – – pipe
flags=Rq user=filter argv=/etc/postfix/disclaim-script — ${sender} — ${recipient}
Please note that I have removed the “-f” parameter before the ${sender} parameter
Please help me
thanks
manoj
I messed up the final question. ,