<?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; mod_security</title> <atom:link href="http://www.ghacks.net/tag/mod_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>Fri, 10 Feb 2012 20:51:26 +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> <item><title>Five ways to help secure Apache on Linux</title><link>http://www.ghacks.net/2009/07/13/five-ways-to-help-secure-apache-on-linux/</link> <comments>http://www.ghacks.net/2009/07/13/five-ways-to-help-secure-apache-on-linux/#comments</comments> <pubDate>Mon, 13 Jul 2009 20:09:06 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[apache]]></category> <category><![CDATA[document root]]></category> <category><![CDATA[mod_security]]></category> <category><![CDATA[securing apache]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=14373</guid> <description><![CDATA[Apache is one of the most popular web servers available. And most Apache installations are running on Linux servers. Anyone running Linux will tell you that the operating system (be it on a server or desktop) enjoys a level of security many operating systems do not enjoy. But does that mean you can just install [...]]]></description> <content:encoded><![CDATA[<p>Apache is one of the most popular web servers available. And most Apache installations are running on Linux servers. Anyone running Linux will tell you that the operating system (be it on a server or desktop) enjoys a level of security many operating systems do not enjoy. But does that mean you can just install Apache and assume it 100% safe? No. There are always ways to improve your security on just about every level.</p><p>In this article I will show you five simple ways to make your Linux Apache installation more secure. And of course you should always know that even with five new means of making your install more secure, that doesn&#8217;t mean it is perfectly safe from attack. Even after securing your installation, you should always keep watch over your server by checking log files and using standard security tools.</p><p>With that said, let&#8217;s get our Apache security on!</p><p><span
id="more-14373"></span>1. Update, update, update! One of the biggest no nos Linux administrators make is to &#8220;set it and forget it&#8221;. This should not be your standard policy. There are always updates that close new holes and patch security flaws. This holds true for Apache as much as it does any other system or application. Keep watch, using your normal means of update, for any security update for Apache or any constituent component you have installed. By doing this you will ensure your web server is safe from any new known issues.</p><p>2. Disable modules you do not use. If you check the Apache configuration file. Most often this file is called <strong>httpd.conf</strong> and its location will depend upon what distribution you are running (For example CentOS has this file in <strong>/etc/httpd/conf/</strong> whereas Ubuntu locates it in <strong>/etc/apache2</strong>). If you examine that file you will see quite a few modules listed. These modules will look like:</p><p><code>LoadModule auth_basic_module modules/mod_auth_basic.so<br
/> LoadModule auth_digest_module modules/mod_auth_digest.so<br
/> LoadModule authn_file_module modules/mod_authn_file.so<br
/> LoadModule authn_alias_module modules/mod_authn_alias.so<br
/> LoadModule authn_anon_module modules/mod_authn_anon.so</code></p><p>You might have to look up what some of these modules do to know if you need them or not. But there is no reason to load a module if you are not going to use it. To keep a module from loading place a comment in front of the line. You will have to restart Apache for this change to take effect.</p><p>3. Limit the request sizes allowed. Denial of Service attacks remain one of the most popular attacks on web sites because they are the easiest to pull off. One way to protect your site from DoS attacks is to use the following directives wisely: LimitRequestBody, LimitRequestFields, LimitRequestFieldSize, LimitRequestLine, and LimitXMLRequestBody within a Directory tag (the document root is probably the best place for this). By default Apache sets these directives to unlimited which means any size of request can be made. You will want to investigate these directives and configure them to suit your web sites needs. Unless it is absolutely necessary, do not set them to unlimited.</p><p>4. Use mod_security. This is the most important module you can use. This one module handles such tasks as: Simple filtering, regular expression filtering, server identity masking, and URL encoding validation. It is likely you will have to install mod_security, because the default Apache install does not include this module. Once installed you will want to make sure you at least add the &#8220;unique_id&#8221; and &#8220;security2&#8243; directives in your Apache module section and then restart Apache. I will deal with this module in its own tutorial coming up very soon.</p><div
id="attachment_14375" class="wp-caption alignleft" style="width: 205px"><img
class="size-full wp-image-14375" src="http://www.ghacks.net/wp-content/uploads/2009/07/apache.png" alt="Figure 1" width="195" height="125" /><p
class="wp-caption-text">Figure 1</p></div><p>5. Restrict browsing to your document root. The last thing you want is to allow browser to peek outside of the Apache document root (Such as <strong>/var/www/html </strong>or <strong>/var/www/</strong>). To do this you will want to configure your document root directory entry as shown in Figure 1. This will</p><p>Of course if you want to add options to any directory inside of the document root you will have to give that directory its own Directory entry.</p><p><strong>Final thoughts</strong></p><p>There are plenty more ways to secure your Apache installation, but these will get you started. Can you think of other ways to secure an Apache installation? If so, share them with your fellow ghacks readers.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/07/13/five-ways-to-help-secure-apache-on-linux/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> </channel> </rss>
