jump to navigation

Disclaimer : Postfix-alterMIME-HOWTO March 7, 2007

Posted by invaleed in Linux.
trackback

  1. Installing alterMIME
  2. # 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

  3. Adding a Non-Privileged User To Run alterMIME
  4. # 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

  5. Creating The Script To Run alterMIME
  6. # 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

  7. Creating The Disclaimer Files
  8. # 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-

  9. Postfix Configuration
  10. 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}

  11. Restart Postfix
  12. # postfix reload

Source : Postfix-alterMIME-HOWTO

Comments»

1. justus - February 19, 2008

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

2. Scrumpyude - August 11, 2008

The arguments to altermime should have double hyphens not single (e.g. –input=). Once I spotted that, works peachy. Cheers.

3. Nix - September 23, 2008

This seemingly works for both inbound and outbound emails. Is there a similar script/configuration that may work for only outbound emails only?

Cheers

4. invaleed - September 26, 2008

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… :)

5. justus - October 26, 2008

this worked for me.
I need to how to use Altermine on two different domains on same server.
one as virtual domain.

please assist

6. Manoj - December 15, 2008

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

7. 669 - October 23, 2009

I messed up the final question. ,


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.