<?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>bits &#124; andy smith&#039;s blog</title>
	<atom:link href="http://andys.org.uk/bits/feed/" rel="self" type="application/rss+xml" />
	<link>http://andys.org.uk/bits</link>
	<description>geeky yorkshireman abroad</description>
	<lastBuildDate>Mon, 10 Dec 2012 05:32:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Bridged interfaces with Vagrant</title>
		<link>http://andys.org.uk/bits/2012/12/09/bridged-interfaces-with-vagrant/</link>
		<comments>http://andys.org.uk/bits/2012/12/09/bridged-interfaces-with-vagrant/#comments</comments>
		<pubDate>Mon, 10 Dec 2012 04:59:41 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[bridging]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[vagrant]]></category>
		<category><![CDATA[virtualisation]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=182</guid>
		<description><![CDATA[<p>It took me a while to work out how to specify the bridged interface in Vagrant&#8216;s Vagrantup file so that it doesn&#8217;t prompt you for it when you run vagrant up. I can be dumb at times, so it&#8217;s probably just me, but in case you don&#8217;t know Ruby syntax (like me), this is how [...]]]></description>
				<content:encoded><![CDATA[<p>It took me a while to work out how to specify the bridged interface in <a href="http://www.vagrantup.com/">Vagrant</a>&#8216;s <code>Vagrantup</code> file so that it doesn&#8217;t prompt you for it when you run <code><strong>vagrant up</strong></code>. I can be dumb at times, so it&#8217;s probably just me, but in case you don&#8217;t know Ruby syntax (like me), this is how you do it. In your <code><strong>Vagrantup</strong></code> file, assuming eth0 is the interface you want to bridge to, specify it like this:-</p>
<pre>config.vm.network :bridged, :bridge =&gt; "eth0"</pre>
<p>That&#8217;s it! If you&#8217;re not familiar with Vagrant, it&#8217;s a tool written in Ruby to provide a fast way to deploy virtual machines with VirtualBox. For more information, have a look at the <a href="http://vagrantup.com/v1/docs/getting-started/index.html">overview over on the project&#8217;s website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2012/12/09/bridged-interfaces-with-vagrant/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Far from home</title>
		<link>http://andys.org.uk/bits/2012/10/07/far-from-home/</link>
		<comments>http://andys.org.uk/bits/2012/10/07/far-from-home/#comments</comments>
		<pubDate>Mon, 08 Oct 2012 03:52:10 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Canada]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=174</guid>
		<description><![CDATA[<p>It&#8217;s hard to believe it&#8217;s been nearly three months since I left the UK, but it is. On July 20th I left Manchester, where yet again it was raining (which will surprise precisely nobody, at all, ever) on a 9 hour flight to Vancouver and then a short hop onwards to Victoria. Starting from scratch [...]]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s hard to believe it&#8217;s been nearly three months since I left the UK, but it is. On July 20th I left Manchester, where yet again it was raining (which will surprise precisely nobody, at all, ever) on a 9 hour flight to Vancouver and then a short hop onwards to Victoria. Starting from scratch has been a bit weird &#8211; to put it mildly &#8211; and it&#8217;s rounded off an even weirder 12 months.</p>
<p>It&#8217;s hard to say what the biggest difference between here and the UK is &#8211; being a (mostly) English-speaking country tends to lull you into a false sense of things. I&#8217;ve so far managed to get used to driving on the right without any major trauma other than spending the first week punching the door with my left hand looking for a gear stick that isn&#8217;t there, although turning right on a red still makes me feel like I&#8217;m being naughty.</p>
<p>One of the more wonderfully amusing things though is the use of different words and phrases for things. I&#8217;ve had quizzical looks using the words &#8216;hoover&#8217;, &#8216;junction&#8217;, &#8216;car park&#8217;, &#8216;settee&#8217;, &#8216;skip&#8217; and the phrase &#8216;knocked up&#8217; which I should have seen coming a mile off.</p>
<p>The things that still blow my mind though are a) the scenery and b) just how big the country is. I could drive the equivalent of the the length of the UK and still be in BC, and for someone who comes from a country that you can drive across in a few hours, that&#8217;s insane.</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2012/10/07/far-from-home/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The countdown begins</title>
		<link>http://andys.org.uk/bits/2012/06/18/the-countdown-begins/</link>
		<comments>http://andys.org.uk/bits/2012/06/18/the-countdown-begins/#comments</comments>
		<pubDate>Sun, 17 Jun 2012 23:27:08 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Canada]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=165</guid>
		<description><![CDATA[<p>Last week I handed in my notice, and I&#8217;ll be leaving C&#38;W Worldwide after nearly 9 years. I joined back in October 2003 when it was still Energis, and 4 jobs later I&#8217;m now about to leave.</p> <p>My last day will be the Friday the 13th of July, amusingly enough for the superstitious. I have [...]]]></description>
				<content:encoded><![CDATA[<p>Last week I handed in my notice, and I&#8217;ll be leaving C&amp;W Worldwide after nearly 9 years. I joined back in October 2003 when it was still Energis, and 4 jobs later I&#8217;m now about to leave.</p>
<p>My last day will be the Friday the 13th of July, amusingly enough for the superstitious. I have the best part of a week off before I then travel to Victoria to start as a Systems Engineer within the Ops team at AbeBooks.</p>
<p>Stay tuned&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2012/06/18/the-countdown-begins/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Things are about to get very interesting</title>
		<link>http://andys.org.uk/bits/2012/05/25/things-are-about-to-get-very-interesting/</link>
		<comments>http://andys.org.uk/bits/2012/05/25/things-are-about-to-get-very-interesting/#comments</comments>
		<pubDate>Fri, 25 May 2012 03:01:00 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Canada]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=166</guid>
		<description><![CDATA[<p>My last post talked about my then-impending trip to Canada, and I&#8217;m happy to say that I made it back in one piece, although I was pretty sick of airports and planes afterwards. Heathrow greeted me with that familiar grey drizzle before my final hop back up to Manchester where &#8211; and I&#8217;m as surprised [...]]]></description>
				<content:encoded><![CDATA[<p>My <a href="http://andys.org.uk/bits/2012/04/16/1-man-6-airports-and-a-11500-mile-round-trip/">last post</a> talked about my then-impending trip to Canada, and I&#8217;m happy to say that I made it back in one piece, although I was pretty sick of airports and planes afterwards. Heathrow greeted me with that familiar grey drizzle before my final hop back up to Manchester where &#8211; and I&#8217;m as surprised as anyone &#8211; it wasn&#8217;t raining. Victoria was lovely &#8211; more so than I expected, and bar a bit of rain one day I seemed to get lucky with the weather. I managed to not break my camera, so there&#8217;s a few pictures up on <a href="http://www.flickr.com/photos/andymsmith/sets/72157629858057017/">Flickr</a>.</p>
<p>The interviews (yes, plural &#8211; I had four!) seemed to go well. I got to meet a lot of the staff, including most of the people who I would be working with, who were all brilliant at putting me at ease and letting me babble on about myself. I left after spending most of the day there with a genuine feeling that it would be a cracking place to work.</p>
<p>After a few more days sightseeing in and around Victoria, I made the return trip back across the Atlantic. The day after I got back, I got a phone call to offer me the job. It was about 6pm, but my body had no idea where it was, so as you can imagine the rambling on was embarrassingly in full effect&#8230;</p>
<p>So, I&#8217;ve accepted the job, and I&#8217;m now ridiculously excited. If you know me, you&#8217;re probably laughing at that notion, but I assure you &#8211; I did get a bit giddy. Almost a month on, and I&#8217;m now in the midst of the unavoidable bureaucratic process of work permits and working out what to do with&#8230; well, <em>everything</em>. It&#8217;s exciting, anxiety-inducing and downright terrifying all in one go. I&#8217;m pretty certain it&#8217;ll put ten years on me by the time it&#8217;s sorted&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2012/05/25/things-are-about-to-get-very-interesting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>1 man, 6 airports and a 11,500 mile round trip</title>
		<link>http://andys.org.uk/bits/2012/04/16/1-man-6-airports-and-a-11500-mile-round-trip/</link>
		<comments>http://andys.org.uk/bits/2012/04/16/1-man-6-airports-and-a-11500-mile-round-trip/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 00:39:34 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Canada]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=157</guid>
		<description><![CDATA[<p>In a little over two days&#8217; time I&#8217;ll be boarding a plane in Manchester on the first leg of a 3-flight trip to Victoria in British Columbia, via Frankfurt and Vancouver. Then, 4 days later I&#8217;ll coming back again &#8211; this time through San Francisco and Heathrow, and in the process doubling the amount of [...]]]></description>
				<content:encoded><![CDATA[<p>In a little over two days&#8217; time I&#8217;ll be boarding a plane in Manchester on the first leg of a 3-flight trip to Victoria in British Columbia, via Frankfurt and Vancouver. Then, 4 days later I&#8217;ll coming back again &#8211; this time through San Francisco and Heathrow, and in the process doubling the amount of airports I&#8217;ve ever flown from in the space of just under a week.</p>
<p>Many of the people I&#8217;ve mentioned it to have said that I&#8217;m nuts. They&#8217;re correct, but there&#8217;s a purpose to all this catapulting around in a metal tube: I&#8217;ve got a job interview.</p>
<p>After a handful of &#8216;phone interviews, an online technical test and a scripting assignment, I&#8217;ve been asked to fly over for a panel interview. To say I&#8217;m nervous would be an understatement &#8211; I&#8217;ve not had a job interview at an external company for nearly nine years, so I&#8217;ve spent a considerable amount of time preparing for this. I&#8217;ve also never been to Canada before &#8211; I joked the other day that the furthest west I&#8217;ve ever been is Cornwall. Travelled I am not.</p>
<p>It&#8217;s a given that I hope it goes well, but whatever the outcome it will be an experience I&#8217;ve not had before and may not get again. I&#8217;ll have a couple of days to have a wander around Victoria, so the DSLR will definitely be getting a spot in my rucksack.</p>
<p>Fingers crossed&#8230;<br />
<span id="more-157"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2012/04/16/1-man-6-airports-and-a-11500-mile-round-trip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ca-mgmt &#8211; a simple CA management tool</title>
		<link>http://andys.org.uk/bits/2012/03/21/ca-mgmt-a-simple-ca-management-tool/</link>
		<comments>http://andys.org.uk/bits/2012/03/21/ca-mgmt-a-simple-ca-management-tool/#comments</comments>
		<pubDate>Wed, 21 Mar 2012 00:39:41 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[ca]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=137</guid>
		<description><![CDATA[<p>After reading Kees Leune&#8216;s guide to setting up a CA here, I thought it&#8217;d be handy to script a lot of the legwork involved. The end result after a day or two&#8217;s hacking about is ca-mgmt.</p> <p>Bug reports, feature requests, etc. are more than welcome to the usual address, or to the Github Issues page.</p> [...]]]></description>
				<content:encoded><![CDATA[<p>After reading <a href="http://www.leune.org/blog/kees/">Kees Leune</a>&#8216;s guide to setting up a CA <a href="http://www.leune.org/blog/kees/pages/ca.html">here</a>, I thought it&#8217;d be handy to script a lot of the legwork involved. The end result after a day or two&#8217;s hacking about is <strong><a href="https://github.com/m0vkg/ca-mgmt">ca-mgmt</a></strong>.</p>
<p>Bug reports, feature requests, etc. are more than welcome to the <a href="mailto:andy@m0vkg.org.uk?Subject=ca-mgmt">usual address</a>, or to the Github <a href="https://github.com/m0vkg/ca-mgmt/issues">Issues</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2012/03/21/ca-mgmt-a-simple-ca-management-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Prelude to better things &#8211; Open Source and IDS</title>
		<link>http://andys.org.uk/bits/2012/01/21/a-prelude-to-better-things-open-source-and-ids/</link>
		<comments>http://andys.org.uk/bits/2012/01/21/a-prelude-to-better-things-open-source-and-ids/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 03:35:45 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[ids]]></category>
		<category><![CDATA[ips]]></category>
		<category><![CDATA[prelude]]></category>
		<category><![CDATA[snort]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=139</guid>
		<description><![CDATA[<p>A recent number of attempted break-ins to a few machines I manage has had me thinking again about the overall security of the machines, and how to get a better handle on what&#8217;s going on. This isn&#8217;t something new &#8211; anyone managing internet-facing systems ought to be aware of the dangers, and how to mitigate [...]]]></description>
				<content:encoded><![CDATA[<p>A recent number of attempted break-ins to a few machines I manage has had me thinking again about the overall security of the machines, and how to get a better handle on what&#8217;s going on. This isn&#8217;t something new &#8211; anyone managing internet-facing systems ought to be aware of the dangers, and how to mitigate them. As with many things related to open source, there are a plethora of tools out there aimed at providing alerting based on network activity.</p>
<p>I&#8217;d wager that many people have heard of <a href="http://www.snort.org/">Snort</a>, and what it does. For those who aren&#8217;t familiar with it, it&#8217;s an open source intrusion detection system (IDS)/intrusion prevention system (IPS). In a normal configuration, Snort monitors traffic and alerts based on predefined rules for such things as port scans and maliciously-crafted HTTP requests. It&#8217;s an extremely powerful tool that is also highly configurable, and with an excellent community that provide custom rules for a wide variety of situations. But alerting is one thing &#8211; being able to make sense of those alerts is something else.</p>
<h2><span id="more-139"></span>Prelude</h2>
<p><a href="http://www.prelude-technologies.com/en/solutions/universal-siem/index.html">Prelude</a> is a <a href="http://en.wikipedia.org/wiki/Security_information_management">security information management</a> (or SIM) system &#8211; that is, it&#8217;s designed to aggregate and correlate events from tools like Snort and provide a centralised place to manage those events. On its own, this is useful, but coupled with a few additional tools it really becomes something else.</p>
<p>The main prerequisite for our setup is to MySQL, so if you don&#8217;t already have it installed, go ahead and do so. Most Linux distributions include Prelude in their repositories, so installing it should be pretty straightforward. I use Debian, so once MySQL is installed and working, installing the <strong>manager</strong> is a case of running the following:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>apt-get install prelude-manager</strong></pre>
<p>Follow the on-screen debconf prompts regarding the database &#8211; one thing to note that I discovered on squeeze is that if I let debconf generate a password for the prelude database user, that password wasn&#8217;t written to the prelude configuration. Since debconf doesn&#8217;t output the password it&#8217;s generated, this means you&#8217;ll have no idea of the password. Therefore, I recommend picking a password yourself.</p>
<p>Next, it will generate a 2048-bit RSA key for the manager. This can take a while, and on a quiet server will take a few minutes at least. Generating disk I/O is how I usually increase the amount of entropy for the key generation &#8211; running <strong>find / &gt;/dev/null</strong> works well in this situation I&#8217;ve found.</p>
<p>By default, prelude-manager will refuse to start, because it&#8217;s disabled in <strong>/etc/default/prelude-manager</strong>. Edit it, and change <strong>RUN=no</strong> to <strong>RUN=yes</strong>. Next make sure that the database configuration in <strong>/etc/prelude-manager/prelude-manager.conf</strong> is correct &#8211; especially regarding my note earlier about auto-generated passwords.</p>
<p>When you&#8217;re happy the configuration is correct, start prelude-manager:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>/etc/init.d/prelude-manager start</strong></pre>
<p>If everything is okay, prelude-manager will start.</p>
<h2>Putting it to work</h2>
<p>We now have a running prelude-manager instance. But on its own, this is pretty useless &#8211; no events are being sent to it, so there&#8217;s nothing for it to do. Let&#8217;s fix that by installing a sensor &#8211; Snort.</p>
<p>Again, installing Snort should be straightforward:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>apt-get install snort</strong></pre>
<p>As before, follow the debconf prompts. Unlike <strong>prelude-manager</strong>, snort will be started automatically after install. A quick glance at /var/log/snort will reveal a file named alert and possibly a number of tcpdump.log files. This is how Snort by default saves alerts, with the tcpdump.log files being captures associated with those alerts. But since we&#8217;re talking about Prelude, let&#8217;s get the alerts sent there.</p>
<p>The first step is to register Snort with prelude-manager, so that prelude-manager knows about it. We can do this with the prelude-admin command:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prelude-admin register "snort" "idmef:w" 127.0.0.1 --uid 106 --gid 106</strong></pre>
<p>You&#8217;ll notice that I passed the UID and GID of the snort to prelude-admin. By default, the snort has both a UID and GID of 106, but do check this before running it. The other options are the name of the agent (<strong>&#8220;snort&#8221;</strong>), the permissions (<strong>&#8220;idmef:w&#8221;</strong>) and the IP address of the server running <strong>prelude-manager</strong>. The name can be anything, as long as this matches the name used in the Snort configuration, and the &#8216;idmef:w&#8217; refers to the <a href="http://en.wikipedia.org/wiki/IDMEF">Intrusion Detection Message Exchange Format</a>, and that we want to give Snort write permissions. Finally, because we&#8217;re running Snort on the same server as the one running prelude-manager, we use 127.0.0.1 as the host.</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prelude-admin register "snort" "idmef:w" 127.0.0.1 --uid 106 --gid 106</strong>
Generating 2048 bits RSA private key... This might take a very long time.
[Increasing system activity will speed-up the process].
Generation in progress... X..+++++O.+++++O</pre>
<pre>You now need to start "prelude-admin" registration-server on 127.0.0.1:
example: "prelude-admin registration-server prelude-manager"</pre>
<pre>Enter the one-shot password provided on 127.0.0.1:</pre>
<p>Once again, an RSA key is generated, but this time for the sensor, so now might be a good time to go and make a cuppa. Once the key has been generated, you&#8217;ll be prompted (as above) for a &#8216;one-shot password&#8217; to authenticate it to <strong>prelude-manager</strong>. At this point, open a new session to the server running prelude-manager and run prelude-manager as directed by the above:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prelude-admin registration-server prelude-manager</strong>
The "<span style="color: #ff0000;">8qovmgff</span>" password will be requested by "prelude-admin register"
in order to connect. Please remove the quotes before using it.</pre>
<pre>Generating 1024 bits Diffie-Hellman key for anonymous authentication...
Waiting for peers install request on 0.0.0.0:5553...
Waiting for peers install request on :::5553...</pre>
<p>Make a note of the password (in our example, <strong><span style="color: #ff0000;">8qovmgff</span></strong>), switch back to our first session, and provide it at the prompt:-</p>
<pre>Enter the one-shot password provided on 127.0.0.1: <strong><em><span style="color: #ff0000;">8qovmgff</span></em></strong>
Confirm the one-shot password provided on 127.0.0.1: <strong><em><span style="color: #ff0000;">8qovmgff</span></em></strong></pre>
<pre>Connecting to registration server (127.0.0.1:5553)... Authentication succeeded.</pre>
<p>Switch again to the second session, and accept the registration:-</p>
<pre>Connection from 127.0.0.1:40123...
Registration request for analyzerID="2783582516549275" permission="idmef:w".
Approve registration? [y/n]: <strong>y</strong>
127.0.0.1:40123 successfully registered.</pre>
<p>Snort is now registered as an sensor with prelude-manager.</p>
<p>The next step is to tell Snort to send its output to Prelude. Edit <strong>/etc/snort/snort.conf</strong>, and look for the following line:-</p>
<pre># output alert_prelude: profile=snort-profile-name</pre>
<p>Uncomment it, and change the profile name to snort:-</p>
<pre>output alert_prelude: profile=<strong>snort</strong></pre>
<p>Save the config, and restart snort:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>/etc/init.d/snort restart</strong>
Stopping Network Intrusion Detection System : snort (eth0 ...done).
Starting Network Intrusion Detection System : snort (eth0 using /etc/snort/snort.conf ...done).</pre>
<h2>Making sense of it all</h2>
<p>All being well, Snort should now be sending events to Prelude. But we still don&#8217;t have any visibility of these alerts&#8230; which is where <a href="http://freecode.com/projects/prewikka">Prewikka</a> comes in.</p>
<p>Prewikka is a graphical front-end to Prelude &#8211; more specifically, to the database that <strong>prelude-manager</strong> uses. Again, there&#8217;s a package in Debian for this, so go ahead and install it:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>apt-get install prewikka</strong></pre>
<p>As with prelude-manager, follow the debconf prompts regarding database setup. Once completed, Prewikka will have its own database, but you&#8217;ll also need to give it the details for prelude-manager&#8217;s database. Edit <strong>/etc/prewikka/prewikka.conf</strong>, and edit the settings under the <strong>[idmef_database]</strong> section. Save and exit the config, and start Prewikka:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prewikka-httpd &amp;</strong></pre>
<p><img class="alignright size-medium wp-image-140" style="margin-left: 10px; margin-right: 10px;" title="Prewikka - Main screen" src="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka1-300x170.png" alt="" width="300" height="170" /></p>
<p>By default, Prewikka listens on port 8000, so point your browser at <strong>http://<em>&lt;server&gt;</em>:8000/</strong>. The default username and password is <strong>admin</strong> and <strong>admin</strong>, so go ahead and log in. You&#8217;ll then be presented with the main event viewer, which should be similar to the screenshot to the right.</p>
<p>Running Prewikka in this way uses its own built-in webserver, but within the package a <strong>prewikka.cgi</strong> file is provided, which can be served by your favourite webserver of choice as a traditional CGI executable.</p>
<p>Now, before taking the screenshot to the right I cheated a little. I ran a quick nmap against the server to generate some events as an example, but in the absence of any events you can still check that snort is communicating with <strong>prelude-manager</strong>. Click on the <strong>Agents</strong> link in the menu, and there should be an entry for the server. Click on it once to expand it, and then on the Total box to expand the sensors. If everything is configured correctly, Snort should appear in the listing:-</p>
<p><a href="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka-agents.png"><img class="aligncenter size-full wp-image-141" title="Prewikka Sensors" src="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka-agents.png" alt="" width="703" height="159" /></a></p>
<p style="text-align: left;">Prewikka allows you to filter and sort the events displayed, so now would be a good time to have a play about with it. Clicking on an alert will let you view the details of that alert, and because the events at the moment are from Snort, all the relevant alert information that Snort would have logged to <strong>/var/log/snort/alert</strong> should be available.</p>
<h2 style="text-align: left;">Add logs, and sprinkle in a bit of correlation</h2>
<p>So now we have working Prelude and Snort installs, with the two working together and a nice front-end to view them through. While nice to look at, we&#8217;re missing one of the things that all good IDS tools have, which is correlation.</p>
<p>Before going any further, let&#8217;s install two more Prelude packages &#8211; <strong>prelude-lml</strong> (Prelude Log Agent) and <strong>prelude-correlator</strong>:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>apt-get install prelude-lml prelude-correlator</strong></pre>
<p>On my squeeze install, the post-install script for prelude-lml exits with an error because the service is initially disabled. This is fixed in a later version, but it&#8217;s something to look out for. For now, ignore the error &#8211; after we&#8217;ve configured it we can pacify dpkg&#8230;</p>
<p>Because <strong>prelude-lml</strong> and <strong>prelude-correlator</strong> are sensors themselves, we&#8217;ll need to register them with <strong>prelude-manager</strong> in the same way that we did for Snort with the <strong>prelude-admin</strong> command:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prelude-admin register "prelude-lml" "idmef:w" 127.0.0.1 --uid 0 --gid 0</strong>
<em>...output from prelude-admin...</em>
root@dev-vm-lnxd-01:~# <strong>prelude-admin register "prelude-correlator" "idmef:rw" 127.0.0.1 --uid 0 --gid 0</strong>
<em>...output from prelude-admin...</em></pre>
<p>As before, you&#8217;ll need to run <strong>prelude-admin registration-server prelude-manager</strong> in a second session for both sensors. Also, make sure that you correctly give <strong>prelude-correlator</strong> the &#8216;idmef:rw&#8217; permissions &#8211; this is because it needs to both read <strong>and</strong> write events. Then, enable <strong>prelude-correlator</strong> in the same way as prelude-manager by changing <strong>RUN=no</strong> to <strong>RUN=yes</strong> in <strong>/etc/default/prelude-correlator</strong>. Finally, start <strong>prelude-correlator</strong>:-</p>
<pre>root@dev-vm-lnxd-01:/etc/prelude/profile# <strong>/etc/init.d/prelude-correlator start</strong>
Starting prelude-correlator : prelude-correlator21 Jan 03:06:57 prelude-correlator (process:22339) INFO: [FirewallPlugin]: disabled on user request
21 Jan 03:06:57 prelude-correlator (process:22339) WARNING: SpamhausDropPlugin = PreludeCorrelator.plugins.spamhausdrop:SpamhausDropPlugin: No module named netaddr
21 Jan 03:06:57 prelude-correlator (process:22339) INFO: [BusinessHourPlugin]: disabled on user request
21 Jan 03:06:57 prelude-correlator (process:22339) INFO: 7 plugin have been loaded.
.</pre>
<p>A word of warning at this point &#8211; initially, prelude-correlator failed to start for me. If this happens, make sure that <strong>/etc/prelude/prelude-correlator</strong>, <strong>/var/spool/prelude/prelude-correlator</strong> and <strong>/var/lib/prelude-correlator</strong> (plus any subdirectories) are owned by the <strong>prelude-correlator</strong> user, and then again try to start prelude-correlator.</p>
<p>If you had problems earlier with the dpkg post-install script for prelude-lml, running <strong>apt-get -f install</strong> here will tidy that up and start prelude-lml. If you didn&#8217;t, then start prelude-lml manually:-</p>
<pre>root@dev-vm-lnxd-01:/etc/prelude/profile# <strong>/etc/init.d/prelude-lml start</strong>
Starting Prelude LML: prelude-lml.</pre>
<p>Going back to our Prewikka browser window, if we click again on <strong>Agents</strong> and expand the nodes and sensors, we should see entries for <strong>prelude-lml</strong> and <strong>prelude-correlator</strong>.</p>
<p>To demonstrate what prelude-lml and prelude-correlator can do, let&#8217;s first add an iptables entry to log all TCP connection attempts on port 22:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>iptables -I INPUT -p tcp --dport 22 -m state --state NEW -j LOG</strong></pre>
<p>Opening another SSH connection to the server should result in a log message in <strong>/var/log/messages</strong> similar to the following:-</p>
<pre>Jan 21 03:17:08 dev-vm-lnxd-01 kernel: [ 7981.313741] IN=eth0 OUT= MAC=xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx SRC=192.168.xxx.aaa DST=192.168.xxx.yyy LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=1313 DF PROTO=TCP SPT=56168 DPT=22 WINDOW=14600 RES=0x00 SYN URGP=0</pre>
<p>Next, purposefully fail an attempt to log into the server &#8211; for example, with an incorrect password. Then, check the events again:-</p>
<p style="text-align: center;"><a href="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka-correlator-lml.png"><img class="aligncenter  wp-image-142" title="Prewikka (Correlator and LML)" src="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka-correlator-lml-1024x129.png" alt="" width="819" height="103" /></a></p>
<p style="text-align: left;">There&#8217;s a few things here, but the main thing to notice is that there are a number of new sensors listed in the <strong>Analyzer</strong> column. <strong>PAM</strong>, <strong>sshd</strong>, and <strong>netfilter</strong> have all been picked up by <strong>prelude-lml</strong> from the logfiles it monitors, and in the case of the first event, <strong>prelude-correlator</strong> has correctly identified &#8211; from the prelude-lml events &#8211; that a brute-force attack has occurred. In my example above, it&#8217;s also picked up that there was a successful login &#8211; this was me logging in with the correct password, but if this was a production system this may well be indicative of a brute-force attack resulting in a correctly-guessed password!</p>
<h2 style="text-align: left;">Where now?</h2>
<p>This is just a quick overview of what&#8217;s possible with open-source IDS software. All the tools I&#8217;ve written about in this post are extremely configurable &#8211; <strong>prelude-lml</strong> for example can monitor many different types of logfile and can be configured with custom regular expressions to look for specific things. Many similar tools can be configured to send events to Prelude, which <strong>prelude-correlator</strong> can correlate as above. One thing I&#8217;ve not covered here is <strong>auditd</strong>, which has (via the audispd multiplexor) the ability to send to Prelude &#8211; something which I&#8217;ll cover in a future post.</p>
<p>&nbsp;</p>
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2012/01/21/a-prelude-to-better-things-open-source-and-ids/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Not dead, just sleeping</title>
		<link>http://andys.org.uk/bits/2012/01/20/not-dead-just-sleeping/</link>
		<comments>http://andys.org.uk/bits/2012/01/20/not-dead-just-sleeping/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 18:43:38 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=134</guid>
		<description><![CDATA[<p>It&#8217;s been a while since I posted on here. It&#8217;s been a busy year &#8211; for reasons both good and not-so-good &#8211; but I&#8217;ve got a few ideas that I&#8217;ll be posting about over the next week or two.</p> <p>For those interested in amateur radio (or wonder what it&#8217;s all about) &#8211; I also have [...]]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s been a while since I posted on here. It&#8217;s been a busy year &#8211; for reasons both good and not-so-good &#8211; but I&#8217;ve got a few ideas that I&#8217;ll be posting about over the next week or two.</p>
<p>For those interested in amateur radio (or wonder what it&#8217;s all about) &#8211; I also have <a href="http://m0vkg.org.uk/">http://m0vkg.org.uk/</a>, which is where I post all my amateur radio-related thoughts and activities.</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2012/01/20/not-dead-just-sleeping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RedHat, NFS and static ports</title>
		<link>http://andys.org.uk/bits/2010/12/17/redhat-nfs-and-static-ports/</link>
		<comments>http://andys.org.uk/bits/2010/12/17/redhat-nfs-and-static-ports/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 20:05:19 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[redhat]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=121</guid>
		<description><![CDATA[<p>Using NFS between two machines on the same network is usually free of hassle, so the default behaviour &#8211; on Linux, at least &#8211; is fine and can be left as it is. However, in a commercial setting (such as the ones I manage in my day job) it&#8217;s often the case that the machines [...]]]></description>
				<content:encoded><![CDATA[<p>Using NFS between two machines on the same network is usually free of hassle, so the default behaviour &#8211; on Linux, at least &#8211; is fine and can be left as it is. However, in a commercial setting (such as the ones I manage in my day job) it&#8217;s often the case that the machines might not be on the same network &#8211; or even in the same location, for that matter. It&#8217;s likely that there&#8217;s a number of network devices in between the machines, and the way NFS uses <a href="http://en.wikipedia.org/wiki/Portmap">portmap</a> can sometimes make things frustrating.</p>
<p>Luckily, it&#8217;s really easy to fix.</p>
<p><span id="more-121"></span></p>
<p>On <strong>RedHat</strong>-based systems, it&#8217;s a case of editing /etc/sysconfig/nfs. In there, by default you&#8217;ll find quite a few <code>&lt;service&gt;_PORT=&lt;port&gt;</code> entries, but they&#8217;re hashed out. For example:-</p>
<blockquote>
<pre># Port rpc.statd should listen on.
#STATD_PORT=662</pre>
</blockquote>
<p>You can go ahead and uncomment the line, or if you wish you can change the port. Repeat this for the other <code>&lt;service&gt;_PORT</code> entries as required &#8211; you&#8217;ll want to do <code>LOCKD_TCPPORT</code> (if you&#8217;re using TCP), <code>LOCKD_UDPPORT</code> (if you&#8217;re using UDP), <code>MOUNTD_PORT</code> and <code>STATD_PORT</code>.</p>
<p>Once you&#8217;re happy, restart the services:-</p>
<blockquote>
<pre>/sbin/service portmap restart
/sbin/service nfs restart</pre>
</blockquote>
<p>Running <code>rpcinfo -p</code> should show the various NFS services now running on the ports specified in <code>/etc/sysconfig/nfs</code>:-</p>
<blockquote>
<pre>[root@nfs-server ~]# <strong>rpcinfo -p</strong>
program vers proto   port
100000    2   tcp    111  portmapper
100000    2   udp    111  portmapper
100011    1   udp    875  rquotad
100011    2   udp    875  rquotad
100011    1   tcp    875  rquotad
100011    2   tcp    875  rquotad
100003    2   udp   2049  nfs
100003    3   udp   2049  nfs
100003    4   udp   2049  nfs
100021    1   udp  32769  nlockmgr
100021    3   udp  32769  nlockmgr
100021    4   udp  32769  nlockmgr
100021    1   tcp  32803  nlockmgr
100021    3   tcp  32803  nlockmgr
100021    4   tcp  32803  nlockmgr
100003    2   tcp   2049  nfs
100003    3   tcp   2049  nfs
100003    4   tcp   2049  nfs
100005    1   udp    892  mountd
100005    1   tcp    892  mountd
100005    2   udp    892  mountd
100005    2   tcp    892  mountd
100005    3   udp    892  mountd
100005    3   tcp    892  mountd</pre>
</blockquote>
<p>Firewall rules should be somewhat easier to manage now.</p>
<p>For Debian and Ubuntu systems, you might find <a href="http://ubuntuforums.org/showthread.php?t=352486">this link</a> useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2010/12/17/redhat-nfs-and-static-ports/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Say goodbye to your free time</title>
		<link>http://andys.org.uk/bits/2010/08/09/say-goodbye-to-your-free-time/</link>
		<comments>http://andys.org.uk/bits/2010/08/09/say-goodbye-to-your-free-time/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 12:24:45 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[amateur radio]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[radio]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=111</guid>
		<description><![CDATA[<p>I&#8217;m currently studying for my amateur radio Foundation license, and as part of this I&#8217;ve been playing about with electronics a bit &#8211; something which I never really learnt properly when I was younger.</p> <p>There&#8217;s plenty of free electronics simulators (such as gEDA), and some not-so-free (Multisim), but the learning curve for them is perhaps [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m currently studying for my amateur radio <a href="http://www.rsgb.org/arls/foundation_licence.php">Foundation</a> license, and as part of this I&#8217;ve been playing about with electronics a bit &#8211; something which I never really learnt properly when I was younger.</p>
<p>There&#8217;s plenty of free electronics simulators (such as <a href="http://www.gpleda.org/index.html">gEDA</a>), and some not-so-free (<a href="http://www.ni.com/multisim/">Multisim</a>), but the learning curve for them is perhaps a bit too steep for the absolute beginner.</p>
<p>A few weeks ago I stumbled across the personal site of <a href="http://falstad.com/">Paul Falstad</a>, and his <a href="http://falstad.com/mathphysics.html">amazing array of maths and physics Java applets</a>. Covering acoustics, signals processing, electrodynamics and even quantum mechanics, there&#8217;s bound to be something there to keep your entertained for far longer than is probably appropriate.</p>
<p>The <a href="http://falstad.com/circuit/">Analogue Circuit Simulator</a> (warning: Java applet will start straight away) is the one that&#8217;s sucked up most of my time &#8211; it&#8217;s full of features and examples, and is easy to use. It allows you to see the voltages and currents at all parts of the circuit, and even has scopes so you can watch values change over time.</p>
<p>As well as that, I&#8217;ve also found the <a href="http://falstad.com/emwave2/">2D Electrodynamics applet</a> useful for visualising how electromagnetic waves propagate.</p>
<p>Give them a try, although I&#8217;m not responsible for the amount of time you&#8217;ll inevitably lose doing so&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2010/08/09/say-goodbye-to-your-free-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
