<?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>sysmonk blog &#187; postfix</title>
	<atom:link href="http://www.fw.lt/category/it/postfix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fw.lt</link>
	<description>me and my big mouth</description>
	<lastBuildDate>Tue, 17 Nov 2009 10:49:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>postfix being DDoS&#8217;ed</title>
		<link>http://www.fw.lt/2008/07/10/postfix-being-ddosed/</link>
		<comments>http://www.fw.lt/2008/07/10/postfix-being-ddosed/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 07:06:09 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://www.fw.lt/?p=27</guid>
		<description><![CDATA[Last night i had a pleasure of seeing nagios scream about one of my mail servers load. When i ssh&#8217;ed to the box the load was at 104, ouch. A quick tail -f /var/log/messages showed me the problem &#8211; i&#8217;m being DDoS&#8217;ed. My screen couldn&#8217;t handle all that output &#8211; ~500 connections /s, which makes [...]]]></description>
			<content:encoded><![CDATA[<p>Last night i had a pleasure of seeing nagios scream about one of my mail servers load.</p>
<p>When i ssh&#8217;ed to the box the load was at 104, ouch. A quick tail -f /var/log/messages showed me the problem &#8211; i&#8217;m being  DDoS&#8217;ed. My screen couldn&#8217;t handle all that output &#8211; ~500 connections /s, which makes it two-three times more log lines in the maillog ;(<span id="more-27"></span></p>
<p>So, what to do now?</p>
<p>Postfix has a great service called anvil. anvil tracks connectivity statistics like how much times did this IP connect to your SMTP server, how much mails did it send, how much recipients did it supply and how much TLS (SSL) sessions did it start. Also, you can limit theese params.</p>
<p>In example, setting smtpd_client_message_rate_limit to 10 limits the messages an server can send to you to 10 per minute ( time unit can be changed ).</p>
<p>So, i quickly set smtpd_client_connection_rate_limit to 50, this limits 50 connections per minute from one host. When a servers goes over this limit, postfix doesn&#8217;t accept the connection and makes a log entry about it. I.e.:</p>
<p><em>Jul  9 22:28:26 server postfix/smtpd[13310]: warning: Connection rate limit exceeded: 107 from unknown[88.245.165.205] for service smtp</em></p>
<p>After a few seconds i could already see this kind of entries in my log.</p>
<p>Now, that still makes my postfix do some work and although the load dropped drastically, it still had to do some work.</p>
<p>So, dropping the connections from those IP&#8217;s on the firewall is the best way ( better would be doing it on the core router ).</p>
<p>A quick one-liner does it well:</p>
<p><strong>tail -f /var/log/maillog | perl -ne &#8216;if (/rate limit exceeded: \d+ from .*\[(.*)\] for service/) {system(sprintf(&#8220;your_firewall_add_block_cmd %s\n&#8221;,$1));}&#8217;</strong></p>
<p>Hooray, a few minutes later load decreased to the usual one.</p>
<p>Overall it took ~10 minutes to stop the DDoS, although it was a small one.</p>
<p>In other words &#8211; postfix for the win! <img src='http://www.fw.lt/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.fw.lt/2008/07/10/postfix-being-ddosed/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Book of Postfix: State-of-the-art Message Transport</title>
		<link>http://www.fw.lt/2008/06/30/the-book-of-postfix-state-of-the-art-message-transport/</link>
		<comments>http://www.fw.lt/2008/06/30/the-book-of-postfix-state-of-the-art-message-transport/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 20:59:43 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[postfix]]></category>
		<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://www.fw.lt/?p=23</guid>
		<description><![CDATA[Today I have finished reading The Book of Postfix &#8211; State-of-the-Art Message Transport by Ralf Hildebrandt and Patric Koetter. It took me almost a month to read it, the book has 496 pages, and i was reading it while going to work and back home. I could say that i am more than average postfix [...]]]></description>
			<content:encoded><![CDATA[<p>Today I have finished reading <a title="The Book of Postfix - State-of-the-Art Message Transport website" href="http://www.postfix-book.com" target="_blank"><em>The Book of Postfix &#8211; State-of-the-Art Message Transport</em></a> by <strong>Ralf Hildebrandt</strong> and <strong>Patric Koetter</strong>. It took me almost a month to read it, the book has 496 pages, and i was reading it while going to work and back home.</p>
<p>I could say that i am more than average postfix user and know it quite well. I am managing quite big mail servers ( a few million mails per day, &gt;= 100k mailboxes ) and give free support in #postfix @ <a title="Freenode IRC network" href="http://www.freenode.net" target="_blank">freenode</a> ( but i always like if i get something in return! ).</p>
<p>I liked the book &#8211; i did learn a few things from it, although i don&#8217;t know if their up to date, so i will have to check it out. Most useful chapters i found are:</p>
<ul>
<li>Chapter 19: A Company Mail Server</li>
<li>Chapter 22: Performance Tuning</li>
</ul>
<p>Overall, i did like the book and i will definitely offer it to my friends who want to start with postfix.</p>
<p>I really wish there would be some info on stuff like milters and delivery slots in this book, as i am not familiar with it yet and would really like to read more about it.</p>
<p>I give the book a 9 (because it missed the milters, delivery slots and etc.).</p>
<p>Great work Patrick &amp;&amp; Ralf, and thanks Roman123 for sending me the book.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fw.lt/2008/06/30/the-book-of-postfix-state-of-the-art-message-transport/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Books &#8211; Absolute FreeBSD and The Book of PF</title>
		<link>http://www.fw.lt/2008/06/27/books-absolute-freebsd-and-the-book-of-pf/</link>
		<comments>http://www.fw.lt/2008/06/27/books-absolute-freebsd-and-the-book-of-pf/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 11:16:46 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://www.fw.lt/?p=16</guid>
		<description><![CDATA[Ah, at last, on Wednesday i&#8217;ve received two books. I&#8217;ve helped out Kyle Keith with his postfix and amavisd problem and he sent me those books as a gift. Brand new books from amazon! The Book of PF Absolute FreeBSD Thanks again Kyle!!!]]></description>
			<content:encoded><![CDATA[<p>Ah, at last, on Wednesday i&#8217;ve received two books. I&#8217;ve helped out Kyle Keith with his postfix and amavisd problem and he sent me those books as a gift. Brand new books from amazon!</p>
<p>The Book of PF</p>
<p><a rel="lightbox[books]" href="http://www.fw.lt/wp-content/uploads/2008/06/book_of_pf.jpg"><img class="alignnone size-thumbnail wp-image-18" title="The Book of PF" src="http://www.fw.lt/wp-content/uploads/2008/06/book_of_pf-150x150.jpg" alt="The Book of PF " width="150" height="150" /></a></p>
<p>Absolute FreeBSD</p>
<p><a rel="lightbox[books]" href="http://www.fw.lt/wp-content/uploads/2008/06/absolute_freebsd_2nd.jpg"><img class="alignnone size-thumbnail wp-image-17" title="Absolute FreeBSD" src="http://www.fw.lt/wp-content/uploads/2008/06/absolute_freebsd_2nd-150x150.jpg" alt="Absolute FreeBSD" width="150" height="150" /></a></p>
<p>Thanks again Kyle!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fw.lt/2008/06/27/books-absolute-freebsd-and-the-book-of-pf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
