<?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>Spind.net Blog &#187; Apache</title>
	<atom:link href="http://blog.spind.net/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.spind.net</link>
	<description>Stories from the trenches of System Administration</description>
	<lastBuildDate>Mon, 19 Dec 2011 09:21:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>The mysterious case of the 501 error</title>
		<link>http://blog.spind.net/2009/05/13/the-mysterious-case-of-the-501-error/</link>
		<comments>http://blog.spind.net/2009/05/13/the-mysterious-case-of-the-501-error/#comments</comments>
		<pubDate>Wed, 13 May 2009 09:10:30 +0000</pubDate>
		<dc:creator>hc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ModSecurity]]></category>
		<category><![CDATA[Paranoia]]></category>

		<guid isPermaLink="false">http://blog.spind.net/?p=137</guid>
		<description><![CDATA[I recently installed mod_security on our Apache server, and everything seemed to be working fine. Suddenly, while working on the previous post, I was presented with this error: Method Not Implemented POST to /wp/wp-admin/post.php not supported. I checked the log files, and found these hits: [Wed May 13 10:52:48 2009] [error] [client xxx.xxx.xxx.xxx] ModSecurity: Access [...]]]></description>
			<content:encoded><![CDATA[<p>I recently installed <a href="http://www.modsecurity.org/">mod_security</a> on our Apache server, and everything seemed to be working fine. Suddenly, while working on the <a href="http://blog.spind.net/2009/05/13/prioritizing-linux-services/">previous post</a>, I was presented with this error:</p>
<div class="codebox">
Method Not Implemented<br />
POST to /wp/wp-admin/post.php not supported.
</div>
<p>I checked the log files, and found these hits:</p>
<div class="codebox">
[Wed May 13 10:52:48 2009] [error] [client xxx.xxx.xxx.xxx] ModSecurity: Access denied with code 501 (phase 2). Pattern match &#8220;(?:\\b(?:\\.(?:ht(?:access|passwd|group)|www_?acl)|global\\.asa|httpd\\.conf|boot\\.ini)\\b|\\/etc\\/)&#8221; at ARGS:content. [file "/etc/httpd/modsecurity.d/modsecurity_crs_40_generic_attacks.conf"] [line "114"] [id "950005"] [msg "Remote File Access Attempt"] [data "/etc/"] [severity "CRITICAL"] [tag "WEB_ATTACK/FILE_INJECTION"] [hostname "blog.spind.net"] [uri "/wp/wp-admin/post.php"] [unique_id "xxxxxxxxxxxxx"]
</div>
<p>In short, it&#8217;s <tt>mod_security</tt> telling me that the text <tt>/etc/</tt> triggered rule 950005, which should be protecting our server against malicious attempts to access local files &#8211; like the ones in the <tt>/etc</tt> directory. The access file only showed a POST to <tt>/wp/wp-admin/post.php</tt> so I had no idea where the <tt>/etc/</tt> string was coming from. Maybe some weird hidden Javascript? Maybe something else?</p>
<p><a href="http://techpulp.com/2009/02/how-to-resolve-post-to-wp-admin-post-php-not-supported-error-in-wordpress/">This post</a> narrowed acknowledged it to be related to <tt>mod_security</tt> and suggested to disable it permanently or just turn it temporarily off while posting. I aim to do better.</p>
<p>The <a href="http://blog.spind.net/2009/05/13/prioritizing-linux-services/">previous post</a> has a wonderful nugget of enlightenment about prioritizing services on Linux, and suggested a couple of changes to the Linux configuration files &#8211; most of which are located in.. the <tt>/etc/</tt> folder. In short, I triggered <tt>mod_security</tt> rule 950005 by posting data containing <tt>/etc/</tt>.</p>
<p>If you ever plan to cover issues related to deployment and administration of operating system in the Unix family, this rule absolutely has got to go. Obviously it&#8217;s written with the best of intentions, but as it is doesn&#8217;t work and should be disabled.</p>
<p>Avoid messing with <tt>/etc/httpd/modsecurity.d/modsecurity_crs_40_generic_attacks.conf</tt> and just disable the specific rules in <tt>/etc/httpd/conf.d/mod_security.conf</tt> by adding this:</p>
<div class="codebox">
# Disable a couple of rules in modsecurity.d/modsecurity_crs_40_generic_attacks.conf<br />
# that prevents submitting text containing filenames in the Unix family.<br />
SecRuleRemoveById 950005<br />
SecRuleRemoveById 950006
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.spind.net/2009/05/13/the-mysterious-case-of-the-501-error/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Custom SuEXEC for Apache &#8211; the easy way</title>
		<link>http://blog.spind.net/2009/04/15/custom-suexec-for-apache-the-easy-way/</link>
		<comments>http://blog.spind.net/2009/04/15/custom-suexec-for-apache-the-easy-way/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:33:43 +0000</pubDate>
		<dc:creator>hc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[SuEXEC]]></category>

		<guid isPermaLink="false">http://blog.spind.net/?p=124</guid>
		<description><![CDATA[I&#8217;m a security freak, and prefer to switch to individual users, when running scripts on different sites. There are numerous advantages to this, including being able to write to your web directory, without leaving a huge security hole open for root-kits on other hosted sites on the server. To do this, I&#8217;ve decided to use [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a security freak, and prefer to switch to individual users, when running scripts on different sites. There are numerous advantages to this, including being able to write to your web directory, without leaving a huge security hole open for root-kits on other hosted sites on the server.</p>
<p>To do this, I&#8217;ve decided to use the Apache <tt>suexec</tt> option for all my scripts. I won&#8217;t go into specific details about the setup here, but present a pretty solution to an annoying problem that arises when using <tt>suexec</tt> and applying software updates for the Apache server.</p>
<p>If your web files are located in <tt>/var/www</tt>, you won&#8217;t need this. For security reasons, <tt>suexec</tt> is compiled with various configuration options that can&#8217;t be changed runtime &#8211; the &#8220;safe&#8221; location of scripts is one of them. If you &#8211; like me &#8211; have your web files located somewhere else, you&#8217;ll need to recompile <tt>suexec</tt> and re-install it every time you upgrade Apache. If you decide to get the entire source code tree for Apache, just for this, you&#8217;ll find yourself in a mess that could easily be avoided.</p>
<p>Here is my solution: Since the <tt>suexec</tt> source files themselves rarely change, I picked out exactly the files needed to compile the <tt>suexec</tt> binary and simplified the Makefile. This way, I&#8217;ve got a very small directory with the files required to build my <tt>suexec</tt> with my own configuration options, without messing with the rest of the Apache source code. As long as I remember to run <tt>make install</tt> after updating Apache, it&#8217;s all good.</p>
<p>First of all, you need to set up a directory for the <tt>suexec</tt> files:</p>
<div class="codebox">
$ cd /usr/src<br />
$ mkdir suexec<br />
$ cd suexec<br />
$ wget http://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x/support/suexec.c<br />
$ wget http://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x/support/suexec.h
</div>
<p>Now make the changes you need to <tt>suexec.h</tt> and write a suitable Makefile:</p>
<div class="codebox">
suexec: suexec.h suexec.c<br />
&nbsp; &nbsp; gcc suexec.c -o suexec -I /usr/include/apr-1/ -I /usr/include/httpd/<br />
<br />
clean:<br />
&nbsp; &nbsp; rm -fv suexec.o suexec<br />
<br />
install: suexec<br />
&nbsp; &nbsp; cp suexec /usr/sbin/suexec<br />
&nbsp; &nbsp; chmod 4775 /usr/sbin/suexec
</div>
<p>You&#8217;ll need the <tt>apr-devel</tt> and <tt>httpd-devel</tt> packages for this to work. Remember that you need to indent with tabs in makefiles. Run <tt>make install</tt> to install:</p>
<div class="codebox">
$ make install<br />
gcc suexec.c -o suexec -I /usr/include/apr-1/ -I /usr/include/httpd/<br />
cp suexec /usr/sbin/suexec<br />
chmod 4775 /usr/sbin/suexec
</div>
<p>If you&#8217;re running <tt>php-cgi</tt> and getting http error 500, your <tt>suexec</tt> probably needs to be re-installed. Remember to check the <tt>suexec</tt> logfile.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spind.net/2009/04/15/custom-suexec-for-apache-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Browser caching with SSL</title>
		<link>http://blog.spind.net/2009/03/18/browser-caching-with-ssl/</link>
		<comments>http://blog.spind.net/2009/03/18/browser-caching-with-ssl/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 10:26:44 +0000</pubDate>
		<dc:creator>hc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[WWW]]></category>

		<guid isPermaLink="false">http://blog.spind.net/?p=114</guid>
		<description><![CDATA[I&#8217;m using several SSL-enabled sites daily, and since browsers traditionally refuse to cache anything negotiated through an SSL connection on disk, performance has a tendency to suffer. I notice this every time I visit Fogbugz, and I have to wait for my browser to load all the neat little icons they use. Fortunately, according to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using several SSL-enabled sites daily, and since browsers traditionally refuse to cache anything negotiated through an SSL connection on disk, performance has a tendency to suffer. I notice this every time I visit <a href="http://www.fogbugz.com/">Fogbugz</a>, and I have to wait for my browser to load all the neat little icons they use. Fortunately, according to <a href="http://blogs.gnome.org/jamesh/2008/05/01/firefox-ssl/">James Henstridge</a>, it&#8217;s possible to make Firefox 3+ cache these files now.</p>
<p>Basically he suggests to go to <tt>about:config</tt> and change the setting <tt>browser.cache.disk_cache_ssl</tt> to <tt>true</tt>. There have been issues prior to Firefox 2, but these should be fixed in Firefox 3.</p>
<p>If you&#8217;re running a webserver, adding the header value <tt>Cache-Control: Public</tt> will allow most browsers to automatically cache server files. If you&#8217;re paranoid, you should only add this header to scripts, images and stylesheets. Here is an example for Apache that allows browsers to cache a selected fileset for up to one week:</p>
<div class="codebox">
# Cache-control: Public activated disk-caching for HTTPS<br />
&lt;FilesMatch &#8220;\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$&#8221;&gt;<br />
    Header set Cache-Control &#8220;max-age=604800, public&#8221;<br />
&lt;/FilesMatch&gt;
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.spind.net/2009/03/18/browser-caching-with-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

