<?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>AnyHosting &#187; security</title>
	<atom:link href="http://anyhosting.com/blog/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://anyhosting.com/blog</link>
	<description>It&#039;s all about the web</description>
	<lastBuildDate>Sun, 18 Oct 2009 01:41:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>national cybersecurity awareness month</title>
		<link>http://anyhosting.com/blog/2009/10/12/national-cybersecurity-awareness-month/</link>
		<comments>http://anyhosting.com/blog/2009/10/12/national-cybersecurity-awareness-month/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 03:53:10 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=107</guid>
		<description><![CDATA[Apparently it is &#8220;National Cybersecurity Awareness Month&#8221; in the US.
Computer crime is rampant and quite profitable. Websites have long been defaced for fun or viruses and worms released to cause disruptions.  Now there&#8217;s an incentive for criminals to avoid detection, to add your machines to a botnet for hire, or hide spam and ad links [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently it is &#8220;<a href="http://www.whitehouse.gov/the_press_office/Presidential-Proclamation-National-Cybersecurity-Awareness-Month/">National Cybersecurity Awareness Month</a>&#8221; in the US.</p>
<p><a href="http://en.wikipedia.org/wiki/Computer_crime">Computer crime</a> is rampant and quite profitable. Websites have long been <a href="http://en.wikipedia.org/wiki/Website_defacement">defaced</a> for fun or viruses and worms released to cause <a href="http://archives.cnn.com/2000/TECH/computing/05/04/iloveyou.01/">disruptions</a>.  Now there&#8217;s an incentive for criminals to avoid detection, to add your machines to a <a href="http://en.wikipedia.org/wiki/Botnet">botnet</a> for hire, or <a href="http://wordpress.org/development/2009/09/keep-wordpress-secure/">hide spam and ad links in your Wordpress blog</a>.</p>
<p>This is why it&#8217;s super critical to us as at AnyHosting to focus on <a href="http://anyhosting.com/blog/category/security/">security</a>, and follow best practices like secure backups, regular audits, intrusion detection, automatic updates, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2009/10/12/national-cybersecurity-awareness-month/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure shared web hosting on Ubuntu Server, part 3</title>
		<link>http://anyhosting.com/blog/2009/10/04/secure-shared-web-hosting-on-ubuntu-server-part-3/</link>
		<comments>http://anyhosting.com/blog/2009/10/04/secure-shared-web-hosting-on-ubuntu-server-part-3/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 07:26:29 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=87</guid>
		<description><![CDATA[In this third and final installment, we&#8217;ll look at alternatives and future directions for shared web hosting on Ubuntu Server (go back in time to part 1 and part 2 in case you missed them).
Our original goal was to provide websites for multiple users on one host, keeping them compartmentalized from each other, and to [...]]]></description>
			<content:encoded><![CDATA[<p>In this third and final installment, we&#8217;ll look at alternatives and future directions for shared web hosting on Ubuntu Server (go back in time to <a href="http://anyhosting.com/blog/2009/10/03/secure-shared-web-hosting-on-ubuntu-server-part-1/">part 1</a> and <a href="http://anyhosting.com/blog/2009/10/03/secure-shared-web-hosting-on-ubuntu-server-part-2/">part 2</a> in case you missed them).</p>
<p>Our original goal was to provide websites for multiple users on one host, keeping them compartmentalized from each other, and to restrict break-ins. We chose to do reverse proxying using Apache, with separate Apache instances for each user, using mod_chroot.</p>
<p>Pros:</p>
<ul>
<li>user cannot see or read/write other users files, even on the same shared server, or use any system resources not explicitly provided in the chroot.</li>
<li>mod_chroot is way less work than building a full chroot jail, and is potentially safer since you don&#8217;t have to provide system libraries or binaries, reducing your attack surface</li>
</ul>
<p>Cons:</p>
<ul>
<li>multiple Apache instances consume more memory, and need special configuration and startup scripts</li>
<li>it is possible to <a href="http://kerneltrap.org/Linux/Abusing_chroot">break out of a chroot</a>. It is especially easy if the attacker can somehow get elevated to root (e.g. local security exploit)</li>
</ul>
<p>Further investigation:</p>
<ul>
<li> apache-mpm-itk &#8211; This runs Apache child processes as a separate user per vhost. Cannot be combined with mod_chroot, unfortunately, and has some serious drawbacks (see the section on <a href="http://mpm-itk.sesse.net/">Quirks and Warnings</a>).</li>
</ul>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Solaris_Containers">solaris containers</a>, <a href="http://en.wikipedia.org/wiki/FreeBSD_jail">freebsd jail</a>, <a href="http://en.wikipedia.org/wiki/Linux-VServer">linux vserver</a> &#8211; These are real jails; less overhead than <a href="http://en.wikipedia.org/wiki/Virtual_machine">Virtual Machines</a>, but provide more protection than a chroot. These tend to be significantly more complex to set up than something like mod_chroot, but are by design a lot harder to escape than a chroot.</li>
</ul>
<p>There are some other interesting security-related modules such as <a href="http://www.zdziarski.com/projects/mod_evasive/">mod_evasive</a> that I am checking into further, which may mitigate some of the &#8220;cons&#8221; above.</p>
<p>Hopefully this will be useful to someone, however <a href="http://www.schneier.com/book-sandl-pref.html">security is a process, not a product</a>, and you should not rely solely on something like mod_chroot, but it can be a useful tool as part of an overall strategy that includes monitoring, intrusion detection, and regular security updates.</p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2009/10/04/secure-shared-web-hosting-on-ubuntu-server-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure shared web hosting on Ubuntu Server, part 2</title>
		<link>http://anyhosting.com/blog/2009/10/03/secure-shared-web-hosting-on-ubuntu-server-part-2/</link>
		<comments>http://anyhosting.com/blog/2009/10/03/secure-shared-web-hosting-on-ubuntu-server-part-2/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 14:10:13 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=70</guid>
		<description><![CDATA[Continuing from part 1, here are the nuts and bolts:
Ubuntu 8.10 Server
root@theo:~# apt-get install apache2 libapache2-mod-chroot
For each domain, create a virtual host config like /etc/apache2/sites-available/example.com:
&#60;VirtualHost *:80&#62;
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
&#60;Proxy *&#62;
  Allow from all
&#60;/Proxy&#62;
ErrorLog /var/www/example.com/logs/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/www/example.com/logs/access.log combined
&#60;/VirtualHost&#62;
This will be [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing from <a href="http://anyhosting.com/blog/2009/10/01/secure-shared-web-hosting-on-ubuntu-server-part-1/">part 1</a>, here are the nuts and bolts:</p>
<p>Ubuntu 8.10 Server</p>
<pre>root@theo:~# apt-get install apache2 libapache2-mod-chroot</pre>
<p>For each domain, create a virtual host config like /etc/apache2/sites-available/example.com:</p>
<pre>&lt;VirtualHost *:80&gt;
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com</pre>
<pre>ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/</pre>
<pre>&lt;Proxy *&gt;
  Allow from all
&lt;/Proxy&gt;</pre>
<pre>ErrorLog /var/www/example.com/logs/error.log</pre>
<pre># Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn</pre>
<pre>CustomLog /var/www/example.com/logs/access.log combined</pre>
<pre>&lt;/VirtualHost&gt;</pre>
<p>This will be used by the Apache proxy, which is the normal system apache2 running as the default &#8220;www-data&#8221; user. This proxy handles name-based virtual hosts, and proxies the requests to a second process, running at localhost on port 8080.</p>
<p>Note that the logs are configured here and not in the user&#8217;s Apache process, for two reasons:</p>
<ol>
<li>keep logs pristine in the event of a break-in on a user site (for example via a buggy or malicious PHP script)</li>
<li>single system-wide log file analysis process instead of per-user</li>
</ol>
<p>Next, create a user account for each domain:</p>
<pre>root@theo:~# mkdir /var/www/example.com
root@theo:~# cd /var/www/example.com/
root@theo:/var/www/example.com# useradd -d /var/www/example.com/htdocs example.com
root@theo:/var/www/example.com# mkdir htdocs logs conf
root@theo:/var/www/example.com# chown www-data:www-data logs
root@theo:/var/www/example.com# chown example.com:example.com htdocs/</pre>
<p>Create the following in /var/www/example.com/conf/apache2.conf:</p>
<pre>ServerRoot "/var/www/example.com/"
RequestHeader set Host example.com
LockFile /var/www/example.com/conf/accept.lock
PidFile /conf/apache2.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
User example.com
Group example.com
AccessFileName .htaccess
&lt;Files ~ "^\.ht"&gt;
  Order allow,deny
  Deny from all
&lt;/Files&gt;

DefaultType text/plain
HostnameLookups Off
ErrorLog /var/www/example.com/conf/error.log
LogLevel warn
LoadFile /lib/libnss_dns.so.2
LoadModule chroot_module /usr/lib/apache2/modules/mod_chroot.so
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
Listen 8080
DocumentRoot /htdocs
ChrootDir /var/www/example.com/</pre>
<p>Start up the user Apache process:</p>
<pre>
<pre>root@theo:~# apache2 -f /var/www/example.com/conf/apache2.conf -k start</pre>
</pre>
<p>Everything should now work, but you may notice some problems with PHP or CGI scripts. Generally this means that you will need to make parts of the system available in the chroot; however making copies takes up a lot of space and can quickly get out of date, which is a security risk.</p>
<p>One workaround is to provide needed directories using the &#8220;mount -o bind&#8221; option, which will remount an existing, mounted part of the file hierarchy somewhere else. For example, this will provide all of &#8220;/usr&#8221; inside the chroot:</p>
<pre>root@theo:~# mkdir /usr /var/www/example.com/usr
root@theo:~# mount -o bind,ro /usr /var/www/example.com/usr</pre>
<p>PHP sessions require /tmp to exist inside the chroot; there is no benefit to sharing this one, an empty directory is fine.</p>
<p>That&#8217;s pretty much it! Testing, getting startup right etc. is left as an exercise for the reader, since we&#8217;re venturing a bit out of the standard Ubuntu Apache setup. Entries in /etc/fstab and creating an init script to handle user Apache processes is probably the best way to go.</p>
<p>In part 3 we&#8217;ll cover take a more general look at the pros and cons to this setup, as well as possible future directions.</p>
<p><em>EDIT 2009-Oct-03 2:25 PM Pacific &#8211; create dir before cding into it; add read-only (ro) option to usr mount; override &#8220;host&#8221; header in user Apache process</em></p>
<p><em>EDIT 2009-Oct-05 4:41 PM Pacific &#8211; load resolver library and install caching proxy dns server, needed by popular wordpress anti-spam plugin Akismet<br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2009/10/03/secure-shared-web-hosting-on-ubuntu-server-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Secure shared web hosting on Ubuntu Server, part 1</title>
		<link>http://anyhosting.com/blog/2009/10/01/secure-shared-web-hosting-on-ubuntu-server-part-1/</link>
		<comments>http://anyhosting.com/blog/2009/10/01/secure-shared-web-hosting-on-ubuntu-server-part-1/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 01:51:07 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=63</guid>
		<description><![CDATA[We&#8217;ve gone over securing a shared hosting setup briefly in the past, but I have made some improvements and simplifications that I&#8217;d like to share. This is part 1 of 3, an introduction to secure shared web hosting on Ubuntu Server.
At AnyHosting we want to have multiple users on one shared server, but  protect [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve gone over securing a shared hosting setup briefly <a href="http://anyhosting.com/blog/2008/01/14/web-hosting-with-ubuntu-server/">in the past</a>, but I have made some improvements and simplifications that I&#8217;d like to share. This is part 1 of 3, an introduction to secure shared web hosting on Ubuntu Server.</p>
<p>At AnyHosting we want to have multiple users on one shared server, but  protect them from reading or writing each other&#8217;s files (whether  accidental or intentional) and also limit damage caused by a break-in  via a poorly configured PHP script or CGI, or even an Apache exploit.</p>
<p>The solution here is to have each customer run their own Apache process, and do <a href="http://en.wikipedia.org/wiki/Virtual_hosting#Name-based">name-based virtual hosting</a> and forwarding via a <a href="http://en.wikipedia.org/wiki/Reverse_proxy">reverse proxy</a>. The proxy is currently Apache but we are also considering more scalable alternatives such as <a href="http://en.wikipedia.org/wiki/Nginx">nginx</a>. An important thing to note here is that the proxy could be on a separate machine and also combine <a href="http://en.wikipedia.org/wiki/Load_balancing_%28computing%29">load-balancing</a> into the mix, so it provides a lot of flexibility.</p>
<p>The <a href="http://www.faqs.org/docs/securing/chap29sec254.html">classic way to chroot Apache</a> (or any server process) is to copy the server process and all of it&#8217;s dependencies into the chroot jail, which makes keeping the files up to date not just a depressing chore but also a serious security hazard. Also it&#8217;s a ton of work to get right, especially if you want to support server-side scripting like PHP, since it depends on lots of system files and libraries.</p>
<p>Enter <a href="http://core.segfault.pl/~hobbit/mod_chroot/">mod_chroot</a>. This Apache module runs in the user&#8217;s process, and does the chroot system call after opening all the files it needs. The only caveats I&#8217;ve found (besides the ones on the mod_chroot <a href="http://core.segfault.pl/~hobbit/mod_chroot/caveats.html">caveats page</a>) are some files that the Ubuntu PHP install assumes it can reach (such as the MySQL server socket, timezone info, and random number generator). I will cover this in more detail in part 2.</p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2009/10/01/secure-shared-web-hosting-on-ubuntu-server-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google App Engine becoming more useful</title>
		<link>http://anyhosting.com/blog/2009/02/08/google-app-engine-becoming-more-useful/</link>
		<comments>http://anyhosting.com/blog/2009/02/08/google-app-engine-becoming-more-useful/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 06:48:58 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[customers]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[web hosting]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=38</guid>
		<description><![CDATA[I&#8217;ve been trying out the cloud computing service Google App Engine for a simple dynamic site. I&#8217;ll publish more details on this as it gets further along.
I have heard and read a lot about App Engine, so I knew roughly what to expect, but I am still impressed with it. It is a very simple [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been trying out the cloud computing service <a href="http://code.google.com/appengine/">Google App Engine</a> for a simple dynamic site. I&#8217;ll publish more details on this as it gets further along.</p>
<p>I have heard and read a lot about App Engine, so I knew roughly what to expect, but I am still impressed with it. It is a very simple model, it&#8217;s basically CGI with a 10-second limit. Only the <a href="http://python.org">Python</a> programming language is supported right now (although they plan to add <a href="http://code.google.com/appengine/docs/whatisgoogleappengine.html">more</a>), and the <a href="http://www.djangoproject.com/">Django</a> web framework is pre-installed. There is a nice little <a href="http://code.google.com/p/googleappengine/">SDK</a> for running the environment locally, which I just noticed is open-source as well (Apache license).</p>
<p>The really incredible thing about this is that it runs on and takes advantage of Google&#8217;s massive server infrastructure. In-memory or persistent storage is super fast and easy to use, and no need to worry about redundancy of individual servers (this is probably why they use the CGI+shared storage model, way simpler to distribute applications on-demand).</p>
<p>Today the <a href="http://googleappengine.blogspot.com/2009/02/roadmap-update.html">roadmap</a> was updated to include a few very cool features coming later this year:</p>
<ul>
<li>Support for running scheduled tasks</li>
<li>Task queues for performing background processing</li>
<li>Ability to receive and process incoming email</li>
<li>Support for sending and receiving XMPP (Jabber) messages</li>
</ul>
<p>This environment being so easy to use and the cost being low due, which is likely because the price of hosting so marginal to Google (I imagine that they are effectively outsourcing spare capacity) plus these new features pretty much replace the need for a traditional shared or dedicated server.</p>
<p>They haven&#8217;t yet started charging for the service, but <a href="http://googleappengine.blogspot.com/2008/05/announcing-open-signups-expected.html">proposed pricing</a> is available, and they plan to start charging this year. The price is quite low considering the feature set, is pay-per-use, and is comparable with the popular cloud computing service <a href="http://anyhosting.com/blog/2007/05/13/pay-as-you-go-hosting/">Amazon Web Services</a> (AWS).</p>
<p>The difference between this and something like AWS is that while it is much easier to get from start to finish on Google App Engine, one must (likely) re-write your application in Python, using Google&#8217;s libraries. You&#8217;ve got less flexibility than a shared PHP host, for example; you can&#8217;t easily take your code elsewhere. AWS is on the other end of the spectrum, more like dedicated servers where you can install anything you want: Linux or Windows, PHP or .Net, etc.</p>
<p>In any case I highly recommend checking out <a href="http://code.google.com/appengine/">Google App Engine</a>, especially if you&#8217;re doing any new development. If you&#8217;re looking to move your existing servers to the cloud, then I think <a href="http://aws.amazon.com/">Amazon Web Services</a> still has the edge here.</p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2009/02/08/google-app-engine-becoming-more-useful/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>secure hosting using a proxy</title>
		<link>http://anyhosting.com/blog/2007/05/21/secure-hosting-using-a-proxy/</link>
		<comments>http://anyhosting.com/blog/2007/05/21/secure-hosting-using-a-proxy/#comments</comments>
		<pubDate>Mon, 21 May 2007 06:17:58 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=12</guid>
		<description><![CDATA[One thing I didn&#8217;t cover in my post about secure web hosting is how to do virtual hosting when you&#8217;re running different instances of the web server (be they in a virtualized environment, a chroot, or just different users on the same host, or even a standalone server like Tomcat, JBoss, Weblogic, Ruby on Rails, [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I didn&#8217;t cover in my post about <a href="http://anyhosting.com/blog/?p=11">secure web hosting</a> is how to do <a href="http://en.wikipedia.org/wiki/Virtual_hosting">virtual hosting</a> when you&#8217;re running different instances of the web server (be they in a virtualized environment, a chroot, or just different users on the same host, or even a standalone server like Tomcat, JBoss, Weblogic, Ruby on Rails, etc.).</p>
<p>Note that you can&#8217;t host <a href="http://en.wikipedia.org/wiki/Ssl">secure (SSL)</a> sites via any kind of name-based virtual hosting, because <a href="http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#vhosts">SSL happens before HTTP</a>.  However, you can do IP-based virtual hosting, meaning that you need an <a href="http://en.wikipedia.org/wiki/Ip_address">IP address</a> for each secure site.</p>
<p>A simple approach is to set up Apache to proxy requests from your primary server to the actual client server. IBM Developerworks has an <a href="http://www-128.ibm.com/developerworks/web/library/wa-lampsec/index.html">excellent article</a> on this, complete with an image that underscores the compartmentalization aspect I was hitting on before:</p>
<p><img src="http://www-128.ibm.com/developerworks/web/library/wa-lampsec/example.gif" /></p>
<p>In this illustration, the &#8220;backend servers&#8221; can be on separate hosts, virtual hosts, or the same host (as long as each web server instance uses a different HTTP <a href="http://en.wikipedia.org/wiki/Computer_port_%28software%29">port</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2007/05/21/secure-hosting-using-a-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>secure web hosting</title>
		<link>http://anyhosting.com/blog/2007/05/20/secure-web-hosting/</link>
		<comments>http://anyhosting.com/blog/2007/05/20/secure-web-hosting/#comments</comments>
		<pubDate>Sun, 20 May 2007 03:14:47 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=11</guid>
		<description><![CDATA[We&#8217;ve done both managed hosting as well as virtual hosting at AnyHosting, and there are many challenges to doing it securely. As Bruce Schneier is fond of saying, &#8220;Security is a process, not a product.&#8220;. All of the techniques described in this post aim to mitigate the amount of damage a successful attack can do, [...]]]></description>
			<content:encoded><![CDATA[<p class="mastname">We&#8217;ve done both managed hosting as well as virtual hosting at AnyHosting, and there are many challenges to doing it securely. As <a href="http://www.schneier.com/">Bruce Schneier</a> is fond of saying, &#8220;<a href="http://www.schneier.com/crypto-gram-0005.html">Security is a process, not a product.</a>&#8220;. All of the techniques described in this post aim to mitigate the amount of damage a successful attack can do, but this must be part of an overall security strategy, which is beyond the scope of this post (but I&#8217;ll say more about in the future).  <!-- /robots --></p>
<p>There are many aspects to security; what I&#8217;m talking about today is <a href="http://en.wikipedia.org/wiki/Compartmentalization_%28computer_science%29">compartmentalization</a> -  that is, either physically or virtually separating customers from each other (into separate &#8220;compartments&#8221;), so that a break-in to one service does not result in a break in to all of them.</p>
<p>When you&#8217;re doing managed hosting of separate physical servers (or even virtual private servers), there&#8217;s generally a lot less to worry about &#8211; a malicious user getting access to one customer&#8217;s server does not generally lead to a break-in of all your customer&#8217;s servers, unless you&#8217;ve been lax with password or network security (e.g. not using encryption inside your network, using the same passwords everywhere, etc.).</p>
<p>However, virtual hosting presents much more of a challenge to secure properly, as the whole point is to use the same server instance for multiple sites. The primary problem is that most servers operating systems that use <a href="http://httpd.apache.org/">Apache</a> (the <a href="http://www.netcraft.com/survey/">most popular web server</a> on the net right now) run all websites as the same user, which means that if you allow dynamic scripts to be run (CGI, PHP, etc.) then all users have read/write access to all files on that server.</p>
<p>The halfway point between VPS and virtual hosting is operating system-level virtualization. You&#8217;ve got different choices depending on OS: <a href="http://en.wikipedia.org/wiki/Solaris_Containers">Solaris Containers</a>, <a href="http://en.wikipedia.org/wiki/FreeBSD_Jail">FreeBSD Jails</a>, and <a href="http://en.wikipedia.org/wiki/Linux-VServer">Linux VServers</a>  are all popular choices. These each give the customer a private filesystem and process list, as well as allowing the web host to limit resources like CPU, memory and I/O.</p>
<p>A solution of last resort is the Unix command &#8220;<a href="http://en.wikipedia.org/wiki/Chroot">chroot</a>&#8220;, which at least separates the filesystem from separate users, but does not allow the host to control resources and care must be taken to prevent users from <a href="http://www.bpfh.net/simes/computing/chroot-break.html">breaking out</a>. Tools like <a href="http://olivier.sessink.nl/jailkit/">jailkit</a> can be helpful, if you decide that you need to go this route.</p>
<p>The safest and easiest way to host separate sites is of course separate physical servers for each client; it&#8217;s also of course the most expensive. The cost/effort ratio continues in the same direction as you look at VPS, OS-level virtualization, chroot and finally no separation (this is only applicable if you either manage everything yourself and do not allow user uploads, or don&#8217;t allow dynamic scripting of any kind &#8211; however, you still run the risk of a break-in to one site affecting all of your customers).</p>
<p><em>(EDIT: fixed jailkit link)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2007/05/20/secure-web-hosting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
