Disclaimer : Postfix-alterMIME-HOWTO

  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

Share it now...
Share on Facebook0Tweet about this on TwitterEmail this to someoneShare on Google+0
The following two tabs change content below.
Unix/Linux enthusiasts, good working experience with SAN, NAS, Linux, Solaris, AIX, VMWare & Graphic Design. Certified for Solaris Admin, EMC & HDS Storage.

7 thoughts on “Disclaimer : Postfix-alterMIME-HOWTO

  1. justus says:

    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 says:

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

  3. Nix says:

    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 says:

    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… 🙂

  5. justus says:

    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 says:

    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

Leave a Reply

Your email address will not be published. Required fields are marked *