/usr/share/doc/altermime/html/postfix-altermime-howto-2.html is in altermime 0.3.10-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.66">
<TITLE>Postfix-alterMIME-HOWTO : Installation and Configuration</TITLE>
<LINK HREF="postfix-altermime-howto-3.html" REL=next>
<LINK HREF="postfix-altermime-howto-1.html" REL=previous>
<LINK HREF="postfix-altermime-howto.html#toc2" REL=contents>
</HEAD>
<BODY>
<A HREF="postfix-altermime-howto-3.html">Next</A>
<A HREF="postfix-altermime-howto-1.html">Previous</A>
<A HREF="postfix-altermime-howto.html#toc2">Contents</A>
<HR>
<H2><A NAME="s2">2.</A> <A HREF="postfix-altermime-howto.html#toc2">Installation and Configuration</A></H2>
<P>This documentation is based on the Linux distribution I used (Red Hat 9 with Postfix), and although
it should work on most any Linux distribution, you may need to defiate from the exact instructions to
get it working on your particular flavour of Linux.</P>
<H2><A NAME="ss2.1">2.1</A> <A HREF="postfix-altermime-howto.html#toc2.1">Installing alterMIME</A>
</H2>
<P>alterMIME can be downloaded from
<A HREF="http://www.pldaniels.com/altermime/">http://www.pldaniels.com/altermime/</A>. The version I used was 0.3.1.</P>
<P>Once downloaded, you need to unpack the tarball, change into the new directory and run</P>
<P>
<PRE>
make
</PRE>
</P>
<P>After building the altermime executable, install it as follows</P>
<P>
<PRE>
cp altermime /usr/bin/
chown root.root /usr/bin/altermime
chmod 755 /usr/bin/altermime
</PRE>
</P>
<H2><A NAME="ss2.2">2.2</A> <A HREF="postfix-altermime-howto.html#toc2.2">Adding a Non-Privileged User To Run alterMIME</A>
</H2>
<P>Unless you have already done this to run other filters in Postfix, the next step is to add a user account
to the system that Potfix will use to run the alterMIME filter</P>
<P>
<PRE>
useradd -r -c "Postfix Filters" -d /var/spool/filter filter
</PRE>
</P>
<P>Once you have created this account you need to create the account's home directory</P>
<P>
<PRE>
mkdir /var/spool/filter
chown filter.filter /var/spool/filter
chmod 750 /var/spool/filter
</PRE>
</P>
<H2><A NAME="ss2.3">2.3</A> <A HREF="postfix-altermime-howto.html#toc2.3">Creating The Script To Run alterMIME</A>
</H2>
<P>You now need to create the following script, changing whatever you need to personalize it</P>
<P>
<PRE>
/etc/postfix/disclaimer
</PRE>
</P>
<P>
<HR>
<PRE>
#!/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 -oi "$@" <in.$$
exit $?
</PRE>
<HR>
</P>
<P>Once you have created this script, set the permissions to allow it to be executed by the filter user</P>
<P>
<PRE>
chgrp filter /etc/postfix/disclaimer
chmod 750 /etc/postfix/disclaimer
</PRE>
</P>
<H2><A NAME="ss2.4">2.4</A> <A HREF="postfix-altermime-howto.html#toc2.4">Creating The Disclaimer Files</A>
</H2>
<P>You need to create the disclaimer text file that was specified in the disclaimer.sh file</P>
<P>
<PRE>
/etc/postfix/disclaimer.txt
</PRE>
</P>
<P>The content of this file is very much dependent on your requirements, but examples can be found at
<A HREF="http://www.emaildisclaimers.com">http://www.emaildisclaimers.com</A>.</P>
<P>In my situation, I have used the same file for both the <CODE>--disclaimer</CODE> and <CODE>--disclaimer-html</CODE>
files. I tried to use the <CODE>--htmltoo</CODE> parameter to tell alterMIME to use the same file for both, but
this did not seem to work correctly.</P>
<H2><A NAME="ss2.5">2.5</A> <A HREF="postfix-altermime-howto.html#toc2.5">Postfix Configuration</A>
</H2>
<P>Finally, you need to configure Postfix to run the filter. In my case, I only wanted outgoing messages
to be modified, so I explicitly configured Postfix to listen on different network interfaces, but to
only run the filter on the one.</P>
<P>To achieve this, you need to modify the smtp service in <CODE></CODE>etc/postfix/master.cf/ to be as follows</P>
<P>
<HR>
<PRE>
<incoming ip>:smtp inet n - y - - smtpd
<outgoing ip>:smtp inet n - y - - smtpd
-o content_filter=dfilt:
</PRE>
<HR>
</P>
<P>replacing <incoming ip> and <outgoing ip> with the IP addresses of the different network
interfaces. In practice, these IP addresses could be bound to the same network controller.</P>
<P>Now you need to add the following new service to the same file</P>
<P>
<HR>
<PRE>
dfilt unix - n n - - pipe
flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}
</PRE>
<HR>
</P>
<P>NOTE: You need to ensure that local processes are still able to send mail. The simplest case way is to include
a line like the one below in <CODE></CODE>etc/postfix/master.cf/ (Thank you to Ian Clancy for pointing out this omisson).</P>
<P>
<HR>
<PRE>
127.0.0.1:smtp inet n - y - - smtpd
</PRE>
<HR>
</P>
<P>Once you have done this, restart Postfix and send through some test messages whilst watching the mail log.
If everything goes through fine, without any errors, you can pat yourself on the back and go get a cup of
coffee.</P>
<HR>
<A HREF="postfix-altermime-howto-3.html">Next</A>
<A HREF="postfix-altermime-howto-1.html">Previous</A>
<A HREF="postfix-altermime-howto.html#toc2">Contents</A>
</BODY>
</HTML>
|