Disclaimer : Postfix-alterMIME-HOWTO

Posted on Updated on


  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&#8221; || \
    { 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

7 thoughts on “Disclaimer : Postfix-alterMIME-HOWTO

    justus said:
    February 19, 2008 at 8:23 pm

    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

    Scrumpyude said:
    August 11, 2008 at 10:29 pm

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

    Nix said:
    September 23, 2008 at 10:00 am

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

    Cheers

    invaleed responded:
    September 26, 2008 at 7:53 am

    Yes… its work only for outbound, if you want to alterMIME work in both inbound and outbound, you must have two ethernet , one for outbound and one for inbound…🙂

    justus said:
    October 26, 2008 at 10:24 am

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

    please assist

    Manoj said:
    December 15, 2008 at 6:31 am

    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

    669 said:
    October 23, 2009 at 11:20 am

    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 )

Google+ photo

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

Connecting to %s