<?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; postfix</title>
	<atom:link href="http://p0l0.binware.org/index.php/tag/postfix/feed/" rel="self" type="application/rss+xml" />
	<link>http://p0l0.binware.org</link>
	<description>Opensource Projects and IT experiences</description>
	<lastBuildDate>Sun, 30 Oct 2011 08:39:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<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 [...]]]></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&#8217;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&#8217;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>

]]></content:encoded>
			<wfw:commentRss>http://p0l0.binware.org/index.php/2009/08/08/postfixamavisd-newspamassasinclamav/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix+VDA</title>
		<link>http://p0l0.binware.org/index.php/2006/03/05/postfixvda/</link>
		<comments>http://p0l0.binware.org/index.php/2006/03/05/postfixvda/#comments</comments>
		<pubDate>Sun, 05 Mar 2006 00:01:00 +0000</pubDate>
		<dc:creator>P0L0</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[binware]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[quota]]></category>

		<guid isPermaLink="false">http://p0l0.binware.org/index.php/2006/03/05/postfixvda/</guid>
		<description><![CDATA[Esto era una de las cosas que tenia pendiente de poner en el server hosting, y ultimamente ha habido mucha gente que superaba de mucho el limite, asi que me he puesto a configurar e instalar postfix con el parch VDA para poner limite de tamaño a los buzones. Como tengo ahora mismo todo configurado [...]]]></description>
			<content:encoded><![CDATA[<p>Esto era una de las cosas que tenia pendiente de poner en el server hosting, y ultimamente ha habido mucha gente que superaba de mucho el limite, asi que  me he puesto a configurar e instalar postfix con el parch VDA para poner limite de tamaño a los buzones.</p>
<p>Como tengo ahora mismo todo configurado con los paquetes de debian, he pensado que lo mejor es parchear los propios paquetes de debian, y aqui estan los pasos que he seguido:</p>
<ol>
<li>Instalo todas las utilidades necesarias para poder compilar y crear el paquete de postfix.

<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> build-essential dpkg-dev fakeroot debhelper po-debconf dpatch lsb-release libdb4.3-dev libgdbm-dev libldap2-dev libpcre3-dev libmysqlclient15-dev libsasl2-dev libpq-dev</pre></div></div>

</li>
<li>Nos bajamos el codigo fuente del postfix (Conviene hacerlo en /usr/src ya que lo descarga en el directorio actual)

<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: #7a0874; font-weight: bold;">source</span> postfix</pre></div></div>

</li>
<li>Nos bajamos el ultimo parche disponible para nuestra version de <a href="http://web.onda.com.br/nadal/">http://web.onda.com.br/nadal/</a>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>web.onda.com.br<span style="color: #000000; font-weight: bold;">/</span>nadal<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>VDA<span style="color: #000000; font-weight: bold;">/</span>postfix-2.2.8-vda.patch.gz</pre></div></div>

</li>
<li>Parcheamos el codigo

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gunzip</span> postfix-2.2.8-vda.patch.gz
<span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p1</span></pre></div></div>

</li>
<li>Compilamos

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dpkg-buildpackage</pre></div></div>

</li>
<li>Instalamos los paquetes generados

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> postfix_2.2.8-<span style="color: #000000;">9</span>_i386.deb
<span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> postfix-mysql_2.2.8-<span style="color: #000000;">9</span>_i386.deb</pre></div></div>

</li>
<li>Configuramos postfix</li>
</ol>
<ol>
<li>main.cf

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">virtual_mailbox_limit_override</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">yes</span>
#Use IMAP compatible files
<span style="color: #000099;">virtual_maildir_extended</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">yes</span>
#Create maildirsize files
<span style="color: #000099;">virtual_create_maildirsize</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">yes</span>
#Bounce mails overquota
<span style="color: #000099;">virtual_overquota_bounce</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">yes</span>
#MySQL info to get user quota
<span style="color: #000099;">virtual_mailbox_limit_maps</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">mysql:/etc/postfix/quota.cf</span>
#Count Trash
<span style="color: #000099;">virtual_trash_count</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">yes</span>
<span style="color: #000099;">virtual_trash_name</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">.Trash</span></pre></div></div>

</li>
<li>quota.cf

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">user</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">mail</span>
<span style="color: #000099;">password</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">mailpassword</span>
<span style="color: #000099;">dbname</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">mail</span>
<span style="color: #000099;">table</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">users</span>
<span style="color: #000099;">hosts</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">localhost</span>
<span style="color: #000099;">where_field</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">address</span>
<span style="color: #000099;">select_field</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">quota</span></pre></div></div>

</li>
</ol>
<li>Configuramos courier</li>
<ol>
<li>authmysqlrc

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">MYSQL_QUOTA_FIELD quota</pre></div></div>

</li>
</ol>
<p>
Updated (2007/07/12): La nueva URL del patch VDA es http://vda.sourceforge.net/</p>
]]></content:encoded>
			<wfw:commentRss>http://p0l0.binware.org/index.php/2006/03/05/postfixvda/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fracaso con VHCS ;(</title>
		<link>http://p0l0.binware.org/index.php/2005/02/15/fracaso-con-vhcs/</link>
		<comments>http://p0l0.binware.org/index.php/2005/02/15/fracaso-con-vhcs/#comments</comments>
		<pubDate>Tue, 15 Feb 2005 15:05:00 +0000</pubDate>
		<dc:creator>P0L0</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[binware]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[proftpd]]></category>
		<category><![CDATA[vhcs]]></category>

		<guid isPermaLink="false">http://p0l0.binware.org/index.php/2005/02/15/fracaso-con-vhcs/</guid>
		<description><![CDATA[Despues de probar ayer el VHCS me he llevado una decepcion enorme. Tiene muy buena pinta, y hace de todo, pero resulta que es para que tu te adaptes a como funciona el, trae sus propios demonios y configuraciones. Supongo que si no tiene montado nada y empiezas desde cero es muy comodo, pero yo [...]]]></description>
			<content:encoded><![CDATA[<p>Despues de probar ayer el <a href="http://www.vhcs.net/">VHCS</a> me he llevado una decepcion enorme. Tiene muy buena pinta, y hace de todo, pero resulta que es para que tu te adaptes a como funciona el, trae sus propios demonios y configuraciones. Supongo que si no tiene montado nada y empiezas desde cero es muy comodo, pero yo tengo todo montado para que funcione todo en mysql y volver a configurar y pasar a texto es un follon, aparte de la molestia de ir reiniciando los servicios.</p>
<p>Por lo tanto he decido que voy a aprovechar lo que trae el <a href="http://www.vhcs.net/">VHCS</a> y cogerlo como base para diseñarme mi propio panel teniendo <a href="http://gw.netbastards.org/bm/">Bind-Mysql</a>, <a href="http://bulma.net/body.phtml?nIdNoticia=1621">Postfix/Courier-Mysql</a> y <a href="http://www.castaglia.org/proftpd/modules/mod_sql.html">Proftpd-Mysql</a>. Modificar la base de datos es mucho mejor que tener que tocar archivos de sistema y ir dando permisos a programas.</p>
]]></content:encoded>
			<wfw:commentRss>http://p0l0.binware.org/index.php/2005/02/15/fracaso-con-vhcs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

