<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sekiur My Thoughts &#187; spam</title>
	<atom:link href="http://blog.sekiur.com/tag/spam/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sekiur.com</link>
	<description>VoIP, Mobility, Security, Open Source, Science, Politics, and Technology.</description>
	<lastBuildDate>Wed, 24 Aug 2011 19:46:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Setting up a Mail Relay on CentOS 5</title>
		<link>http://blog.sekiur.com/2008/09/setting-up-a-mail-relay-on-centos-5/</link>
		<comments>http://blog.sekiur.com/2008/09/setting-up-a-mail-relay-on-centos-5/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 23:05:36 +0000</pubDate>
		<dc:creator>Jose Vicente Ortega</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[clamav]]></category>
		<category><![CDATA[mailscanner]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[phishing]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[postgrey]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[virus]]></category>

		<guid isPermaLink="false">http://blog.sekiur.com/?p=271</guid>
		<description><![CDATA[<p>This will give you the capability to scan e-mails for spam, viruses and phishing using a variety of open source programs before they arrive to your e-mail server.</p> <p>From Sekipedia<br /> Jump to: navigation, search</p> <p>* Install CentOS 5.1 barebones (customizing the install with nothing checked.)</p> <p>* Update the system </p> <p>yum update</p> <p>* Install [...]]]></description>
			<content:encoded><![CDATA[<p>This will give you the capability to scan e-mails for spam, viruses and phishing using a variety of open source programs before they arrive to your e-mail server.</p>
<p>From Sekipedia<br />
Jump to: navigation, search</p>
<p>* <strong>Install CentOS 5.1 barebones</strong> (customizing the install with nothing checked.)</p>
<p>* <strong>Update the system </strong></p>
<p>yum update</p>
<p>* <strong>Install Additional packages </strong></p>
<p>yum install ntp</p>
<p>yum install vixie-cron crontabs</p>
<p>* <strong>Download and install Webmin </strong></p>
<p>cd /opt</p>
<p>wget http://prdownloads.sourceforge.net/webadmin/webmin-1.430-1.noarch.rpm</p>
<p>yum install perl-Net-SSLeay</p>
<p>rpm -ivh webmin-1.430-1.noarch.rpm</p>
<p>* <strong>Disabled unneeded services </strong></p>
<p>service iptables stop<br />
service ip6tables stop<br />
service netfs stop<br />
chkconfig iptables off<br />
chkconfig ip6tables off<br />
chkconfig netfs off</p>
<p>* <strong>Install Postfix </strong></p>
<p>yum install postfix</p>
<p>* <strong>Configure Postfix </strong></p>
<p>myhostname = titan.corp.com<br />
mydomain = localhost<br />
myorigin = $mydomain<br />
inet_interfaces = all<br />
mydestination = $myhostname, localhost.$mydomain, $mydomain<br />
mynetwork_style = class</p>
<p>* <strong>Configure Postfix to forward email </strong></p>
<p>relay_domains = lab.net</p>
<p>This tells Postfix which domains it should relay mail. All mail destined for this domain (and only this domain) will be forwarded to its remote SMTP server. You can put multiple domains here, just separate them with a comma or whitespace.</p>
<p>Add line to end of main.cf</p>
<p>transport_maps = hash:/etc/postfix/transport<br />
mailbox_size_limit = 20480000<br />
mailbox_size_limit = 20480000</p>
<p>This tells Postfix what method to use to resolve the destination address for relayed mail:</p>
<p>Add line to end of &#8220;/etc/postfix/transport&#8221;</p>
<p>lab.net		smtp:[192.168.2.225]</p>
<p>This command specifically maps the domain &#8220;lab.net&#8221; to the IP address 192.168.2.225 and tells Postfix to use SMTP as the transport. All mail destined for lab.net which is relayed through this Spam Gateway will be forwarded via SMTP to 192.168.2.225.</p>
<p>Then run command:</p>
<p>postmap /etc/postfix/transport</p>
<p>This command builds the hash table/file which Posfix will use to forward mail. If you don&#8217;t do this, it wont work.</p>
<p>Finally add this line to main.cf</p>
<p>append_at_myorigin = no</p>
<p>These lines will make sure your Spam Gateway does not add any of its own header domain info to the mail as it passes thru.</p>
<p>*<strong> Test Again </strong></p>
<p>Stop and start postfix to make sure all changes take.</p>
<p>service postfix stop<br />
service postfix start</p>
<p>I know this is redundant, but you really should test your system again before installing MailScanner. Make sure that mail gets passed through the system without problem. If you do encounter a problem, it will be a lot easier to fix it now than after you&#8217;ve installed MailScanner, SpamAssassin and ClamAV.</p>
<p>At this point incoming e-mail should go through the Mail Relay and be forwarded to the internal E-mail server.</p>
<p>* <strong>Install DAG&#8217;s GPG key </strong></p>
<p>rpm &#8211;import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt</p>
<p>* <strong>Verify the package you have downloaded</strong></p>
<p>rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm</p>
<p>Security warning: The rpmforge-release package imports GPG keys into your RPM database. As long as you have verified the package and trust Dag then it should be safe.</p>
<p>* <strong>Download and Install the package </strong></p>
<p>wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm<br />
rpm -ivh rpmforge-release-0.3.6-1.el5.rf.*.rpm</p>
<p>This will add a yum repository config file and import the appropriate GPG keys. At this point, you can set the priority of the RPMForge repository, and also of the CentOS repositories if you have not done so yet.</p>
<p>* <strong>Test with this command: </strong></p>
<p>yum check-update</p>
<p>* <strong>Update the system </strong></p>
<p>yum update</p>
<p>* <strong>Install perl modules and dependencies for MailScanner </strong></p>
<p>yum install &#8211;enablerepo=rpmforge perl-Archive-Zip perl-Convert-BinHex perl-Convert-TNEF perl-DBD-SQLite perl-Filesys-Df perl-HTML-Parser</p>
<p>yum install &#8211;enablerepo=rpmforge perl-IO-stringy perl-MIME-tools perl-Net-CIDR perl-Sys-Hostname-Long perl-OLE-Storage_Lite</p>
<p>yum install tnef</p>
<p>* <strong>Download and Install MailScanner </strong></p>
<p>wget http://www.mailscanner.info/files/4/rpm/MailScanner-4.71.10-1.rpm.tar.gz</p>
<p>tar -zxvf MailScanner-4.71.10-1.rpm.tar.gz</p>
<p>cd MailScanner-4.71.10-1</p>
<p>rpm -ivh mailscanner-4.71.10-1.noarch.rpm</p>
<p>chkconfig postfix off</p>
<p>service postfix stop</p>
<p>chkconfig MailScanner on</p>
<p>* <strong>Configure MailScanner Settings </strong></p>
<p>Updates to postfix&#8217;s main.cf by adding this line:</p>
<p>header_checks = regexp:/etc/postfix/header_checks</p>
<p>In the file /etc/postfix/header_checks add this line:</p>
<p>/^Received:/ HOLD</p>
<p>Here are the edits to Mailscanner &#8211; place / update in /etc/MailScanner/MailScanner.conf</p>
<p>Run As User = postfix<br />
Run As Group = postfix<br />
Incoming Queue Dir = /var/spool/postfix/hold<br />
Outgoing Queue Dir = /var/spool/postfix/incoming<br />
MTA = postfix</p>
<p>Optional edits to MailScanner</p>
<p>Change %org-name%<br />
Change %org-long-name%<br />
Change %web-site%</p>
<p>Here&#8217;s some file permissions changes you&#8217;ll need to make:</p>
<p>chown postfix.postfix /var/spool/MailScanner/incoming<br />
chown postfix.postfix /var/spool/MailScanner/quarantine</p>
<p>service MailScanner start</p>
<p>Its a good idea to test the server now. Send a message to the remote server and see if it goes through. It should, and then you can move to installing SpamAssassin.</p>
<p>* <strong>Install perl modules for SpamAssassin </strong></p>
<p>yum install perl-Digest-SHA1 perl-Net-DNS perl-Archive-Tar perl-IO-Zlib</p>
<p>yum install &#8211;enablerepo=rpmforge perl-Encode-Detect perl-Mail-SPF perl-IP-Country perl-Mail-DKIM perl-Net-Ident</p>
<p>* <strong>Update the system </strong></p>
<p>yum update</p>
<p>* <strong>Install and Configure SpamAssassin </strong></p>
<p>yum install spamassassin</p>
<p>You don&#8217;t need to edit any of the SpamAssassin conf files because all of the configuration is done through MailScanner.</p>
<p>In /etc/MailScanner/MailScanner.conf we will make these changes:</p>
<p>Change this line:</p>
<p>Use SpamAssassin = no</p>
<p>to:</p>
<p>Use SpamAssassin = yes</p>
<p>Update the SpamAssassin User State Dir setting:</p>
<p>SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin</p>
<p>and then run commands:</p>
<p>mkdir /var/spool/MailScanner/spamassassin<br />
chown postfix.postfix /var/spool/MailScanner/spamassassin</p>
<p>Restart MailScanner to make changes stick.</p>
<p>service MailScanner restart</p>
<p>* <strong>SELinux exception for Clamav </strong></p>
<p>setsebool -P clamd_disable_trans=1 or disable SELinux while Clamav is installed.</p>
<p>* <strong>Install ClamAV </strong></p>
<p>yum install clamav clamav-db &#8211;enablerepo=rpmforge</p>
<p>* <strong>Configure ClamAV and MailScanner Settings </strong></p>
<p>In /etc/freshclam.conf make the following edits:</p>
<p>Add &#8216;#&#8217; in front of the word &#8216;Example&#8217;</p>
<p>Do the same in /etc/freshclam.conf</p>
<p>Now you need to update ClamAV&#8217;s virus signature files</p>
<p>[root@smtp]# freshclam</p>
<p>ClamAV update process started at Fri Sep 19 12:45:42 2008<br />
main.cld is up to date (version: 48, sigs: 399264, f-level: 35, builder: sven)<br />
daily.cvd is up to date (version: 8287, sigs: 29596, f-level: 35, builder: arnaud)</p>
<p>Update MailScanner&#8217;s configuration file to use ClamAV</p>
<p>&#8216;Virus Scanners = clamav&#8217;</p>
<p>In MailScanner.conf, check the setting of &#8216;Monitors for ClamAV Updates&#8217; to ensure it matches the location of your ClamAV virus database files.</p>
<p>This should be &#8220;/var/clamav/*.cld /var/clamav/*.cvd&#8221;.</p>
<p>* <strong>Installing Postgrey </strong></p>
<p>yum install postgrey</p>
<p>*<strong> Configuring Postgrey </strong></p>
<p>Edit /etc/postfix/main.cf and add the following to smtpd_recipient_restrictions.</p>
<p>permit_mynetworks,<br />
reject_unauth_destination,<br />
reject_unlisted_recipient,<br />
check_policy_service unix:postgrey/socket</p>
<p>check_policy_service unix:postgrey/socket performs the greylisting while adding reject_unlisted_recipient before it enables Postfix to immediately reject unknown recipients instead of having clients go through the greylisting process before being informed that the recipient does not exist.</p>
<p>To disable greylisting for certain IP addresses or hostnames, add the IP address, hostname or regular expression to match hostnames into the file /etc/postfix/postgrey_whitelist_clients.local.</p>
<p>Hostnames are identified by performing a reverse DNS on the client’s IP address.</p>
<p>For sample entries, view the file /etc/postfix/postgrey_whitelist_clients.</p>
<p>* <strong>Update the system </strong></p>
<p>Make one last final update to make sure your system is updated.</p>
<p>yum update</p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-3340920433757461";
google_ui_features = "rc:10";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sekiur.com/2008/09/setting-up-a-mail-relay-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

