<?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>Chesty&#039;s Blog &#187; install</title>
	<atom:link href="http://chesterton.id.au/blog/tag/install/feed/" rel="self" type="application/rss+xml" />
	<link>http://chesterton.id.au/blog</link>
	<description>Press Belly Button to Begin</description>
	<lastBuildDate>Sat, 02 Apr 2011 01:24:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>mod_security</title>
		<link>http://chesterton.id.au/blog/2011/03/17/mod_security/</link>
		<comments>http://chesterton.id.au/blog/2011/03/17/mod_security/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 06:05:58 +0000</pubDate>
		<dc:creator>chesty</dc:creator>
				<category><![CDATA[LA]]></category>
		<category><![CDATA[OSIA]]></category>
		<category><![CDATA[Slug]]></category>
		<category><![CDATA[ubuntu-au]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mod_security]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://chesterton.id.au/blog/?p=139</guid>
		<description><![CDATA[<p><a href="http://chesterton.id.au/blog/2011/03/17/mod_security/">mod_security</a></p>
mod_security Some time ago, I changed my setup from nginx + spawn-fcgi to nginx + apache so I could play with mod_security. Well, one of my clients got pwned by some sql injection vulnerability, so I finally got to put it in practice. In a nut shell, mod_security is an apache module that scans http(s) [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://chesterton.id.au/blog/2011/03/17/mod_security/">mod_security</a></p>
<p>Some time ago, I changed my setup from nginx + spawn-fcgi to nginx + apache so I could play with mod_security. Well, one of my clients got pwned by some sql injection vulnerability, so I finally got to put it in practice. </p>
<p>In a nut shell, mod_security is an apache module that scans http(s) traffic for suspicious strings. It can catch suspicious strings entering apache or leaving apache. It&#8217;s a firewall for http(s), it blocks bad traffic, and lets good traffic pass through.</p>
<p>mod_security is one of those applications that doesn&#8217;t fit the package model well. I guess it comes in two parts, the apache module and the rules. Packages don&#8217;t seem to even attempt to manage the rules, you download them separately and they come with a util to update them. Then you have your local rules that add to, disable, or override the upstream rules to fit your environment.</p>
<p>In ubuntu, the mod_security package is a little outdated, it always will be, especially on LTS, and it&#8217;s one of those packages that needs constant updates. The clever and motivated security researchers eventually find weakness in mod_security which are addressed in updates. So you either use the packages, and hope fixes are backported in a timely manner, which hasn&#8217;t appeared to of happened in ubuntu, or you install by source.</p>
<p>Installing by source increases your workload and moves the burden of keeping it up to date to yourself. But it&#8217;s a pretty straightforward process, and if you have only one or two machines to admin, it&#8217;s no issue.</p>
<p>It&#8217;s basically a matter of downloading the source, checking the signature, running apt-get build-dep libapache-mod-security, untaring, ./configure; make;make test;make install, then enable the module in apache. It&#8217;s pretty well covered in the docs and blogs found in google.</p>
<p>That takes care of the module, but it does nothing without the rules. I downloaded the core rules from <a href="http://www.owasp.org/index.php/Main_Page">OWASP</a>. There some documentation in the package, but there&#8217;s a few gotchas, so I&#8217;ll try and document step by step the process I went through.</p>
<ol>
<li>unpack the rules in your home directory</li>
<li>sudo mkdir /etc/apache2/modsecurity_crs/</li>
<li>cd modsecurity-crs_2.1.2<br />
sudo cp -a *_rules *.example  /etc/apache2/modsecurity_crs/</li>
<li>cd /etc/apache2/modsecurity_crs/<br />
 sudo mv modsecurity_crs_10_config.conf{.example,}</li>
<li>You have to edit modesecurity_crs_10_config.conf and uncomment a few lines, I think the main one being SecRuleEngine.</li>
<li>I created two files in /etc/apache2/mods-available<br />
0modsecurity.conf<br />
<code>&lt;IfModule security2_module><br />
   Include modsecurity_crs/*.conf<br />
   Include modsecurity_crs/base_rules/*.conf<br />
&lt;/IfModule></code><br />
0modsecurity.load<br />
<code>LoadFile /usr/lib/libxml2.so<br />
LoadFile /usr/lib/liblua5.1.so<br />
LoadModule security2_module /usr/lib/apache2/modules/mod_security2.so</code></li>
<li>sudo a2enmod 0modsecurity</li>
<li>create a file called /etc/apache2/modsecurity_crs/modsecurity_localconfig.conf with the following<br />
<code>SecUploadDir /var/log/modsecurity/SecUploadDir<br />
SecAuditLog /var/log/modsecurity/SecAuditLog/modsec_audit.log<br />
SecAuditLogStorageDir /var/log/modsecurity/SecAuditLogStorageDir<br />
SecDebugLog /var/log/modsecurity/SecDebugLog/modsec_debug.log<br />
SecDataDir /var/log/modsecurity/SecDataDir<br />
SecTmpDir /var/log/modsecurity/SecTmpDir<br />
</code></li>
<li>Make all the directories in /var/log/modsecurity, which have to be owned by www-data<br />
<code>sudo mkdir -p /var/log/modsecurity/{SecUploadDir,SecAuditLog,SecAuditLogStorageDir,SecDebugLog,SecDataDir,SecTmpDir}<br />
sudo chown -R www-data: /var/log/modsecurity</code>
</li>
</ol>
<p>That will do for now, I think. To modify the rules I feel it&#8217;s best to slow down and buy a book for learning, I&#8217;m not sure docs and blogs are the best way to learn this, but it&#8217;s up to your learning style. I keep updated by following @ModSecurity on twitter.</p>
]]></content:encoded>
			<wfw:commentRss>http://chesterton.id.au/blog/2011/03/17/mod_security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remotely Upgrading RHEL to Ubuntu</title>
		<link>http://chesterton.id.au/blog/2008/02/05/remotely-upgrading-rhel-to-ubuntu/</link>
		<comments>http://chesterton.id.au/blog/2008/02/05/remotely-upgrading-rhel-to-ubuntu/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 18:47:44 +0000</pubDate>
		<dc:creator>chesty</dc:creator>
				<category><![CDATA[Slug]]></category>
		<category><![CDATA[ubuntu-au]]></category>
		<category><![CDATA[chesty]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[rhel]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://chesterton.id.au/blog/2008/02/05/remotely-upgrading-rhel-to-ubuntu/</guid>
		<description><![CDATA[<p><a href="http://chesterton.id.au/blog/2008/02/05/remotely-upgrading-rhel-to-ubuntu/">Remotely Upgrading RHEL to Ubuntu</a></p>
Remotely Upgrading RHEL to Ubuntu We were given a server to play with to do whatever we wanted, hosted in a US data centre. It was running RHEL 4.x, I could have worked with that, but it didn&#8217;t look like it was on a support contract, I wasn&#8217;t able to update it, anyway. I thought [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://chesterton.id.au/blog/2008/02/05/remotely-upgrading-rhel-to-ubuntu/">Remotely Upgrading RHEL to Ubuntu</a></p>
<p>We were given a server to play with to do whatever we wanted, hosted in a US data centre. It was running RHEL 4.x, I could have worked with that, but it didn&#8217;t look like it was on a support contract, I wasn&#8217;t able to update it, anyway.</p>
<p>I thought about trying to convert it to centos, but realised it would be more fun to upgrade it to ubuntu gutsy.</p>
<p>Quick steps from memory
<ol>
<li>swapoff -a</li>
<li>mkfs.ext3 /dev/VolGroup00/LogVol01 (old swap)</li>
<li>mount /dev/VolGroup00/LogVol01 /mnt</li>
<li>wget debootstrap.deb (from gutsy)</li>
<li>ar x debootstrap.deb</li>
<li>tar -C / -xzf data.tar.gz</li>
<li>debootstrap &#8211;arch=i386 gutsy /mnt</li>
<li>chroot /mnt</li>
<li>mount proc, edit /etc/fstab and /etc/network/interfaces</li>
<li>apt-get install ubuntu-minimal ubuntu-standard linux-image postfix openssh-server plus a few other packages, some that were recommends.</li>
<li>copied gutsy /boot/* to the real /boot and created a new entry in menu.lst</li>
<li>created an account and uploaded some ssh keys</li>
<li>probably some steps I&#8217;ve forgotten</li>
<li>reboot</li>
</ol>
<p>Easy peasy, just waiting for it to come up, it&#8217;s been 5 hours now, still waiting. Must be the slowest booting server ever.</p>
<p>Guess I&#8217;ll be calling the states now. :&#8217;(</p>
]]></content:encoded>
			<wfw:commentRss>http://chesterton.id.au/blog/2008/02/05/remotely-upgrading-rhel-to-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

