<?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>gHacks Technology News &#124; Latest Tech News, Software And Tutorials &#187; apache security</title> <atom:link href="http://www.ghacks.net/tag/apache-security/feed/" rel="self" type="application/rss+xml" /><link>http://www.ghacks.net</link> <description>A technology news blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description> <lastBuildDate>Sat, 11 Feb 2012 17:32:23 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Install mod_security for better Apache security</title><link>http://www.ghacks.net/2009/07/15/install-mod_security-for-better-apache-security/</link> <comments>http://www.ghacks.net/2009/07/15/install-mod_security-for-better-apache-security/#comments</comments> <pubDate>Wed, 15 Jul 2009 01:09:31 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Networks]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[The Web]]></category> <category><![CDATA[Tutorials Advanced]]></category> <category><![CDATA[apache]]></category> <category><![CDATA[apache security]]></category> <category><![CDATA[httpd.conf]]></category> <category><![CDATA[mod_security]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=14396</guid> <description><![CDATA[Recently I wrote an article to help you secure your Linux Apache Installation (see &#8220;Five ways to help secure Apache on Linux&#8221;). In that article I mentioned using Apache&#8217;s mod_security, but didn&#8217;t have the room for a tutorial on its installation. Well, here&#8217;s the how to on installing this outstanding helper for Apache security. What [...]]]></description> <content:encoded><![CDATA[<p>Recently I wrote an article to help you secure your Linux Apache Installation (see &#8220;<a
title="Five ways to secure Apache on Linux" href="http://www.ghacks.net/2009/07/13/five-ways-to-help-secure-apache-on-linux/" target="_blank">Five ways to help secure Apache on Linu</a>x&#8221;). In that article I mentioned using Apache&#8217;s mod_security, but didn&#8217;t have the room for a tutorial on its installation. Well, here&#8217;s the how to on installing this outstanding helper for Apache security.</p><p><strong>What is mod_security?</strong></p><p>The mod_security addition to Apache is a modular way to add or remove various security features to your Apache server. You can add or remove these modules by simply adding or removing (or commenting out) lines to your <strong>httpd.conf</strong> file and restarting the httpd daemon. And installing mod_rewrite is as easy as it is to install.</p><p><span
id="more-14396"></span><strong>Getting and installing</strong></p><p>I am going to take you through the installation of mod_security on a CentOS distribution. There will be a combination of using yum and installing from source. I will assume Apache is already installed.</p><p>There are a few ways to install this package. You can install from source, but that will require you install numerous dependencies just for the compilation alone. Since we&#8217;re looking at CentOS (and this will apply to Red Hat and Fedora as well) you can use Yum for easy installation. But if you fire Yum up you will find that mod_security is not in the standard repositories. Fortunately there is an easy way to add a repo for this installation. The command to add the repostority is:<br
/> <code>su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm'</code></p><p>You will have to answer &#8216;Y&#8217; to a couple of questions to finish the installation. Once you have added the repository issue the command:</p><p><em>yum install mod_security</em></p><p>to install the system. You will have to accept any dependencies needed for your system to complete the installation. Once mod_security is installed you are ready to get it up and running on your Apache server.</p><p><strong>Basic configuration</strong></p><p>Issue the command:</p><p><em>grep -n security2_module httpd.conf<br
/> </em></p><p>from within the <strong>/etc/httpd/conf/ </strong>directory. If you do not see any output that means you have to add the directive to your <strong>httpd.conf</strong> file. This is simple. At the end of your module loading section add the following line:</p><p><em>LoadModule security2_module modules/mod_security2.so<br
/> </em></p><p>Now save the file and restart Apache with the command:</p><p><em>/etc/rc.d/init.d/httpd restart</em></p><p>You should not receive any errors at this point.</p><p>The most difficult aspect of using mod_security is the the IfModule section in the <strong>httpd.conf</strong> file. The reason this section is so complex is because there are so many possible options. The best chance you have of getting familar with this is by taking a glance at the <a
title="Configuration Directives" href="http://modsecurity.org/documentation/modsecurity-apache/2.5.9/html-multipage/configuration-directives.html" target="_blank">Configuration Directives</a> page on the mod_security web site. To give you an example of a configuration directive section take a look at the following sample in Figure 1.</p><div
id="attachment_14398" class="wp-caption alignleft" style="width: 310px"><a
href="http://www.ghacks.net/wp-content/uploads/2009/07/mod_sec1.png"><img
class="size-medium wp-image-14398" src="http://www.ghacks.net/wp-content/uploads/2009/07/mod_sec1-500x310.png" alt="Figure 1" width="300" height="186" /></a><p
class="wp-caption-text">Figure 1</p></div><p>As you can see this section seems fairly complex. But this is mostly a basic sample of what mod_security can do. In this sample we do the following:</p><ul><li>SecFilterEngine On: Start the engine</li><li>SecFilterDefaultAction: Set the default action for the module. Notice in the sample code i have the default action set to &#8220;allow&#8221;. For higher security you will want to set this to &#8220;deny&#8221;.</li><li>SecFilterScanPOST: Tell mod_security to scan Payloads as well as Get requests.</li><li>SecFilterCheckURLEncoding: Check for valid hex values in requests.</li><li>SecFilterCheckUnicoding: Set this to off if your web site does not use unicoding.</li><li>SecFilterForceByteRange: Set allowable ascii values in GET request and in FORM data posts.</li><li>SecUploadDir: Set the upload directory.</li><li>SecUploadKeepFiles: This must be set to On for the above to be used. For security&#8217;s sake you want to set it to  Off so upload files are not saved.</li><li>SecAuditEngine: Enables the logging facility. This value is set to either RelevantOnly or DynamicOrRelevant.</li><li>SecAuditLog: The location of the log file.</li><li>SecFilterDebugLog: Set the debug log file.</li><li>SecFilterDebugLevel: Set the debug level.</li></ul><p>That is the minimum directives I would employ for your mod_security configuration.</p><p>Once you finish this section, restart Apache again and enjoy a much more secure Apache server.</p><p><strong>Final thoughts</strong></p><p>Of course this just scratches the surface of mod_security. To really get the most of this powerful feature you will want to really comb through the directives section on the mod_security site.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/07/15/install-mod_security-for-better-apache-security/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
