### ### Baseline config notes + milter + MIMEDefang install notes for Redhat 8.0 ### ### This HOW-TO should be taken as an extension of the excellent ### MIMEDefang HOW-TO at http://www.rudolphtire.com/mimedefang-howto ### ### 09 Oct 2002 ### Chandler Howell ### chandler.howell@halfcat.org ### ### Turn off & disable some services we don't want running on a production box # disable unwanted services...run this snippet: # This doesn't actually have anything to do with MIMEDefang, but I include it # as a reminder after a fresh install for s in xinetd netfs portmap atd apmd gpm isdn nfslock rhnsd pcmcia httpd xfs lpd ; do /etc/init.d/${s} stop echo "Disabling $s service in runlevel " `runlevel` /sbin/chkconfig $s off done ### ### Sendmail changes ### ### Install sendmail-devel and sendmail-cf...these were not installed by ### default. I cheated and used rpmfind.net rather than mounting cd's ftp://ftp.rpmfind.net/linux/redhat/8.0/en/os/i386/RedHat/RPMS/sendmail-cf-8.12.5-7.i386.rpm wget ftp://ftp.rpmfind.net/linux/redhat/8.0/en/os/i386/RedHat/RPMS/sendmail-devel-8.12.5-7.i386.rpm rpm -Uvh sendmail-devel-8.12.5-7.i386.rpm sendmail-cf-8.12.5-7.i386.rpm ### in /etc/mail/sendmail.mc , make the following changes: ### ### comment out (add 'dnl' at the beginning of the line): # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA') ### add after the line "dnl FEATURE(`relay_based_on_MX')dnl" : # INPUT_MAIL_FILTER(`mimedefang', `S=unix:/var/spool/MIMEDefang/mimedefang.sock, F=T, T=S:1m;R:1m') ### re-run the sendmail macro processor: m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf ### edit /etc/mail/local-host-names # it should contain something like: # match.corp # machinename.match.corp ### restart sendmail: /etc/init.d/sendmail restart ### You can confirm that sendmail restarted properly with: netstat -apa | grep ":smtp" # should show something like: #tcp 0 0 *:smtp *:* LISTEN 4354/sendmail: acce ### ### Install MIMEDefang ### # download and install MIMEDefang # HOW-TO is at: http://www.rudolphtire.com/mimedefang-howto # File is at: http://www.roaringpenguin.com/mimedefang/mimedefang-2.21.tar.gz # as of this writing. Check http://www.roaringpenguin.com/mimedefang/ for # the latest version. ### ### Perl Modules ### # Followed HOW-TO instructions for 5.5 MIME-tools ### Downloaded & built the following modules: Digest-SHA1-2.01.tar.gz HTML-Parser-3.26.tar.gz HTML-Tagset-3.03.tar.gz IO-stringy-2.108.tar.gz libnet-1.12.tar.gz Mail-Audit-2.1.tar.gz MailTools-1.50.tar.gz MIME-Base64-2.12.tar.gz MIME-tools-5.411a.tar.gz Time-HiRes-1.37.tar.gz ### Unpack the perl modules and cd to that directory, then run this script. ### IMPORTANT: Accept the defaults on all command prompts!!! export $currdir=`pwd` for f in `ls *.gz` ; do echo "unpacking $f"; tar zxf $f done ## download and apply the MIME-tools patch cd $currdir/MIME-tools-5.411 wget http://www.roaringpenguin.com/mimedefang/mime-tools-patch.txt && \ patch -p1 < mime-tools-patch.txt ### Build and install the various packages cd $currdir for f in `ls| grep -v 'gz'`; do echo "building $f" cd $currdir/${f} && echo "now in `pwd`" && perl Makefile.PL && make && make test && make install done ### End the module build scripts ### Add the defang user and make the spool dir /usr/sbin/useradd -r defang mkdir /var/spool/MIMEDefang chmod 700 /var/spool/MIMEDefang chown defang /var/spool/MIMEDefang chgrp defang /var/spool/MIMEDefang ### Get & build MIMEDefang wget http://www.roaringpenguin.com/mimedefang/mimedefang-2.21.tar.gz tar zxf mimedefang-2.21.tar.gz cd mimedefang-2.21 ./configure && make && make install ### configure MIMEDefang and make the changes below: vi $currdir/mimedefang-2.21/examples/init-script ### uncomment: # MX_USER # SUBFILTER ### Install mimedefang and configure it start at startup ### -- cwh -- I'm having some issues with chkconfig accepting this ### script...still have to resolve cp $currdir/mimedefang-2.21/examples/init-script /etc/init.d/mimedefang ### edit the filter file... ### Add the following lines to /etc/mail/mimedefang-filter if ($type eq "text/plain") { $entity->head->replace('content-type', 'text/plain; charset=US-ASCII'); action_rebuild(); } if ($type eq "text/html") { $entity->head->replace('content-type', 'text/html; charset=US-ASCII'); action_rebuild(); } ### Restart mimedefang /etc/init.d/mimedefang restart ### ### Test by sending an email with utf-8 and then check the rich headers. ### They should now look something like: ### (This is added by MIMEDefang. I deliberately left it in the source.) # # X-Scanned-By: MIMEDefang 2.21 (www . roaringpenguin . com / mimedefang) # #This is a multi-part message in MIME format... # # ------------=_1034197558-13748-0 # content-type: text/plain; charset=US-ASCII # ### This was text/plain; charset=utf-8 ! # content-type: text/plain; charset=US-ASCII # # Content-Transfer-Encoding: quoted-printable # Content-Disposition: inline # # ------------=_1034197558-13748-0 # ### This was text/html; charset=utf-8 ! # content-type: text/html; charset=US-ASCII # # Content-Transfer-Encoding: quoted-printable # Content-Disposition: inline ### And you're done(-ish)!