<?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>SMTP &#8211; Phocean.net</title>
	<atom:link href="/tag/smtp/feed" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>Computer Security Blog</description>
	<lastBuildDate>Fri, 24 Feb 2017 21:17:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.10</generator>
	<item>
		<title>Dovecot LDA vs Procmail</title>
		<link>/2009/12/09/dovecot-lda-vs-procmail.html</link>
		<comments>/2009/12/09/dovecot-lda-vs-procmail.html#comments</comments>
		<pubDate>Wed, 09 Dec 2009 01:10:17 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Defense]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amavis]]></category>
		<category><![CDATA[Dovecot]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[mta]]></category>
		<category><![CDATA[openSUSE]]></category>
		<category><![CDATA[Postifx]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[Spam]]></category>
		<category><![CDATA[Spamassassin]]></category>
		<category><![CDATA[umask]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=542</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=542</guid>
		<description><![CDATA[I have a mail server configuration based on Postfix for the smtp, Dovecot for the imap and virtual users receiving e-mails in maildir boxes. I am also using Amavis and Spamassassin for content filtering. I am not going now to describe this configuration, I think there are already a lot of very good tutorials about...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2009/12/09/dovecot-lda-vs-procmail.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>I have a mail server configuration based on <strong>Postfix</strong> for the smtp, <strong>Dovecot</strong> for the imap and virtual users receiving e-mails in maildir boxes.</p>
<p>I am also using <strong>Amavis</strong> and <strong>Spamassassin</strong> for content filtering.</p>
<p>I am not going now to describe this configuration, I think there are already a lot of very good tutorials about it all over the web. Moreover, the openSUSE maintainers made such a configuration quite easy : a sensible part of the work just consists in commenting out some line in the configuration files.</p>
<p>However, with the basic setup, I had an issue with permissions :  all e-mails delivered by Postfix were created with permissions set to 600.</p>
<p>A typical use case with which I got into trouble was spam learning, done with a cron script with a dedicated account (&#8220;vscan&#8221;, you don&#8217;t want to execute such a script with root, right ?).</p>
<p>In that case, what I need is files to be created with permissions 660.</p>
<p>It seems easy and rather obvious at first, but actually there is not such a setting in Postfix.</p>
<p>Actually, it is not really the job of the MTA to do it, so in the case of Postfix it doesn&#8217;t bother with the transmission of such a parameter.<br />
Then, I tried to use Procmail and set UMASK in <strong>/etc/procmailrc</strong>, but this just didn&#8217;t have any effect.</p>
<p>After searching and trying in vain a couple of hours, I found out that Dovecot can also deliver e-mails from the MTA to the maildir with Dovecot LDA.</p>
<p>So I tested it out. The configuration is pretty straightforward.</p>
<p>Add the line in bold to the virtual user configuration in <strong>/etc/postfix/main.cf</strong> :</p>
<pre>[...]
virtual_mailbox_domains = domain.com
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_mailbox_base = /home/vmail
virtual_minimum_uid = 100
virtual_gid_maps = static:1002
virtual_uid_maps = static:1001
virtual_transport = dovecot
[...]</pre>
<p>Now, add these lines in <strong>/etc/postfix/master.cf</strong> :</p>
<pre>[...]
# Dovecot LDA
dovecot   unix  -       n       n       -       -       pipe
   flags=DRhu user=vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
[...]</pre>
<p>Finally, configure <strong>/etc/dovecot/dovecot.conf</strong> with these sections :</p>
<pre>[...]
protocol lda {
  # If you wish to use plugins you need to specify plugin directory
  # For example quota enforcing is implemented by plugin
  module_dir = /usr/lib/dovecot/modules/lda
  # Address from LDA should send MDNs like out of quota
  postmaster_address = postmaster@domain.com
  # UNIX socket path to master authentication server to find users.
  auth_socket_path = /var/run/dovecot/auth-master
}
[...]
auth default {
[...]
  socket listen {
	master {
		# Master socket provides access to userdb information. It's typically
		# used to give Dovecot's local delivery agent access to userdb so it
		# can find mailbox locations.
	      	path = /var/run/dovecot/auth-master
      		mode = 0660
		user = vmail
		group = vmail
	}
	client {
		# The client socket is generally safe to export to everyone. Typical use
		# is to export it to your SMTP server so it can do SMTP AUTH lookups
		# using it.
		path = /var/run/dovecot/auth-client
		mode = 0660
	}
  }
}
[...]</pre>
<p>And that&#8217;s all !<br />
Restart Postfix and Dovecot, check the log to ensure that everything works fine.<br />
Now all new mails should come out in the maildir folder with permissions set to 660.</p>
<p>Definitely, in my opinion, Dovecot LDA is the way to go : simple and extensible. Good bye Procmail and your cluttered configuration file.</p>
]]></content:encoded>
			<wfw:commentRss>/2009/12/09/dovecot-lda-vs-procmail.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Postfix : TLS not working outside my network</title>
		<link>/2008/06/11/postfix-tls-not-working-outside-my-network.html</link>
		<pubDate>Tue, 10 Jun 2008 23:37:28 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Defense]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Pix]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=110</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=110</guid>
		<description><![CDATA[As I just finished setting TLS and SASL to secure the access to my Postfix server, I realized that it was working only from inside my network. What I got from my lan : $ telnet mars 25 Trying 192.168.222.10... Connected to phocean.net. Escape character is '^]'. 220 phocean.net ESMTP Postfix (Debian/GNU) ehlo phocean.net 250-phocean.net...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2008/06/11/postfix-tls-not-working-outside-my-network.html">Continue Reading</a></span>]]></description>
		<description><![CDATA[As I just finished setting TLS and SASL to secure the access to my Postfix server, I realized that it was working only from inside my network. What I got from my lan : $ telnet mars 25 Trying 192.168.222.10... Connected to phocean.net. Escape character is '^]'. 220 phocean.net ESMTP Postfix (Debian/GNU) ehlo phocean.net 250-phocean.net...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2008/06/11/postfix-tls-not-working-outside-my-network.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>As I just finished setting TLS and SASL to secure the access to my Postfix server, I realized that it was working only from inside my network.</p>
<p>What I got from my lan :</p>
<pre>$ telnet mars 25
Trying 192.168.222.10...
Connected to phocean.net.
Connected to phocean.net.
Escape character is '^]'.
220 phocean.net ESMTP Postfix (Debian/GNU)
220 phocean.net ESMTP Postfix (Debian/GNU)
ehlo phocean.net
ehlo phocean.net
250-phocean.net
250-phocean.net
250-PIPELINING
250-SIZE 200000000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH NTLM DIGEST-MD5 CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN</pre>
<p>I shows well that the TLS handshake is initiated.</p>
<p>But from this outside, I just got this weired thing :</p>
<pre>$ telnet phocean.net 25
<pre>$ telnet phocean.net 25
Trying 81.64.194.119...
Connected to phocean.net.
Connected to phocean.net.
Escape character is '^]'.
220 **********************************************
ehlo phocean.net
ehlo phocean.net
502 5.5.2 Error: command not recognized</pre>
<p>Of course, the firewall, a Cisco Pix one, was properly set to redirect port 25 UDP/TCP to my server.</p>
<p>However, I soon focused my effort on this equipment. I considered a while that the cause could be some filtering from my provider, but most probably, the problem came from the Pix.</p>
<p>That was not difficult to figure out : it had some protocol inspector activated for SMTP :</p>
<pre>$ sh ru
[...]
fixup protocol smtp 25
[...]</pre>
<p>Just after :</p>
<pre>&gt; no fixup protocol smtp 25</pre>
<p>&#8230; it started to work perfectly well !!!</p>
<p>The engine for the SMTP protocol could not recognize the TLS handshake, considered that the SMTP session as not valid and therefore blocked it !</p>
<p>I can deactivate it without any fear as my Postfix server is already pretty well secured, or at least configured to reject any weired SMTP dialog.</p>
]]></content:encoded>
			</item>
		<item>
		<title>Postfix : &#8220;error writing message: File too large&#8221;</title>
		<link>/2008/06/01/postfix-error-writing-message-file-too-large.html</link>
		<comments>/2008/06/01/postfix-error-writing-message-file-too-large.html#comments</comments>
		<pubDate>Sun, 01 Jun 2008 21:13:49 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[System]]></category>
		<category><![CDATA[Mailbox]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=108</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=108</guid>
		<description><![CDATA[I suddenly started to received some undelivered mail notifications while I was trying to send some messages to a mailbox hosted on my Postfix server. The cause described in the notification was : error writing message: File too large The first thing I did was checking my configuration file, main.cf. It seemed all right :...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2008/06/01/postfix-error-writing-message-file-too-large.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>I suddenly started to received some undelivered mail notifications while I was trying to send some messages to a mailbox hosted on my Postfix server.</p>
<p>The cause described in the notification was :</p>
<pre>error writing message: File too large</pre>
<p>The first thing I did was checking my configuration file,<strong> main.cf</strong>.<br />
It seemed all right :</p>
<pre>[...]
mailbox_size_limit = 0
message_size_limit = 200000000
[...]</pre>
<p>Note that &#8220;0&#8221; means unlimited.<br />
I checked the mailbox in question : it was nearing the size of 50 Mb.</p>
<p>I started to think that during some Postfix update, the meaning of the value &#8220;0&#8221; may have changed.<br />
I tried different values without success.</p>
<p>I started to become crazy with that, but, finally, after quite a long time spent on google, I finally found <a href="http://www.howtoforge.com/forums/showthread.php?t=1325">the trick</a>, which is just a simple line to add in <strong>main.cf</strong> :</p>
<pre>virtual_mailbox_limit = 0</pre>
<p>Indeed, I use virtual users as mail account ! I just never imagined there was a differtent setting for virtual users (which can be a convenient setting in some case).</p>
]]></content:encoded>
			<wfw:commentRss>/2008/06/01/postfix-error-writing-message-file-too-large.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
