{"id":38,"date":"2004-06-29T06:14:47","date_gmt":"2004-06-29T06:14:47","guid":{"rendered":"http:\/\/www.noidea.us\/wordpress\/?p=38"},"modified":"2004-06-29T06:14:47","modified_gmt":"2004-06-29T06:14:47","slug":"creating-a-mail-gateway-for-microsoft-exchange","status":"publish","type":"post","link":"http:\/\/www.noidea.us\/wordpress\/2004\/06\/creating-a-mail-gateway-for-microsoft-exchange\/","title":{"rendered":"Creating a Mail Gateway for Microsoft Exchange"},"content":{"rendered":"<p><![CDATA[<link rel=StyleSheet href=\"\/mailgateway\/style.css\" type=\"text\/css\">\n\n\n<p>\n\n\n<h1>Setting Up a Spam-Filtering Mail Gateway<\/h1>\n\n<br \/>\n\n\n<h1>For Microsoft Exchange<\/h1>\n\n<br \/>\n\n\n<h1>Using Fedora Core 1, Postfix 2.0.19,<\/h1>\n\n<br \/>\n\n\n<h1>Amavisd-New and Razor2<\/h1>\n\n<br \/>\n\n\n<p>\n\n\n<div class=\"gatewaydoc\">\n<i>If you find this document useful, or have any additions or corrections, please send a message to the Webmaster.<\/i>\n\n<p>\n\n\n<h2>Document Conventions<\/h2>\n\n<br \/>\n<a class=\"config\" href=\"#\">Configuration filename&#8211;link to example file<\/a>\n\n\n<span class=\"prompt\">Command prompt<\/span>\n\n\n<span class=\"command\">Command typed by user<\/span>\n\n\n<span class=\"comment\">Comments<\/span>\n\n\n<span class=\"editor\">Input to text editor<\/span><br \/>\n\n\n<p>\n\n\n<h2>Install Fedora Core 1<\/h2>\n\n<br \/>\n\n\n<p>\nUse &#8220;server&#8221; configuration<br \/>\n\n\n<p>\n<span class=\"comment\">(need to detail this&#8230;)<\/span><br \/>\n\n\n<p>\n\n\n<h2>Install Fedora Core 1 Updates<\/h2>\n\n<br \/>\n\n\n<p>\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">rpm -ivh http:\/\/ftp.freshrpms.net\/pub\/freshrpms\/fedora\/linux\/1\/apt\/apt-0.5.15cnc3-0.1.fr.i386.rpm<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi \/etc\/apt\/<a href=\"\/mailgateway\/apt\/sources.list.txt\">sources.list<\/a><\/span><br \/>\n\n\n<p>\n<span class=\"comment\">add the lines:<\/span>\n\n\n<span class=\"editor\">rpm http:\/\/apt.sw.be redhat\/fc1\/en\/i386 dag<br \/><\/span><br \/>\n<span class=\"editor\">rpm-src http:\/\/apt.sw.be redhat\/fc1\/en\/i386 dag<br \/><\/span><br \/>\n<span class=\"editor\">rpm http:\/\/ftp.WL0.org apt\/fedora\/fc1\/i386 postfix<br \/><\/span><br \/>\n<span class=\"editor\">rpm-src http:\/\/postfix.WL0.org ftp\/apt\/fedora\/fc1\/i386 postfix<br \/><\/span><br \/>\n\n\n<p>\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">apt-get remove sendmail sendmail-cf<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">apt-get update<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">apt-get upgrade<\/span>\n\n\n<span class=\"comment\">You may have to run this multiple times.<\/span>\n\n\n<span class=\"comment\">After APT updates the first time, you may get an error about not finding sources.list. If so, do:<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">mv \/etc\/apt\/sources.list.rpmsave \/etc\/apt\/sources.list<\/span>\n\n\n<span class=\"comment\">(you can ignore errors about duplicate sources).<\/span><br \/>\n\n\n<p>\n\n\n<h2>Compile and Install Postfix<\/h2>\n\n<br \/>\n\n\n<p>\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">apt-get source postfix<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">apt-get install rpm-build gcc gawk sed ed patch<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">apt-get install mysql mysql-devel<\/span> <span class=\"comment\">(if using mysql)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd \/usr\/src\/redhat\/SOURCES<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">export POSTFIX_MYSQL_REDHAT=1<\/span> <span class=\"comment\">(if using mysql)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">export POSTFIX_PCRE=1<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">export POSTFIX_SASL=2<\/span> <span class=\"comment\">(if using SASL for SMTP AUTH)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">export POSTFIX_TLS=1<\/span> <span class=\"comment\">(for SMTP AUTH)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">export POSTFIX_SMTPD_MULTILINE_GREETING=1<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">sh make-postfix.spec<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd ..\/SPECS<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">rpmbuild -ba postfix.spec<\/span>\n\n\n<span class=\"comment\">you will probably get some errors about needed RPM devel packages. for each one, do:<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">apt-get install <develpackage><\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd ..\/RPMS\/i386<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">rpm -ivh postfix.*.rpm<\/span> <span class=\"comment\">(or: rpm -Uvh postfix.*.rpm if postfix is already installed)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">chkconfig postfix off<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">postfix stop<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd \/etc\/postfix<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi <a class=\"config\" href=\"\/mailgateway\/postfix\/main.cf.txt\">main.cf<\/a><\/span> <span class=\"comment\">(linked file)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi <a class=\"config\" href=\"\/mailgateway\/postfix\/master.cf.txt\">master.cf<\/a><\/span> <span class=\"comment\">(linked file)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">.\/postfix-chroot.sh enable<\/span><br \/>\n\n\n<p>\n\n\n<h2>Install Amavisd-New and Pflogsumm (Postfix Log Summarizer)<\/h2>\n\n<br \/>\n\n\n<p>\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">apt-get install pflogsumm amavisd-new<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">chkconfig amavisd off<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">service amavisd stop<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi \/etc\/<a class=\"config\" href=\"\/mailgateway\/amavis\/amavisd.conf.txt\">amavisd.conf<\/a><\/span> <span class=\"comment\">(linked file)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi \/var\/spool\/amavis\/<a class=\"config\" href=\"\/mailgateway\/amavis\/notify-spam-sender.txt\">notify-spam-sender.txt<\/a><\/span><br \/>\n<span class=\"comment\">(linked file)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">mkdir -p \/var\/spool\/amavis\/tmp<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">mkdir -p \/var\/spool\/amavis\/lookups<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd lookups<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">touch <a class=\"config\" href=\"\/mailgateway\/amavis\/blacklist_sender.txt\">blacklist_sender<\/a> <a class=\"config\" href=\"\/mailgateway\/amavis\/whitelist_sender.txt\">whitelist_sender<\/a><\/span><br \/>\n<span class=\"comment\">(edit as necessary)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi <a class=\"config\" href=\"\/mailgateway\/amavis\/spam_lovers.txt\">spam_lovers<\/a><\/span>\n\n\n<span class=\"comment\">add:<\/span>\n\n\n<span class=\"editor\">postmaster@domain.com<\/span>\n\n\n<span class=\"editor\">abuse@domain.com<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi <a class=\"config\" href=\"\/mailgateway\/amavis\/virus_lovers.txt\">virus_lovers<\/a><\/span> <span class=\"comment\">(same thing &#8211; add postmaster and abuse)<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd ..\/..<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">chown -R amavis:amavis amavis<\/span><br \/>\n\n\n<p>\n\n\n<h2>Install Razor2<\/h2>\n\n<br \/>\n\n\n<p>\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd ~<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">wget http:\/\/aleron.dl.sourceforge.net\/sourceforge\/razor\/razor-agents-2.40.tar.gz<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">perl -MCPAN -e shell<\/span>\n\n\n<span class=\"prompt\">cpan><\/span> <span class=\"command\">install Net::Ping<\/span>\n\n\n<span class=\"prompt\">cpan><\/span> <span class=\"command\">install Net::DNS<\/span>\n\n\n<span class=\"prompt\">cpan><\/span> <span class=\"command\">install Time::HiRes<\/span>\n\n\n<span class=\"prompt\">cpan><\/span> <span class=\"command\">install Digest::SHA1<\/span>\n\n\n<span class=\"prompt\">cpan><\/span> <span class=\"command\">install GetOpt::Long<\/span>\n\n\n<span class=\"prompt\">cpan><\/span> <span class=\"command\">install File::Copy<\/span>\n\n\n<span class=\"prompt\">cpan><\/span> <span class=\"command\">install Digest::Nilsimsa<\/span>\n\n\n<span class=\"prompt\">cpan><\/span> <span class=\"command\">install URI::Escape<\/span>\n\n\n<span class=\"prompt\">cpan><\/span> <span class=\"command\">quit<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">tar xvfz razor-agents-2.40.tar.gz<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd razor-agents-2.40<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">perl Makefile.PL<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">make<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">make test<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">make install<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">su amavis<\/span>\n\n\n<span class=\"prompt\">[amavis]$<\/span> <span class=\"command\">razor-client<\/span>\n\n\n<span class=\"prompt\">[amavis]$<\/span> <span class=\"command\">razor-admin -create<\/span>\n\n\n<span class=\"prompt\">[amavis]$<\/span> <span class=\"command\">razor-admin -register<\/span>\n\n\n<span class=\"prompt\">[amavis]$<\/span> <span class=\"command\">cd \/var\/spool\/amavis\/.razor<\/span>\n\n\n<span class=\"prompt\">[amavis]$<\/span> <span class=\"command\">vi razor-agent.conf<\/span>\n\n\n<span class=\"editor\">debuglevel=1<\/span>\n\n\n<span class=\"prompt\">[amavis]$<\/span> <span class=\"command\">exit<\/span><br \/>\n\n\n<p>\n\n\n<h2>Configure reporting tools<\/h2>\n\n<br \/>\n\n\n<p>\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd \/usr\/local\/sbin<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi <a class=\"config\" href=\"\/mailgateway\/report\/pflogs.sh.txt\">pflogs.sh<\/a><\/span> <span class=\"comment\">(attached file)<\/span>\n\n\n\n\n<div class=\"hide\"><span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi <a class=\"config\" href=\"\/mailgateway\/report\/rejections.sh.txt\">rejections.sh<\/a><\/span> <span class=\"comment\">(attached file)<\/span><\/div>\n\n<br \/>\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">chmod a+x pflogs.sh \n\n<div class=\"hide\">rejections.sh<\/div>\n\n<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd \/etc\/logrotate.d<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi <a class=\"config\" href=\"\/mailgateway\/postfix\/maillog.txt\">maillog<\/a><\/span><br \/>\n<span class=\"comment\">add before &#8220;endscript&#8221;:<\/span>\n\n\n\n\n<div class=\"hide\"><span class=\"editor\">\/usr\/local\/sbin\/rejections.sh&#8221;<\/span><\/div>\n\n<br \/>\n<span class=\"editor\">\/usr\/local\/sbin\/pflogs.sh<\/span><br \/>\n\n\n<p>\n\n\n<h2>Configure SpamAssassin Rule updates<\/h2>\n\n<br \/>\n\n\n<p>\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">wget http:\/\/maxime.ritter.eu.org\/Spam\/rule-get<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">vi rule-get<\/span>\n\n\n<span class=\"comment\">change:<\/span>\n\n\n<span class=\"editor\">my $real_path=&#8221;\/etc\/mail\/spamassassin&#8221;<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">chmod a+x rule-get<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">cd \/etc\/mail\/spamassassin<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">rule-get get-rules<\/span>\n\n\n<span class=\"prompt\">[root]#<\/span> <span class=\"command\">rule-get install BackHair Weeds2 ChickenPox BigEvil TripWire EvilNumbers\n\n\n<span class=\"prompt\">\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting Up a Spam-Filtering Mail Gateway For Microsoft Exchange Using Fedora Core 1, Postfix 2.0.19, Amavisd-New and Razor2 If you find this document useful, or have any additions or corrections, please send a message to the Webmaster. Document Conventions Configuration filename&#8211;link to example file Command prompt Command typed by user Comments Input to text editor [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-38","post","type-post","status-publish","format-standard","hentry","category-computers"],"_links":{"self":[{"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/posts\/38","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":0,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}