<?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>P0L0&#039;s Blog &#187; amavis</title>
	<atom:link href="http://p0l0.binware.org/index.php/tag/amavis/feed/" rel="self" type="application/rss+xml" />
	<link>http://p0l0.binware.org</link>
	<description>Opensource Projects and IT experiences</description>
	<lastBuildDate>Tue, 25 May 2010 06:24:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Postfix+Amavisd-new+Spamassasin+Clamav</title>
		<link>http://p0l0.binware.org/index.php/2009/08/08/postfixamavisd-newspamassasinclamav/</link>
		<comments>http://p0l0.binware.org/index.php/2009/08/08/postfixamavisd-newspamassasinclamav/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 18:50:24 +0000</pubDate>
		<dc:creator>P0L0</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[amavis]]></category>
		<category><![CDATA[antivirus]]></category>
		<category><![CDATA[binware]]></category>
		<category><![CDATA[clamav]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[spamassasin]]></category>

		<guid isPermaLink="false">http://p0l0.binware.org/?p=384</guid>
		<description><![CDATA[Since I had to disable the PTR check in Postfix at Binware because in Spain 90% of mail servers are badly configured and they were all rejected, and now we have lot of spam.
So I decided to install Spamassassin and Clamav to detect and reject some of this spam.
First of all, we need to install [...]]]></description>
			<content:encoded><![CDATA[<p>Since I had to disable the PTR check in Postfix at <a href="http://binware.org">Binware</a> because in Spain 90% of mail servers are badly configured and they were all rejected, and now we have lot of spam.</p>
<p>So I decided to install Spamassassin and Clamav to detect and reject some of this spam.</p>
<p>First of all, we need to install needed packages:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> spamassassin amavisd-new clamav clamav-daemon</pre></div></div>

<p>We will begin configuring amavisd-new, the configuration files are at <strong>/etc/amavis/conf.</strong></p>
<p>In file <strong>20-debian_default</strong>s I changed the header that will be added to each mail processed:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #0000ff;">$X_HEADER_LINE</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;AntiSpam/Antivirus Scanner at $mydomain&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>We need to activate antispam and antivirus check in amavis, this is found in file <strong>15-content_filter_mode</strong>. We need to uncomment @bypass_virus_checks_maps and @bypass_spam_checks_maps. The file will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># You can modify this file to re-enable SPAM checking through spamassassin</span>
<span style="color: #666666; font-style: italic;"># and to re-enable antivirus checking.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Default antivirus checking mode</span>
<span style="color: #666666; font-style: italic;"># Please note, that anti-virus checking is DISABLED by</span>
<span style="color: #666666; font-style: italic;"># default.</span>
<span style="color: #666666; font-style: italic;"># If You wish to enable it, please uncomment the following lines:</span>
&nbsp;
&nbsp;
<span style="color: #0000ff;">@bypass_virus_checks_maps</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>
   <span style="color: #0000ff;">\%bypass_virus_checks</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\@bypass_virus_checks_acl</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\$bypass_virus_checks_re</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Default SPAM checking mode</span>
<span style="color: #666666; font-style: italic;"># Please note, that anti-spam checking is DISABLED by</span>
<span style="color: #666666; font-style: italic;"># default.</span>
<span style="color: #666666; font-style: italic;"># If You wish to enable it, please uncomment the following lines:</span>
&nbsp;
&nbsp;
<span style="color: #0000ff;">@bypass_spam_checks_maps</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>
   <span style="color: #0000ff;">\%bypass_spam_checks</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\@bypass_spam_checks_acl</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\$bypass_spam_checks_re</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;"># ensure a defined return</span></pre></div></div>

<p>By default, amavis will use the hostname for <strong><em>$mydomain</em></strong>, but thats not what I want, so I edited file <strong>05-domain_id</strong>, setting <strong><em>$mydomain</em></strong> to <strong>binware.org</strong></p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># $mydomain is used just for convenience in the config files and it is not</span>
<span style="color: #666666; font-style: italic;"># used internally by amavisd-new except in the default X_HEADER_LINE (which</span>
<span style="color: #666666; font-style: italic;"># Debian overrides by default anyway).</span>
&nbsp;
<span style="color: #0000ff;">$mydomain</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'binware.org'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># amavisd-new needs to know which email domains are to be considered local</span>
<span style="color: #666666; font-style: italic;"># to the administrative domain.  Only emails to &quot;local&quot; domains are subject</span>
<span style="color: #666666; font-style: italic;"># to certain functionality, such as the addition of spam tags.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Default local domains to $mydomain and all subdomains.  Remember to</span>
<span style="color: #666666; font-style: italic;"># override or redefine this if $mydomain is changed later in the config</span>
<span style="color: #666666; font-style: italic;"># sequence.</span>
&nbsp;
<span style="color: #0000ff;">@local_domains_acl</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;.$mydomain&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;"># ensure a defined return</span></pre></div></div>

<p>Next step is to add the <strong>clamav</strong> user to the <strong>amavis</strong> group, so that amavis can call clamav</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">adduser clamav amavis</pre></div></div>

<p>Now it's time to configure postfix. The first file to edit is <strong>main.cf</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="xorg_conf" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;"># Amavisd-new</span>
content_filter = amavis:<span class="br0">&#91;</span>127.0.0.1<span class="br0">&#93;</span>:<span style="color: #cc66cc;">10024</span></pre></div></div>

<p>And in <strong>master.conf</strong> add this at the end of file:</p>

<div class="wp_syntax"><div class="code"><pre class="xorg_conf" style="font-family:monospace;">amavis unix - - - - <span style="color: #cc66cc;">2</span> smtp
  -o smtp_data_done_timeout=<span style="color: #cc66cc;">1200</span>
  -o smtp_send_xforward_command=yes
&nbsp;
127.0.0.1:<span style="color: #cc66cc;">10025</span> inet n - - - - smtpd
  -o content_filter=
  -o local_recipient_maps=
  -o relay_recipient_maps=
  -o smtpd_restriction_classes=
  -o smtpd_client_restrictions=
  -o smtpd_helo_restrictions=
  -o smtpd_sender_restrictions=
  -o smtpd_recipient_restrictions=permit_mynetworks,reject
  -o mynetworks=127.0.0.0/<span style="color: #cc66cc;">8</span>
  -o strict_rfc821_envelopes=yes
  -o smtpd_bind_address=127.0.0.1</pre></div></div>

<p>That's all! Now restart services:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>clamav-daemon restart
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>clamav-freshclam restart
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>amavis restart
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>postfix restart</pre></div></div>




Share:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fp0l0.binware.org%2Findex.php%2F2009%2F08%2F08%2Fpostfixamavisd-newspamassasinclamav%2F&amp;partner=sociable" title="Print"><img src="http://p0l0.binware.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fp0l0.binware.org%2Findex.php%2F2009%2F08%2F08%2Fpostfixamavisd-newspamassasinclamav%2F&amp;title=Postfix%2BAmavisd-new%2BSpamassasin%2BClamav&amp;bodytext=Since%20I%20had%20to%20disable%20the%20PTR%20check%20in%20Postfix%20at%20Binware%20because%20in%20Spain%2090%25%20of%20mail%20servers%20are%20badly%20configured%20and%20they%20were%20all%20rejected%2C%20and%20now%20we%20have%20lot%20of%20spam.%0D%0A%0D%0ASo%20I%20decided%20to%20install%20Spamassassin%20and%20Clamav%20to%20detect%20and%20reject%20some" title="Digg"><img src="http://p0l0.binware.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fp0l0.binware.org%2Findex.php%2F2009%2F08%2F08%2Fpostfixamavisd-newspamassasinclamav%2F&amp;title=Postfix%2BAmavisd-new%2BSpamassasin%2BClamav&amp;notes=Since%20I%20had%20to%20disable%20the%20PTR%20check%20in%20Postfix%20at%20Binware%20because%20in%20Spain%2090%25%20of%20mail%20servers%20are%20badly%20configured%20and%20they%20were%20all%20rejected%2C%20and%20now%20we%20have%20lot%20of%20spam.%0D%0A%0D%0ASo%20I%20decided%20to%20install%20Spamassassin%20and%20Clamav%20to%20detect%20and%20reject%20some" title="del.icio.us"><img src="http://p0l0.binware.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fp0l0.binware.org%2Findex.php%2F2009%2F08%2F08%2Fpostfixamavisd-newspamassasinclamav%2F&amp;t=Postfix%2BAmavisd-new%2BSpamassasin%2BClamav" title="Facebook"><img src="http://p0l0.binware.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fp0l0.binware.org%2Findex.php%2F2009%2F08%2F08%2Fpostfixamavisd-newspamassasinclamav%2F&amp;title=Postfix%2BAmavisd-new%2BSpamassasin%2BClamav&amp;annotation=Since%20I%20had%20to%20disable%20the%20PTR%20check%20in%20Postfix%20at%20Binware%20because%20in%20Spain%2090%25%20of%20mail%20servers%20are%20badly%20configured%20and%20they%20were%20all%20rejected%2C%20and%20now%20we%20have%20lot%20of%20spam.%0D%0A%0D%0ASo%20I%20decided%20to%20install%20Spamassassin%20and%20Clamav%20to%20detect%20and%20reject%20some" title="Google Bookmarks"><img src="http://p0l0.binware.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Postfix%2BAmavisd-new%2BSpamassasin%2BClamav&amp;body=http%3A%2F%2Fp0l0.binware.org%2Findex.php%2F2009%2F08%2F08%2Fpostfixamavisd-newspamassasinclamav%2F" title="email"><img src="http://p0l0.binware.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fp0l0.binware.org%2Findex.php%2F2009%2F08%2F08%2Fpostfixamavisd-newspamassasinclamav%2F&amp;title=Postfix%2BAmavisd-new%2BSpamassasin%2BClamav&amp;source=P0L0%26%23039%3Bs+Blog+Opensource+Projects+and+IT+experiences&amp;summary=Since%20I%20had%20to%20disable%20the%20PTR%20check%20in%20Postfix%20at%20Binware%20because%20in%20Spain%2090%25%20of%20mail%20servers%20are%20badly%20configured%20and%20they%20were%20all%20rejected%2C%20and%20now%20we%20have%20lot%20of%20spam.%0D%0A%0D%0ASo%20I%20decided%20to%20install%20Spamassassin%20and%20Clamav%20to%20detect%20and%20reject%20some" title="LinkedIn"><img src="http://p0l0.binware.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://meneame.net/submit.php?url=http%3A%2F%2Fp0l0.binware.org%2Findex.php%2F2009%2F08%2F08%2Fpostfixamavisd-newspamassasinclamav%2F" title="Meneame"><img src="http://p0l0.binware.org/wp-content/plugins/sociable/images/meneame.png" title="Meneame" alt="Meneame" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Postfix%2BAmavisd-new%2BSpamassasin%2BClamav%20-%20http%3A%2F%2Fp0l0.binware.org%2Findex.php%2F2009%2F08%2F08%2Fpostfixamavisd-newspamassasinclamav%2F" title="Twitter"><img src="http://p0l0.binware.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://p0l0.binware.org/index.php/2009/08/08/postfixamavisd-newspamassasinclamav/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
