Setting Up a Spam-Filtering Mail Gateway
For Microsoft Exchange
Using Fedora Core 1, Postfix 2.0.19,
Amavisd-New and Razor2
Document Conventions
Configuration filename–link to example file Command prompt Command typed by user Comments Input to text editor
Install Fedora Core 1
Use “server” configuration
(need to detail this…)
Install Fedora Core 1 Updates
[root]# rpm -ivh http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/1/apt/apt-0.5.15cnc3-0.1.fr.i386.rpm
[root]# vi /etc/apt/sources.list
add the lines:
rpm http://apt.sw.be redhat/fc1/en/i386 dag
rpm-src http://apt.sw.be redhat/fc1/en/i386 dag
rpm http://ftp.WL0.org apt/fedora/fc1/i386 postfix
rpm-src http://postfix.WL0.org ftp/apt/fedora/fc1/i386 postfix
[root]# apt-get remove sendmail sendmail-cf
[root]# apt-get update
[root]# apt-get upgrade
You may have to run this multiple times.
After APT updates the first time, you may get an error about not finding sources.list. If so, do:
[root]# mv /etc/apt/sources.list.rpmsave /etc/apt/sources.list
(you can ignore errors about duplicate sources).
Compile and Install Postfix
[root]# apt-get source postfix
[root]# apt-get install rpm-build gcc gawk sed ed patch
[root]# apt-get install mysql mysql-devel (if using mysql)
[root]# cd /usr/src/redhat/SOURCES
[root]# export POSTFIX_MYSQL_REDHAT=1 (if using mysql)
[root]# export POSTFIX_PCRE=1
[root]# export POSTFIX_SASL=2 (if using SASL for SMTP AUTH)
[root]# export POSTFIX_TLS=1 (for SMTP AUTH)
[root]# export POSTFIX_SMTPD_MULTILINE_GREETING=1
[root]# sh make-postfix.spec
[root]# cd ../SPECS
[root]# rpmbuild -ba postfix.spec
you will probably get some errors about needed RPM devel packages. for each one, do:
[root]# apt-get install
Install Amavisd-New and Pflogsumm (Postfix Log Summarizer)
[root]# apt-get install pflogsumm amavisd-new
[root]# chkconfig amavisd off
[root]# service amavisd stop
[root]# vi /etc/amavisd.conf (linked file)
[root]# vi /var/spool/amavis/notify-spam-sender.txt
(linked file)
[root]# mkdir -p /var/spool/amavis/tmp
[root]# mkdir -p /var/spool/amavis/lookups
[root]# cd lookups
[root]# touch blacklist_sender whitelist_sender
(edit as necessary)
[root]# vi spam_lovers
add:
postmaster@domain.com
abuse@domain.com
[root]# vi virus_lovers (same thing – add postmaster and abuse)
[root]# cd ../..
[root]# chown -R amavis:amavis amavis
Install Razor2
[root]# cd ~
[root]# wget http://aleron.dl.sourceforge.net/sourceforge/razor/razor-agents-2.40.tar.gz
[root]# perl -MCPAN -e shell
cpan> install Net::Ping
cpan> install Net::DNS
cpan> install Time::HiRes
cpan> install Digest::SHA1
cpan> install GetOpt::Long
cpan> install File::Copy
cpan> install Digest::Nilsimsa
cpan> install URI::Escape
cpan> quit
[root]# tar xvfz razor-agents-2.40.tar.gz
[root]# cd razor-agents-2.40
[root]# perl Makefile.PL
[root]# make
[root]# make test
[root]# make install
[root]# su amavis
[amavis]$ razor-client
[amavis]$ razor-admin -create
[amavis]$ razor-admin -register
[amavis]$ cd /var/spool/amavis/.razor
[amavis]$ vi razor-agent.conf
debuglevel=1
[amavis]$ exit
Configure reporting tools
[root]# cd /usr/local/sbin [root]# vi pflogs.sh (attached file)
[root]# chmod a+x pflogs.sh
add before “endscript”:
/usr/local/sbin/pflogs.sh
Configure SpamAssassin Rule updates
[root]# wget http://maxime.ritter.eu.org/Spam/rule-get [root]# vi rule-get change: my $real_path=”/etc/mail/spamassassin” [root]# chmod a+x rule-get [root]# cd /etc/mail/spamassassin [root]# rule-get get-rules [root]# rule-get install BackHair Weeds2 ChickenPox BigEvil TripWire EvilNumbers
by
Tags:
Leave a Reply