<?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>thinking sysadmin &#187; php</title>
	<atom:link href="http://andyleonard.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://andyleonard.com</link>
	<description>qstat -u aleonard -s z</description>
	<lastBuildDate>Sun, 22 Jan 2012 03:46:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Drupal Deployment Sysadmin Best Practices</title>
		<link>http://andyleonard.com/2009/12/09/drupal-deployment-sysadmin-best-practices/</link>
		<comments>http://andyleonard.com/2009/12/09/drupal-deployment-sysadmin-best-practices/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 04:14:55 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://andyleonard.com/?p=401</guid>
		<description><![CDATA[Drupal is a popular open source CMS reportedly used on tens of thousands of sites ranging from personal blogs to whitehouse.gov; for readers of this blog, it probably requires no further introduction. Despite its many desirable features and continuing popularity, Drupal is not without its shortcomings, as many readers are also likely aware. Although Drupal [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://drupal.org/">Drupal</a> is a popular open source CMS reportedly used on tens of thousands of sites ranging from personal blogs to <a href="http://www.whitehouse.gov/">whitehouse.gov</a>; for readers of this blog, it probably requires no further introduction.</p>
<p>Despite its many desirable features and continuing popularity, Drupal is not without its shortcomings, as many readers are also likely aware.  Although Drupal has an active and responsive <a href="http://drupal.org/security-team">security team</a>, the software has a long track record of requiring frequent security patches &#8211; Secunia has seven 2009 advisories for <a href="http://secunia.com/advisories/product/17839/?task=advisories_2009">Drupal 6.x</a> listed as of this writing.  Although by its nature an apples-to-oranges comparison, this ranks Drupal behind similarly large and complex PHP projects such as <a href="http://secunia.com/advisories/product/6745/?task=advisories_2009">WordPress 2.x</a> (5) and <a href="http://secunia.com/advisories/product/5879/?task=advisories_2009">Gallery 2.x</a> (0) &#8211; and the number for Drupal does not include dozens of additional advisories for Drupal modules.  Further, Drupal has <a href="http://drupal.org/node/360605">struggled and lagged</a> with support for PHP 5.3.x, suggesting to this outside observer that the project is having difficulties maintaining its codebase.</p>
<p>All that being said, I do not personally believe that the above issues rule out using Drupal; the benefits outweigh the shortcomings.  So, assuming the question is not whether to deploy Drupal, but how to do so most securely and efficiently, my recommendations from a systems administration perspective are below.<br />
<span id="more-401"></span><br />
<strong>Goals</strong></p>
<p>The recommendations described stem from three goals for a Drupal installation:</p>
<ol>
<li><strong>Security</strong> &#8211; Avoid compromise of your site and system.</li>
<li><strong>Flexibility</strong> &#8211; Create an environment that allows for easy modification of the OS, server and application, and provides for straightforward roll-back of those changes should those need arise.</li>
<li><strong>Stability and Security over Performance</strong> &#8211; Although not mutually exclusive, designing for stability and security can entail trade-offs that may impact performance.  I don&#8217;t directly address performance in these recommendations.</li>
</ol>
<p>The below recommendations are written assuming that the sysadmin (you) responsible for the Drupal server and the developer are two different people.  If you wear both hats, the recommendations can obviously adapted to fit your dual role.</p>
<p><strong>Recommendations</strong></p>
<ol>
<li><strong>Insist on the latest version of Drupal, and plan to upgrade as Drupal releases come out.</strong>  Some developers may be hesitant to use the latest (stable) version of Drupal, but Drupal&#8217;s security track record dictates this; anything else is not serving the site owner&#8217;s interests.</li>
<li><strong>Use the latest supported version of PHP.</strong>  Drupal&#8217;s PHP version requirements are more brittle than most applications; the latest version of PHP is almost always the most stable and secure version.  Combining the two is obvious: Aggressively track latest version of PHP that Drupal supports.  Additionally, use the latest version of your preferred web server and patch as it is updated.  Note that this implies a source-based installation of PHP and your web server instead of a package-based installation from your distribution.  Carefully consider your build and deployment strategies with an eye towards reproducibility, documentation and ease of roll-back should a problem arise.</li>
<li><strong>Isolate Drupal from other applications.</strong>  Run Drupal on its own system &#8211; physical or virtual &#8211; and in doing so, reduce operating complexity while limiting collateral damage if your Drupal instance should be compromised.  Depending on your backup strategy, don&#8217;t overlook the possibility that running a VM may have obvious recovery and forensic advantages over a physical install should your Drupal site get broken into.</li>
<li><strong>mod_security</strong> &#8211; Consider integrating a &#8220;web application firewall&#8221; such as <a href="http://www.modsecurity.org/">mod_security</a> directly into your web server.  Carefully evaluate the trade-off of additional complexity for enhanced security in your environment.</li>
<li><strong>Deploy a host-based firewall for inbound and outbound traffic</strong> &#8211; This has two functions &#8211; prevent your server from being compromised through a hole in a service other than your web server, and limit damage to other systems if/when you are compromised.  There&#8217;s a decent chance that the only external service you need exposed other than HTTP for your Drupal site is SSH for remote management &#8211; and you can probably lock that down to a very limited set of IP addresses.  And, in the situation where your server is compromised, outbound rules can reduce the ability of your server to attack other machines: Consider, for example, the effect of an outbound rule on port 25 if an attacker attempts to use your compromised server as a spam bot.</li>
<li><strong>Use SELinux</strong> &#8211; Security-Enhanced Linux provides a the ability to audit and possibly deny actions on your system through <a href="http://en.wikipedia.org/wiki/Mandatory_access_control">mandatory access control policies</a>.  You will likely want to run SELinux in &#8220;permissive&#8221; mode before your site is publicly available, at which point you would switch to &#8220;enforcing&#8221; mode; &#8220;audit2allow&#8221; and &#8220;audit2why&#8221; can be very helpful tools when developing policies.  See &#8220;man selinux&#8221; for more information.</li>
<li><strong>Use a Sysadmin Staging Server</strong> &#8211; The site developer likely has a staging instance of Drupal for testing out their code changes; deploy a similar environment for testing Sysadmin changes, such as PHP updates or the latest version of Drupal with your code.  Consider using a software testing framework such as <a href="http://seleniumhq.org/">Selenium</a> to automate the tests you run on the sysadmin staging site.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://andyleonard.com/2009/12/09/drupal-deployment-sysadmin-best-practices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

