<?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>apocalypticfail.com</title>
	<atom:link href="http://apocalypticfail.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://apocalypticfail.com</link>
	<description>a blog about stuff and things</description>
	<lastBuildDate>Fri, 10 Jun 2011 20:16:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>bfd script for Kerio Connect</title>
		<link>http://apocalypticfail.com/2011.05.09/bfd-script-for-kerio-connect/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=bfd-script-for-kerio-connect</link>
		<comments>http://apocalypticfail.com/2011.05.09/bfd-script-for-kerio-connect/#comments</comments>
		<pubDate>Tue, 10 May 2011 00:00:10 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[installations]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[apf]]></category>
		<category><![CDATA[bfd]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[kerio connect]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://apocalypticfail.com/?p=104</guid>
		<description><![CDATA[Overview It came to my attention recently that a mailserver I manage for a client was having an unusually high number of login attempts. Since the server runs Kerio Connect rather than exim or sendmail, I normally deal with these manually using a for loop and apf. I did, at one point, take notes with [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Overview</strong></p>
<p>It came to my attention recently that a mailserver I manage for a client was having an unusually high number of login attempts.  Since the server runs <a href="http://www.kerio.com/connect">Kerio Connect</a> rather than exim or sendmail, I normally deal with these manually using a <em>for</em> loop and <em><strong><a href="http://www.rfxn.com/projects/advanced-policy-firewall/">apf</a></strong></em>.  I did, at one point, take notes with the intention of working this into <strong><em><a href="http://www.rfxn.com/projects/brute-force-detection/">bfd</a></strong></em>, however the project never came to fruition.</p>
<p>Today is the day I finally put the work into incorporating this into <strong><em>bfd</em></strong></p>
<p><strong>Details</strong></p>
<p>This was a fairly straightforward process, adapting one of the existing rules files to work with Kerio.  Kerio stores it&#8217;s &#8216;<em>failed login</em>&#8216; information in</p>
<ol><code>/opt/kerio/mailserver/store/logs/warning.log</code></ol>
<p>Generally you will see either:</p>
<ol><code>User user@domain.com doesn't exist. Attempt from IP address 1.2.3.4</code></ol>
<p>or</p>
<ol><code>Invalid password for user user@domain.com.  Attempt from IP address 1.2.3.4</code></ol>
<p><strong>Code</strong></p>
<p>The regex for detecting these patterns was simple and is quite effective.  Simply place the following code in <strong><em>/usr/local/bfd/rules/kerio_connect</em></strong> or capture using wget</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;color: #FCFFBA;"><span style="color: #c20cb9; font-weight: bold;color: #577A61;">wget</span> <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;color: #CCC;">/</span>usr<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>local<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>bfd<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>rules<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>kerio_connect http:<span style="color: #000000; font-weight: bold;color: #CCC;">//</span>scripts.apocalypticfail.com<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>bfd.kerio_connect</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;color: #FCFFBA;"><span style="color: #666666; font-style: italic;"># failed logins from a single address before ban</span>
<span style="color: #666666; font-style: italic;"># uncomment to override conf.bfd trig value</span>
<span style="color: #007800;">TRIG</span>=<span style="color: #ff0000;color: #666666;">&quot;20&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># file must exist for rule to be active</span>
<span style="color: #007800;">REQ</span>=<span style="color: #ff0000;color: #666666;">&quot;/opt/kerio/mailserver/store/logs/warning.log&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;color: #B83A24;">if</span> <span style="color: #7a0874; font-weight: bold;color: #CCC;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;color: #666666;">&quot;<span style="color: #007800;">$REQ</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;color: #CCC;">&#93;</span>; <span style="color: #000000; font-weight: bold;color: #B83A24;">then</span>
 <span style="color: #007800;">LP</span>=<span style="color: #ff0000;color: #666666;">&quot;/opt/kerio/mailserver/store/logs/warning.log&quot;</span>
 <span style="color: #007800;">TLOG_TF</span>=<span style="color: #ff0000;color: #666666;">&quot;kerio_connect&quot;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">## kerio failed passwords and users that do not exist</span>
 <span style="color: #007800;">ARG_VAL</span>=<span style="color: #000000; font-weight: bold;color: #CCC;">`</span><span style="color: #007800;color: blue;">$TLOG_PATH</span> <span style="color: #007800;color: blue;">$LP</span> <span style="color: #007800;color: blue;">$TLOG_TF</span> <span style="color: #000000; font-weight: bold;color: #CCC;">|</span> <span style="color: #c20cb9; font-weight: bold;color: #577A61;">grep</span> <span style="color: #ff0000;color: #666666;">&quot;Attempt from IP&quot;</span> <span style="color: #000000; font-weight: bold;color: #CCC;">|</span> <span style="color: #c20cb9; font-weight: bold;color: #577A61;">sed</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">'s/.*[Uu]ser\ \([^\ ]*\)\ .*Attempt\ from\ IP\ address\ \(.*\)/\2:\1/p'</span><span style="color: #000000; font-weight: bold;color: #CCC;">`</span>
<span style="color: #000000; font-weight: bold;color: #B83A24;">fi</span></pre></div></div>

<p><strong>Testing</strong></p>
<p>If you wish to test this out, you can use the following loops.  Make <strong>certain</strong> that you will still have access to the server once the machine you are testing from is locked out.  For my own testing, I simply tested from another server &#8211; leaving my workstation with access.</p>
<p>Testing <em>failed password</em> attempts, use the following code.  Be sure to replace &#8216;user&#8217; with a username that exists for the <em>kerio_username</em> post variable and your hostname in place of webmail.domain.com:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;color: #FCFFBA;"><span style="color: #000000; font-weight: bold;color: #B83A24;">for</span> i <span style="color: #000000; font-weight: bold;color: #B83A24;">in</span> $<span style="color: #7a0874; font-weight: bold;color: #CCC;">&#40;</span><span style="color: #c20cb9; font-weight: bold;color: #577A61;">seq</span> <span style="color: #000000;color: #DDD;">1</span> <span style="color: #000000;color: #DDD;">100</span><span style="color: #7a0874; font-weight: bold;color: #CCC;">&#41;</span>; <span style="color: #000000; font-weight: bold;color: #B83A24;">do</span> <span style="color: #7a0874; font-weight: bold;color: #8FB394;">echo</span> <span style="color: #ff0000;color: #666666;">&quot;Attempt <span style="color: #007800;">$i</span>&quot;</span>; <span style="color: #c20cb9; font-weight: bold;color: #577A61;">wget</span> <span style="color: #660033;">-O</span> - <span style="color: #660033;">-q</span> <span style="color: #660033;">--post-data</span> <span style="color: #ff0000;">'kerio_username=user&amp;kerio_password=anything'</span> https:<span style="color: #000000; font-weight: bold;color: #CCC;">//</span>webmail.domain.com<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>webmail<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>dologin.php <span style="color: #000000; font-weight: bold;color: #CCC;">&gt;</span> <span style="color: #000000; font-weight: bold;color: #CCC;">/</span>dev<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>null ;<span style="color: #000000; font-weight: bold;color: #B83A24;">done</span></pre></div></div>

<p>Testing <em>invalid user</em> attempts, use the following code &#8211; again replacing webmail.domain.com with your hostname:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;color: #FCFFBA;"><span style="color: #000000; font-weight: bold;color: #B83A24;">for</span> i <span style="color: #000000; font-weight: bold;color: #B83A24;">in</span> $<span style="color: #7a0874; font-weight: bold;color: #CCC;">&#40;</span><span style="color: #c20cb9; font-weight: bold;color: #577A61;">seq</span> <span style="color: #000000;color: #DDD;">1</span> <span style="color: #000000;color: #DDD;">100</span><span style="color: #7a0874; font-weight: bold;color: #CCC;">&#41;</span>; <span style="color: #000000; font-weight: bold;color: #B83A24;">do</span> <span style="color: #7a0874; font-weight: bold;color: #8FB394;">echo</span> <span style="color: #ff0000;color: #666666;">&quot;Attempt <span style="color: #007800;">$i</span>&quot;</span>; <span style="color: #c20cb9; font-weight: bold;color: #577A61;">wget</span> <span style="color: #660033;">-O</span> - <span style="color: #660033;">-q</span> <span style="color: #660033;">--post-data</span> <span style="color: #ff0000;">'kerio_username=anybody&amp;kerio_password=anything'</span> https:<span style="color: #000000; font-weight: bold;color: #CCC;">//</span>webmail.domain.com<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>webmail<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>dologin.php <span style="color: #000000; font-weight: bold;color: #CCC;">&gt;</span> <span style="color: #000000; font-weight: bold;color: #CCC;">/</span>dev<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>null ;<span style="color: #000000; font-weight: bold;color: #B83A24;">done</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://apocalypticfail.com/2011.05.09/bfd-script-for-kerio-connect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handbrake Installation on Ubuntu 9.04 (Jaunty)</title>
		<link>http://apocalypticfail.com/2009.11.27/handbrake-installation-on-ubuntu-9-04-jaunty/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=handbrake-installation-on-ubuntu-9-04-jaunty</link>
		<comments>http://apocalypticfail.com/2009.11.27/handbrake-installation-on-ubuntu-9-04-jaunty/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 22:53:47 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[installations]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[installation]]></category>

		<guid isPermaLink="false">http://apocalypticfail.com/?p=45</guid>
		<description><![CDATA[Overview I read an interesting review today on the software HandBrake. I had not heard of this package before but had recently been researching similar items. Personally, I always used k9copy to make copies of DVDs and to rip to local video files for use on my devices. However, recently I was asked for advice [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Overview</strong></p>
<p>I read an interesting <a href="http://ostatic.com/blog/handbrake-0-9-4-released-with-a-whopping-1-000-changes">review</a> today on the software <a href="http://handbrake.fr/">HandBrake</a>.  I had not heard of this package before but had recently been researching similar items.</p>
<p>Personally, I always used k9copy to make copies of DVDs and to rip to local video files for use on my devices.  However, recently I was asked for advice on a Windows solution.  It seems that HandBrake fits that bill as it is cross-platform between Mac, Windows and Linux.  Of course it states quite specifically that it does not help to crack copyrights.  In my experience, k9copy does this almost without error 99% of the time.</p>
<p>So why would I, a Linux user, use HandBrake rather than k9copy?  Quite simply, I am not a video guru and, while I normally like having many options, sometimes it is frustrating to have to tweak and retweak and re-rip to solve resolution and smoothness issues.  HandBrake seems to have a fine assortment of presets (various qualities for various devices) and also offers a live preview function.</p>
<p>So I decided to give the installation a whirl.  The site offers a download for Ubuntu, however this is for Karmic.  I have not yet switched most of my computers to Karmic (that is a whole article unto itself).  Grabbing the source I proceeded to hack away at it and did finally manage to get the installation completed and running.</p>
<p><strong>Installation</strong></p>
<p>First let&#8217;s install the required packages.  This took a bit of trial and error to figure out completely, but here is is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;color: #FCFFBA;"><span style="color: #c20cb9; font-weight: bold;color: #577A61;">sudo</span> <span style="color: #c20cb9; font-weight: bold;color: #577A61;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;color: #577A61;">install</span> build-essential <span style="color: #c20cb9; font-weight: bold;color: #577A61;">autoconf</span> libtool zlib1g-dev \
libbz2-dev intltool libglib2.0-dev libdbus-glib-<span style="color: #000000;color: #DDD;">1</span>-dev libgtk2.0-dev \
libhal-dev libhal-storage-dev libwebkit-dev libnotify-dev \
libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev yasm</pre></div></div>

<p>Now to get the tar ball, untar, configure and install:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;color: #FCFFBA;"><span style="color: #c20cb9; font-weight: bold;color: #577A61;">wget</span> http:<span style="color: #000000; font-weight: bold;color: #CCC;">//</span>dl.dropbox.com<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>u<span style="color: #000000; font-weight: bold;color: #CCC;">/</span><span style="color: #000000;color: #DDD;">56460</span><span style="color: #000000; font-weight: bold;color: #CCC;">/</span>Handbrake<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>HandBrake-0.9.4.tar.bz2
<span style="color: #c20cb9; font-weight: bold;color: #577A61;">tar</span> <span style="color: #660033;">-jxvf</span> HandBrake-0.9.4.tar.bz2
<span style="color: #7a0874; font-weight: bold;color: #8FB394;">cd</span> HandBrake-0.9.4
.<span style="color: #000000; font-weight: bold;color: #CCC;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;color: #577A61;">make</span>
<span style="color: #c20cb9; font-weight: bold;color: #577A61;">sudo</span> <span style="color: #c20cb9; font-weight: bold;color: #577A61;">make</span> <span style="color: #c20cb9; font-weight: bold;color: #577A61;">install</span></pre></div></div>

<p>Looking at that now, it seems much easier.  Figuring out all the dependencies took some time.</p>
<p>Now to run the application simply run the command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;color: #FCFFBA;">ghb</pre></div></div>

<p>Or the command line client:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;color: #FCFFBA;">HandBrakeCLI</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://apocalypticfail.com/2009.11.27/handbrake-installation-on-ubuntu-9-04-jaunty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>So it has come to this . . .</title>
		<link>http://apocalypticfail.com/2008.11.09/so-it-has-come-to-this/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=so-it-has-come-to-this</link>
		<comments>http://apocalypticfail.com/2008.11.09/so-it-has-come-to-this/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 18:52:04 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[fail]]></category>
		<category><![CDATA[uncertainty]]></category>

		<guid isPermaLink="false">http://apocalypticfail.com/?p=7</guid>
		<description><![CDATA[Having no idea where to begin.  Thoughts have been laboriously spinning yarns of possibilities.  The original idea behind this was so much more than I feel it will be now.  Conceptually it was to be a forum of fail, for your amusement.  Let&#8217;s face it, as sad as it is, some fail can be humorous. [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://apocalypticfail.com/wp-content/uploads/2008/11/be960773e81.jpg"><img class="alignnone size-full wp-image-23" title="help desk" src="http://apocalypticfail.com/wp-content/uploads/2008/11/be960773e81.jpg" alt="" width="500" height="390" /></a></p>
<p>Having no idea where to begin.  Thoughts have been laboriously spinning yarns of possibilities.  The original idea behind this was so much more than I feel it will be now.  Conceptually it was to be a forum of fail, for your amusement.  Let&#8217;s face it, as sad as it is, some fail can be humorous.</p>
<p>At this time, in this society, surely there is no lack of fail.</p>
<p>All that aside, this was going to be my own software, designed from the ground up, to be clean and effiecient.  A mostly flat-file system.  Free time has fallen away so I thought I would try something premade just to see.  Who knows what strange directions this may take.</p>
]]></content:encoded>
			<wfw:commentRss>http://apocalypticfail.com/2008.11.09/so-it-has-come-to-this/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

