<?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>Myatu&#039;s</title>
	<atom:link href="http://www.myatus.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.myatus.co.uk</link>
	<description>Wasting bits and bytes daily</description>
	<lastBuildDate>Thu, 02 Sep 2010 19:01:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<atom:link rel='hub' href='http://www.myatus.co.uk/?pushpress=hub'/>
		<item>
		<title>Blocking w00tw00t scans</title>
		<link>http://www.myatus.co.uk/2010/07/17/blocking-w00tw00t-scans/</link>
		<comments>http://www.myatus.co.uk/2010/07/17/blocking-w00tw00t-scans/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 10:53:38 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/?p=1401</guid>
		<description><![CDATA[Some websites are still being hit with the infamous &#8220;w00tw00t&#8221; scans. You might see these scans in your logs as: ... &#34;GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1&#34; 400 ... Using Iptables The quickest method of making sure it never reaches your webserver (and thus wasting resources like processor, disk space [log files], etc) is to use iptables, and [...]


Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/03/20/guide-firewall-and-router-with-proxmox-extending-its-us/' rel='bookmark' title='Permanent Link: Guide: Firewall and router with Proxmox &#8211; Extending its use'>Guide: Firewall and router with Proxmox &#8211; Extending its use</a></li>
<li><a href='http://www.myatus.co.uk/2009/08/31/guide-firewall-and-router-with-proxmox/' rel='bookmark' title='Permanent Link: Guide: Firewall and router with Proxmox'>Guide: Firewall and router with Proxmox</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Some websites are still being hit with the infamous &#8220;w00tw00t&#8221; scans. You might see these scans in your logs as:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">... &quot;GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1&quot; 400 ...</div></div>
</pre>
<h3>Using Iptables</h3>
<p>The quickest method of making sure it never reaches your webserver (and thus wasting resources like processor, disk space [log files], etc) is to use iptables, and it can be done with a one-liner like this:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">iptables <span style="color: #660033;">-I</span> INPUT <span style="color: #660033;">-d</span> xxx.xxx.xxx.xxx <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">80</span> <span style="color: #660033;">-m</span> string <span style="color: #660033;">--to</span> <span style="color: #000000;">70</span> &nbsp;<span style="color: #660033;">--algo</span> bm <span style="color: #660033;">--string</span> <span style="color: #ff0000;">'GET /w00tw00t.at.ISC.SANS.'</span> <span style="color: #660033;">-j</span> DROP</div></div>
</pre>
<p>Simply replace <em>xxx.xxx.xxx.xxx</em> with the IP of your web server. If you want to use this for a range of IPs (ie., you&#8217;re using multiple IPs to host web servers), simply replace the &#8220;-d xxx.xxx.xxx.xxx&#8221; portion with:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #660033;">-m</span> iprange <span style="color: #660033;">--dst-range</span> start.xxx.xxx.xxx-end.xxx.xxx.xxx</div></div>
</pre>
<p>where <em>start.xxx.xxx.xxx</em> and <em>end.xxx.xxx.xxx</em> are the first and last IPs of your web servers respectively.<span id="more-1401"></span></p>
<p>If you wish to have a fancier option, one where it will for example blacklist an IP for a certain period, etc., have a look at <a title="SpamCle@ner w00tw00t" href="http://spamcleaner.org/en/misc/w00tw00t.html" target="_blank">SpamCle@ner&#8217;s website</a>.</p>
<p>They go deeper into this subject and have provided two scripts near the end of their article. Simply save one of these scripts in a file named, for example, <em>/opt/blockw00t.sh</em> and make it executable with:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>blockw00t.sh</div></div>
</pre>
<p>You can run it manually with typing &#8220;/opt/blockwoot.sh&#8221; in the shell or to automatically load it at boot time you can add it to your <em>/etc/rc.local </em>file, or on Debian/Ubuntu systems add it to your <em>/etc/network/interfaces</em> like so:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">auto eth0<br />
inet eth0 static<br />
&nbsp; &nbsp;... [existing configuration that remains unaltered] ...<br />
&nbsp; &nbsp;# Load anti-w00t script:<br />
&nbsp; &nbsp;post-up /opt/blockw00t.sh</div></div>
</pre>
<h3>Using Fail2Ban</h3>
<p>If you are using <a title="Fail2Ban" href="http://www.fail2ban.org" target="_blank">Fail2Ban</a>, like described in the <a title="Guide: Firewall and router with Proxmox – Extending its use" href="http://www.myatus.co.uk/2010/03/20/guide-firewall-and-router-with-proxmox-extending-its-us/" target="_self">Shorewall firewall configuration</a>, you can create a new definition that scans for the w00tw00t entries in the webserver log files.</p>
<p>The following definition assumes your webserver log entries look like the following (Nginx and Apache 2):</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">203.127.11.214 - - [15/Jul/2010:15:50:04 +0200] &quot;GET /w00tw00t.at.ISC.SANS.test0:) HTTP/1.1&quot; 400 173 &quot;-&quot; &quot;-&quot;</div></div>
</pre>
<p>Create a file <em>/etc/fail2ban/filter.d/webserver-w00tw00t.conf</em>:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[Definition]<br />
failregex = ^&lt;HOST&gt; .*&quot;GET \/w00tw00t\.at\.ISC\.SANS\..+\:\).*?&quot;<br />
<br />
ignoreregex =</div></div>
</pre>
<p>This catches the known variants of the scanner, including &#8220;DFind&#8221;, &#8220;test0&#8243;, &#8220;MSlog&#8221; and &#8220;ntsvc&#8221;.</p>
<p>Note: The <em>&lt;HOST&gt;</em> portion is specific to fail2ban and is a shorthand for the regex <em>(?:::f{4,6}:)?(?P&lt;host&gt;\S+)</em>, which matches either an IPv4 or IPv6 address. See the <a title="Fail2Ban manual, filters" href="http://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Filters" target="_blank">fail2ban manual</a> for more details.</p>
<p>*Tip: If you wish to change the regular expression, I recommend <a title="RegExr" href="http://gskinner.com/RegExr" target="_blank">RegExr</a> to play with various options/search criteria. It&#8217;s a time saver and free :)</p>
<p>*Tip 2: To test your definition&#8217;s regular expression, use:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">fail2ban-regex logfile <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>fail2ban<span style="color: #000000; font-weight: bold;">/</span>filter.d<span style="color: #000000; font-weight: bold;">/</span>webserver-w00tw00t.conf</div></div>
</pre>
<p>Where <em>logfile</em> is the actual log file name, such as <em>/var/log/apache2/access.log</em>.</p>
<p>Add this definition to the fail2ban Jail configuration (<em>/etc/fail2ban/jail.conf</em>):</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">... [existing configuration] ...<br />
<br />
[webserver-w00tw00t]<br />
enabled &nbsp;= true<br />
port &nbsp; &nbsp; = http,https<br />
filter &nbsp; = webserver-w00tw00t<br />
# !!! Keep in mind to specify the correct web server log here:<br />
logpath &nbsp;= /var/log/apache2/access.log<br />
maxretry = 1<br />
# Time in seconds, in this case, one day:<br />
bantime &nbsp;= 86400</div></div>
</pre>
<p>Now reload the service (ie., &#8220;/etc/init.d/fail2ban reload&#8221; or &#8220;service fail2ban reload&#8221;).</p>
<div class="shr-publisher-1401"></div>

<p>Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/03/20/guide-firewall-and-router-with-proxmox-extending-its-us/' rel='bookmark' title='Permanent Link: Guide: Firewall and router with Proxmox &#8211; Extending its use'>Guide: Firewall and router with Proxmox &#8211; Extending its use</a></li>
<li><a href='http://www.myatus.co.uk/2009/08/31/guide-firewall-and-router-with-proxmox/' rel='bookmark' title='Permanent Link: Guide: Firewall and router with Proxmox'>Guide: Firewall and router with Proxmox</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/07/17/blocking-w00tw00t-scans/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A simplified Nginx-Apache combo with WordPress support</title>
		<link>http://www.myatus.co.uk/2010/06/28/a-simplified-nginx-apache-combo-with-wordpress-support/</link>
		<comments>http://www.myatus.co.uk/2010/06/28/a-simplified-nginx-apache-combo-with-wordpress-support/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 22:03:21 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[benchmarking]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/?p=617</guid>
		<description><![CDATA[It looks like I have neglected to write a new article in quite a while! Shame on me. But, thanks to a website outage, I&#8217;ve finally got some more good stuff to share with you. My previous Nginx configuration became a nightmare to maintain and WordPress had become slower because Apache&#8217;s children were being killed [...]


Related posts:<ol><li><a href='http://www.myatus.co.uk/2009/08/31/nginx-and-apache-but-no-memcached/' rel='bookmark' title='Permanent Link: NginX and Apache, but no memcached'>NginX and Apache, but no memcached</a></li>
<li><a href='http://www.myatus.co.uk/2009/12/17/faster-wp-super-cache-with-nginx/' rel='bookmark' title='Permanent Link: Faster WP Super Cache with NginX'>Faster WP Super Cache with NginX</a></li>
<li><a href='http://www.myatus.co.uk/2009/09/07/compiling-nginx-on-debian-ubuntu/' rel='bookmark' title='Permanent Link: Compiling NginX on Debian / Ubuntu'>Compiling NginX on Debian / Ubuntu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" src="http://wiki.nginx.org/images/0/0e/Absolut_nginx.jpg" alt="Absolut Nginx" width="90" height="250" />It looks like I have neglected to write a new article in quite a while! Shame on me. But, thanks to a website outage, I&#8217;ve finally got some more good stuff to share with you.</p>
<p>My previous Nginx configuration became a nightmare to maintain and WordPress had become slower because Apache&#8217;s children were being killed by OOM. This was due to a  misguided PHP cache (PHP XCache to be precise) that decided to take every available bit of memory from my system, despite having max-requests per child set low (before it was purged).</p>
<p>This, along with my endeavors in seeking the fastest solution to everything and the introduction of a new Cloud servers by OVH, lead me to today&#8217;s article.<span id="more-617"></span></p>
<h2>Which is faster &#8211; Varnish or Nginx?</h2>
<p>The first thing I wanted to do is make all the caching happen before things get pushed through to Apache. This because I wanted to eliminate both PHP <a title="XCache" href="http://xcache.lighttpd.net" target="_blank">XCache</a> and the <a title="WP Super Cache" href="http://ocaoimh.ie/wp-super-cache" target="_blank">WordPress Super Cache</a> plugin I was using, so to increase WordPress compatibility but decrease complexity.</p>
<p>At first I thought about using <a title="Varnish Cache" href="http://varnish-cache.org" target="_blank">Varnish</a> &#8211; either as a the sole front-end, or in between Nginx and Apache (the reasoning later). Also, I had gotten my hands on OVH&#8217;s Cloud servers whilst they were still in <em>&#8220;alpha&#8221;</em>, and used this as the base system for building a pool of web servers.</p>
<p>The following tests have all been performed on those Cloud servers &#8211; mC 256 (256 MBytes of guaranteed RAM, 2 GByte total memory with excess swapped to SSD&#8217;s), 4 CPU cores and 5 GBytes of storage space. The OS is Ubuntu 10.04 LTS. The output of <em>/proc/cpuinfo</em> is as following (x4 for briefness):</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">processor &nbsp; &nbsp; &nbsp; : 0<br />
vendor_id &nbsp; &nbsp; &nbsp; : GenuineIntel<br />
cpu family &nbsp; &nbsp; &nbsp;: 6<br />
model &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 26<br />
model name &nbsp; &nbsp; &nbsp;: Intel(R) Xeon(R) CPU &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; E5504 &nbsp;@ 2.00GHz<br />
stepping &nbsp; &nbsp; &nbsp; &nbsp;: 5<br />
cpu MHz &nbsp; &nbsp; &nbsp; &nbsp; : 1995.000<br />
cache size &nbsp; &nbsp; &nbsp;: 4096 KB<br />
fdiv_bug &nbsp; &nbsp; &nbsp; &nbsp;: no<br />
hlt_bug &nbsp; &nbsp; &nbsp; &nbsp; : no<br />
f00f_bug &nbsp; &nbsp; &nbsp; &nbsp;: no<br />
coma_bug &nbsp; &nbsp; &nbsp; &nbsp;: no<br />
fpu &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : yes<br />
fpu_exception &nbsp; : yes<br />
cpuid level &nbsp; &nbsp; : 11<br />
wp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: yes<br />
flags &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf pni ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm<br />
bogomips &nbsp; &nbsp; &nbsp; &nbsp;: 3990.00<br />
clflush size &nbsp; &nbsp;: 64<br />
cache_alignment : 64<br />
address sizes &nbsp; : 40 bits physical, 48 bits virtual<br />
power management:</div></div>
</pre>
<div>
<p>The stock install of Apache performed as following on a simple &#8220;Hello World&#8221; PHP script, using &#8220;<em>ab -c 100 -n 100000 http://host/</em>&#8220;:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Concurrency Level: &nbsp; &nbsp; &nbsp;100<br />
Time taken for tests: &nbsp; 29.548 seconds<br />
Complete requests: &nbsp; &nbsp; &nbsp;100000<br />
Failed requests: &nbsp; &nbsp; &nbsp; &nbsp;0<br />
Write errors: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0<br />
Total transferred: &nbsp; &nbsp; &nbsp;25009500 bytes<br />
HTML transferred: &nbsp; &nbsp; &nbsp; 3901482 bytes<br />
Requests per second: &nbsp; &nbsp;3384.27 [#/sec] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 29.548 [ms] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 0.295 [ms] (mean, across all concurrent requests)<br />
Transfer rate: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;826.55 [Kbytes/sec] received<br />
<br />
Connection Times (ms)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min &nbsp;mean[+/-sd] median &nbsp; max<br />
Connect: &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; 12 &nbsp;39.1 &nbsp; &nbsp; 12 &nbsp; &nbsp;1960<br />
Processing: &nbsp; &nbsp; 9 &nbsp; 18 &nbsp;49.6 &nbsp; &nbsp; 14 &nbsp; &nbsp;2036<br />
Waiting: &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; 15 &nbsp;45.9 &nbsp; &nbsp; 12 &nbsp; &nbsp;1966<br />
Total: &nbsp; &nbsp; &nbsp; &nbsp; 14 &nbsp; 29 &nbsp;65.9 &nbsp; &nbsp; 26 &nbsp; &nbsp;2159</div></div>
</pre>
<p>With Varnish in front of Apache, things really started to look good:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Concurrency Level: &nbsp; &nbsp; &nbsp;100<br />
Time taken for tests: &nbsp; 13.489 seconds<br />
Complete requests: &nbsp; &nbsp; &nbsp;100000<br />
Failed requests: &nbsp; &nbsp; &nbsp; &nbsp;0<br />
Write errors: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0<br />
Total transferred: &nbsp; &nbsp; &nbsp;28315282 bytes<br />
HTML transferred: &nbsp; &nbsp; &nbsp; 1100594 bytes<br />
Requests per second: &nbsp; &nbsp;7413.64 [#/sec] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 13.489 [ms] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 0.135 [ms] (mean, across all concurrent requests)<br />
Transfer rate: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2049.99 [Kbytes/sec] received<br />
<br />
Connection Times (ms)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min &nbsp;mean[+/-sd] median &nbsp; max<br />
Connect: &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;6 &nbsp; 2.2 &nbsp; &nbsp; &nbsp;6 &nbsp; &nbsp; &nbsp;71<br />
Processing: &nbsp; &nbsp; 2 &nbsp; &nbsp;7 &nbsp; 1.9 &nbsp; &nbsp; &nbsp;7 &nbsp; &nbsp; &nbsp;70<br />
Waiting: &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp;6 &nbsp; 2.0 &nbsp; &nbsp; &nbsp;5 &nbsp; &nbsp; &nbsp;66<br />
Total: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 &nbsp; 13 &nbsp; 3.1 &nbsp; &nbsp; 13 &nbsp; &nbsp; &nbsp;81</div></div>
</pre>
<p>At 2.48x more than what Apache can send out on its own, that&#8217;s a mighty impressive improvement and Varnish deserves kudos. But at 1 GBytes of RAM for caching, would it really be more efficient and quicker than Nginx? The following results tell &#8230;</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Concurrency Level: &nbsp; &nbsp; &nbsp;100<br />
Time taken for tests: &nbsp; 9.438 seconds<br />
Complete requests: &nbsp; &nbsp; &nbsp;100000<br />
Failed requests: &nbsp; &nbsp; &nbsp; &nbsp;0<br />
Write errors: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0<br />
Total transferred: &nbsp; &nbsp; &nbsp;27706648 bytes<br />
HTML transferred: &nbsp; &nbsp; &nbsp; 5201248 bytes<br />
Requests per second: &nbsp; &nbsp;10595.55 [#/sec] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 9.438 [ms] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 0.094 [ms] (mean, across all concurrent requests)<br />
Transfer rate: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2866.87 [Kbytes/sec] received<br />
<br />
Connection Times (ms)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min &nbsp;mean[+/-sd] median &nbsp; max<br />
Connect: &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;4 &nbsp; 1.0 &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; &nbsp;56<br />
Processing: &nbsp; &nbsp; 2 &nbsp; &nbsp;6 &nbsp; 9.7 &nbsp; &nbsp; &nbsp;5 &nbsp; &nbsp; 253<br />
Waiting: &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;5 &nbsp; 9.7 &nbsp; &nbsp; &nbsp;5 &nbsp; &nbsp; 253<br />
Total: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 &nbsp; &nbsp;9 &nbsp; 9.7 &nbsp; &nbsp; &nbsp;9 &nbsp; &nbsp; 257</div></div>
</pre>
<p>&#8230; a different story. Though this is not some scientific research that should be taken at face value, I personally found the difference rather significant &#8211; especially since Nginx never used more than 60 Mbytes of RAM and relied mostly on system file  caching. 1.39x faster than Varnish, 3.46x faster than Apache by itself. That&#8217;s even more impressive!</p>
<h3>A little Varnish quirk on Ubuntu</h3>
<p>Again, and I can&#8217;t say this often enough, these are merely the numbers obtained on my system &#8211; your mileage may vary. Varnish is definitely a worthy contender &#8212; the one issue I encountered on Ubuntu was that Varnish crashed when attempting to test with more than 1000 concurrent connections. That&#8217;s not supposed to happen in a production environment!</p>
<p>The culprit seems to be the user account&#8217;s <em>&#8220;open file descriptors&#8221;</em> limitation. Sockets are also counted towards this value and when Varnish had hit the limit it died rather ungracefully. You can manually resolve it by using ulimit:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">65535</span></div></div>
</pre>
<p>But you are better off using the <em>/etc/security/limits.conf</em> file. It is well documented, so it shouldn&#8217;t be to difficult to figure it out. I&#8217;ll continue with my blog&#8230;</p>
<h2>The Configuration</h2>
<p>So I have decided to keep Nginx as the front-end for Apache, but this time &#8211; unlike previously &#8211; activate Nginx&#8217;s caching. Doing it here, rather than working with caching plugins and a plethora of other band-aids, keeps the whole configuration clean and simple. Apache can be left alone to run as it normally does, with no special trickery. The only exception is a memcache store, because the database is located on a different server and linked through a VPN.</p>
<p>First I installed Nginx, Apache, PHP5 and Memcache through the usual channels, as following:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> nginx libapache2-mod-php5 memcached \<br />
php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick \<br />
php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming \<br />
php5-ps php5-pspell php5-recode php5-snmp php5-sqlite \<br />
php5-tidy php5-xmlrpc php5-xsl php5-json</div></div>
</pre>
<h3>Update Nginx</h3>
<p>The Nginx version provided by the Ubuntu repository is 0.7.65. However, a feature introduced in version 0.7.66/stable - <em>proxy_no_cache</em> &#8211; will come handy simplifying the configuration. 0.7.67 also fixed a small issue, which mainly concerns Windows machines but is good to have patched regardless. So I&#8217;ve compiled Nginx to the latest stable version as following:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># apt-get install libc6 libpcre3 libpcre3-dev libpcrecpp0 libssl0.9.8 libssl-dev zlib1g zlib1g-dev lsb-base</span><br />
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.nginx.org<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span>nginx-0.7.67.tar.gz<br />
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xf</span> nginx-0.7.67.tar.gz<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> nginx-0.7.67<br />
.<span style="color: #000000; font-weight: bold;">/</span>configure \<br />
<span style="color: #660033;">--user</span>=www-data \<br />
<span style="color: #660033;">--group</span>=www-data \<br />
<span style="color: #660033;">--sbin-path</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin \<br />
<span style="color: #660033;">--conf-path</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>nginx.conf \<br />
<span style="color: #660033;">--error-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>error.log \<br />
<span style="color: #660033;">--pid-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx.pid \<br />
<span style="color: #660033;">--lock-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lock<span style="color: #000000; font-weight: bold;">/</span>nginx.lock \<br />
<span style="color: #660033;">--http-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>access.log \<br />
<span style="color: #660033;">--http-client-body-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>body \<br />
<span style="color: #660033;">--http-proxy-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>proxy \<br />
<span style="color: #660033;">--http-fastcgi-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>fastcgi \<br />
<span style="color: #660033;">--with-debug</span> \<br />
--with-http_stub_status_module \<br />
--with-http_flv_module \<br />
--with-http_ssl_module \<br />
--with-http_dav_module \<br />
--with-http_gzip_static_module \<br />
--with-http_realip_module \<br />
<span style="color: #660033;">--with-mail</span> \<br />
--with-mail_ssl_module \<br />
<span style="color: #660033;">--with-ipv6</span><br />
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></div></div>
</pre>
<p>Yes, that&#8217;s literally cut &amp; paste. It overwrites the binaries installed by <em>apt-get</em>, and we happily continue to use the official init script provided by Ubuntu/Debian. Why make life difficult?</p>
<h3>Configuring PHP and Apache</h3>
<p>At this point, configure PHP and Apache to your heart&#8217;s content. The one thing that you need to do with Apache is move it to a different port and preferably keep it on 127.0.0.1. This means you need to edit the /etc/apache2/ports.conf file:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">NameVirtualHost *:8080<br />
Listen 127.0.0.1:8080</div></div>
</pre>
<p>And configure your website(s) accordingly:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;VirtualHost *:8080&gt;<br />
... etc ...<br />
&lt;/VirtualHost&gt;</div></div>
</pre>
<p>If you are using SSL (https://), this will be handled by Nginx rather than Apache. Since this is already getting quite long, I will skip SSL in this blog.</p>
<h3>Configuring Nginx</h3>
<p>We start off by creating a few directories that will be used by Nginx:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>includes<br />
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>tmp<br />
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>cached<br />
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>nginx</div></div>
</pre>
<p>Next we modify the file <em>/etc/nginx/nginx.conf</em> as following:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">user &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;www-data;<br />
<br />
worker_processes &nbsp; &nbsp; &nbsp; &nbsp;4;<br />
worker_rlimit_nofile &nbsp; &nbsp;16384;<br />
<br />
error_log &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /var/log/nginx/error.log;<br />
pid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /var/run/nginx.pid;<br />
<br />
events {<br />
&nbsp; &nbsp; &nbsp; &nbsp; worker_connections &nbsp;2000;<br />
}<br />
<br />
http {<br />
&nbsp; &nbsp; &nbsp; &nbsp; include &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /etc/nginx/mime.types;<br />
&nbsp; &nbsp; &nbsp; &nbsp; default_type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;application/octet-stream;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; access_log &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/var/log/nginx/access.log;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; sendfile &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on;<br />
&nbsp; &nbsp; &nbsp; &nbsp; tcp_nopush &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on;<br />
&nbsp; &nbsp; &nbsp; &nbsp; tcp_nodelay &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; on;<br />
&nbsp; &nbsp; &nbsp; &nbsp; keepalive_timeout &nbsp; &nbsp; &nbsp; 75 20;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; gzip &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gzip_vary &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; on;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gzip_comp_level &nbsp; &nbsp; &nbsp; &nbsp; 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gzip_min_length &nbsp; &nbsp; &nbsp; &nbsp; 4096;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gzip_proxied &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;any;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gzip_types &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;text/plain text/css application/x-javascript text/xml<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; application/xml application/xml+rss text/javascript;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; include &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /etc/nginx/conf.d/*.conf;<br />
&nbsp; &nbsp; &nbsp; &nbsp; include &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /etc/nginx/sites-enabled/*;<br />
}</div></div>
</pre>
<p>The <em>worker_processes</em> variable is set according to the number of CPU cores in my system, 4 in this case. There are a few tcp tweaks and gzip compression is enabled on additional file types, rather than just html.  For the rest, it&#8217;s fairly run-of-the-mill.</p>
<p>The core workhorse of Nginx will be the proxy and its associated cache. Because I like to keep things nicely sectioned, thus easy to configure, I&#8217;ve created the following <em>/etc/nginx/conf.d/proxy.conf</em> file, which will be included by Nginx by an <em>include</em> statement:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">proxy_redirect &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;off;<br />
<br />
proxy_set_header &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Host $host;<br />
proxy_set_header &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;X-Forwarded-For $proxy_add_x_forwarded_for;<br />
<br />
proxy_connect_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 90;<br />
proxy_send_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;90;<br />
proxy_read_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;90;<br />
<br />
proxy_buffer_size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4k;<br />
proxy_buffers &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4 32k;<br />
proxy_busy_buffers_size &nbsp; &nbsp; &nbsp; &nbsp; 64k;<br />
proxy_temp_file_write_size &nbsp; &nbsp; &nbsp;64k;<br />
<br />
proxy_max_temp_file_size &nbsp; &nbsp; &nbsp; &nbsp;56m;<br />
proxy_temp_path &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /var/cache/nginx/tmp;<br />
proxy_cache_key &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $scheme$host$request_uri;<br />
proxy_cache_path &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/var/cache/nginx/cached levels=2:2 keys_zone=global:64m inactive=60m max_size=1G;<br />
<br />
proxy_cache_valid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 200 302 30m;<br />
proxy_cache_valid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 301 1h;<br />
proxy_cache_valid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 404 1m;<br />
<br />
proxy_cache_use_stale &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error timeout http_500 http_502 http_503 http_504;<br />
<br />
proxy_pass_header &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Set-Cookie;</div></div>
</pre>
<p>The <em>proxy_set_header</em> variables are there to help you determine the IP of the actual web page requester, rather than receiving the one from Nginx. You just need to include <em>%{X-Forwarded-For}i</em> in one of Apache&#8217;s log formats instead of the host (<em>%h</em>).</p>
<p>However, I have personally disabled all access logging in Apache, because everything needs to pass through Nginx anyway and it boosts Apache&#8217;s performance a smidgen (you do this by commenting out all the <em>CustomLog</em> lines in Apache&#8217;s configurations). I did leave the Apache <em>ErrorLog</em> enabled, just for those instances and also for PHP error messages.</p>
<p>The file above also defines an Nginx proxy cache zone called <em>&#8220;global&#8221;</em> with the <em>proxy_cache_path</em> variable. That same variable also specifies a garbage time (60 minutes) and maximum cache size (on the disk, 1 Gbytes).</p>
<p>The <em>proxy_cache_key</em> is simply a concatenation of <em>&#8220;httpmyatus.co.uk/therequests.php&#8221;</em> that will be hashed and then used to retrieve it at a later point. I&#8217;m allowing stale cache to be served in case of certain errors, for example when Apache has unexpectedly died.</p>
<p>An important bit, which was quite a PITA to figure out, is the <em>proxy_pass_header</em> portion for the <em>&#8220;Set-Cookie&#8221;</em> header. WordPress includes <em>&#8220;Set-Cookie&#8221;</em> headers in 302 HTTP responses (which is used to point your browser to a new location) &#8211; some frown upon this practice and Nginx is no exception. Hence we need to specifically let this pass through, or else you will not be able to login to your WordPress Admin or have users leave comments.</p>
<h3>Includes</h3>
<p>In the <em>/etc/nginx/includes</em> folder we created earlier, we add two files. The first is a helper for sites that use WordPress. Since the <em>/etc/nginx/includes</em> folder is not automatically included, we can be selective about inclusions, and save on some processing time when these features aren&#8217;t used. This is the <em>/etc/nginx/includes/wordpress.inc</em> file:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">if ($http_cookie ~* &quot;comment_author_|wordpress_(?!test_cookie)|wp-postpass_&quot;) {<br />
&nbsp; &nbsp; set $no_cache 1;<br />
}<br />
<br />
if ($http_user_agent ~* &quot;(2\.0 MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine\/3\.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA\/WX310K|LG\/U990|MIDP-2\.|MMEF20|MOT-V|NetFront|Newt|Nintendo Wii|Nitro|Nokia|Opera Mini|Palm|PlayStation Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian OS|SymbianOS|TS21i-10|UP\.Browser|UP\.Link|webOS|Windows CE|WinWAP|YahooSeeker\/M1A1-R2D2|NF-Browser|iPhone|iPod|Android|BlackBerry9530|G-TU915 Obigo|LGE VX|webOS|Nokia5800)&quot; ) {<br />
&nbsp; &nbsp; set $no_cache 1;<br />
}<br />
<br />
proxy_no_cache&nbsp; &nbsp; &nbsp; $no_cache;</div></div>
</pre>
<p>It&#8217;s a very simple file, actually. The first portion checks if there are certain cookies set, related to comment authors or those who are logged into the WordPress Admin. If this is the case, the variable <em>$no_cache</em> is set to 1. The second check is for mobile users, like Nokia, iPhone, etc. This is helpful in case you have a mobile WordPress edition, as available through some plugins.</p>
<p>If at any point the <em>$no_cache</em> is 1, the variable <em>proxy_no_cache</em> becomes true. Apache&#8217;s output might still be cached, but it will not be served to the end user (thus always fresh).</p>
<p><span style="color: #ff0000;">Note:</span> Because the output from Apache may still be cached in this case (but not served), it is quite possible that if the page has not been requested before, it could be used to fill the cache (and thus served at a later point).</p>
<p>For instance, let&#8217;s say someone visits <em>/some/page</em> with a mobile browser. This might be the first visit to this page and will be cached. Someone using a regular browser (say, Firefox or Opera) could then be presented with this mobile cached version, causing some inconsistencies.</p>
<p>You can solve it by adding <em>$http_user_agent</em> to the <em>proxy_cache_key</em> statement in the <em>proxy.conf</em> file described earlier. The drawback here is an increased cache storage requirement, as each browser version gets its own cached version. As for the logged-in WordPress admin/user, never will he/she be presented a cached version &#8211; so this only applies if you&#8217;re using a mobile version of WordPress.</p>
<p>The second file is a helper that&#8217;s pretty much universal for all the websites (but can still be overridden in the actual <em>sites-available/*</em> files). This is the <em>/etc/nginx/includes/default_proxy.inc</em> file:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># Enable caching:<br />
proxy_cache &nbsp; &nbsp; global;<br />
<br />
# Default:<br />
location / {<br />
&nbsp; &nbsp; &nbsp; &nbsp; proxy_pass &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://127.0.0.1:8080;<br />
}<br />
<br />
# Rarely changed items can remain cached longer:<br />
location ~* \.(jpg|jpeg|png|gif|ico|css|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx)$ {<br />
&nbsp; &nbsp; &nbsp; &nbsp; proxy_cache_valid &nbsp; &nbsp; &nbsp; 200 3h;<br />
&nbsp; &nbsp; &nbsp; &nbsp; proxy_pass &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://127.0.0.1:8080;<br />
}<br />
<br />
# Deny access to .ht* files:<br />
location ~ /\.ht {<br />
&nbsp; &nbsp; &nbsp; &nbsp; deny &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;all;<br />
}</div></div>
</pre>
<p>The first variable <em>proxy_cache </em>informs Nginx to use the <em>&#8220;global&#8221;</em> zone we defined earlier in the <em>/etc/nginx/conf.d/proxy.conf </em>file. If it is not there, nothing will be cached and pages simply pass through.</p>
<p>It further tells Nginx to send everything to Apache, but allow images and a few other static files to be cached longer than originally defined. The last portion tells Nginx to block access to files such as <em>.htaccess</em> or <em>.htpasswd</em> right at Nginx&#8217;s level &#8211; so Apache doesn&#8217;t have to and save some processing power.</p>
<h3>A default site</h3>
<p>You can use the include files to build a very small website configuration file. For example, <em>/etc/nginx/sites-available/</em>default may looks something similar to this:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server {<br />
&nbsp; &nbsp; &nbsp; &nbsp; listen &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;80;<br />
&nbsp; &nbsp; &nbsp; &nbsp; server_name &nbsp; &nbsp; _;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/var/www/sites/default/public;<br />
&nbsp; &nbsp; &nbsp; &nbsp; index &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index.html index.htm;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; access_log &nbsp; &nbsp; &nbsp;/var/www/sites/default/logs/access.log;<br />
&nbsp; &nbsp; &nbsp; &nbsp; error_log &nbsp; &nbsp; &nbsp; /var/www/sites/default/logs/nginx.error.log;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; # Includes:<br />
&nbsp; &nbsp; &nbsp; &nbsp; include &nbsp; &nbsp; &nbsp; &nbsp; /etc/nginx/includes/wordpress.inc;<br />
&nbsp; &nbsp; include &nbsp; &nbsp; &nbsp; &nbsp; /etc/nginx/includes/default_proxy.inc;<br />
}</div></div>
</pre>
<p>Everything is passed to Apache and cached, depending of the <em>wordpress.inc</em> file allows it. Apache will handle the rest. You will likely have to change the directories, but that&#8217;s basically it.</p>
<h2>WordPress</h2>
<p>There&#8217;s little that needs to be done with WordPress. The most important thing is to actually disable any WordPress cache you may be using, such as WordPress Super Cache. It is no longer needed and only gives Apache / PHP more work to do. However, as noted earlier, I did include Memcache.</p>
<p>The reason is that in my case, each Cloud server works off the same MySQL database cluster. To avoid unnecessary or repetitive SQL traffic, the Memcache daemon will hold these in RAM memory (or in the Cloud&#8217;s case &#8211; either RAM or SSD). This is done with the use of the <em>object-cache.php</em> file by Ryan Boren, which can be obtained <a title="WordPress Memcached object-cache" href="http://plugins.trac.wordpress.org/browser/memcached/" target="_blank">from this website</a>. This file needs to be placed in your <em>$WP-ROOT$/wp-content/</em> directory.</p>
<p>For everything else, WordPress can be plain vanilla but become blistering fast, as shown in the next output.</p>
<h2>Performance</h2>
<p>I have clustered a Cloud server with a dedicated server. For a short while (as in, half a day) I used HAProxy as the point-of-entry. HAProxy is super-fast, but I was irked by a minor issue that caused some logging issues. Nginx is on-par with HAProxy, though it might have a little more jitter, so I now use an 2x Nginx &lt;&#8211;&gt; 2x (Nginx + Apache) combination. Witt the (Nginx + Apache) portion of this setup configured exactly as described above, I have been able to obtain the following speeds (based on 100 concurrent connections, 50,000 requests and keep-alive enabled):</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Concurrency Level: &nbsp; &nbsp; &nbsp;100<br />
Time taken for tests: &nbsp; 6.694 seconds<br />
Complete requests: &nbsp; &nbsp; &nbsp;50000<br />
Failed requests: &nbsp; &nbsp; &nbsp; &nbsp;0<br />
Write errors: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0<br />
Keep-Alive requests: &nbsp; &nbsp;0<br />
Total transferred: &nbsp; &nbsp; &nbsp;2822197200 bytes<br />
HTML transferred: &nbsp; &nbsp; &nbsp; 2806393092 bytes<br />
Requests per second: &nbsp; &nbsp;7469.02 [#/sec] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 13.389 [ms] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 0.134 [ms] (mean, across all concurrent requests)<br />
Transfer rate: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;411700.31 [Kbytes/sec] received<br />
<br />
Connection Times (ms)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min &nbsp;mean[+/-sd] median &nbsp; max<br />
Connect: &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;2 &nbsp; 0.4 &nbsp; &nbsp; &nbsp;2 &nbsp; &nbsp; &nbsp;16<br />
Processing: &nbsp; &nbsp; 3 &nbsp; 11 &nbsp; 0.8 &nbsp; &nbsp; 11 &nbsp; &nbsp; &nbsp;27<br />
Waiting: &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp;3 &nbsp; 1.2 &nbsp; &nbsp; &nbsp;3 &nbsp; &nbsp; &nbsp;25<br />
Total: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6 &nbsp; 13 &nbsp; 0.8 &nbsp; &nbsp; 13 &nbsp; &nbsp; &nbsp;32</div></div>
</pre>
<p>At 3.29 Gbps @ 7469 requests per second, I consider this to be a rather well performing setup. Well prepared for my next project!</p>
</div>
<div class="shr-publisher-617"></div>

<p>Related posts:<ol><li><a href='http://www.myatus.co.uk/2009/08/31/nginx-and-apache-but-no-memcached/' rel='bookmark' title='Permanent Link: NginX and Apache, but no memcached'>NginX and Apache, but no memcached</a></li>
<li><a href='http://www.myatus.co.uk/2009/12/17/faster-wp-super-cache-with-nginx/' rel='bookmark' title='Permanent Link: Faster WP Super Cache with NginX'>Faster WP Super Cache with NginX</a></li>
<li><a href='http://www.myatus.co.uk/2009/09/07/compiling-nginx-on-debian-ubuntu/' rel='bookmark' title='Permanent Link: Compiling NginX on Debian / Ubuntu'>Compiling NginX on Debian / Ubuntu</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/06/28/a-simplified-nginx-apache-combo-with-wordpress-support/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Guide: Firewall and router with Proxmox &#8211; Extending its use</title>
		<link>http://www.myatus.co.uk/2010/03/20/guide-firewall-and-router-with-proxmox-extending-its-us/</link>
		<comments>http://www.myatus.co.uk/2010/03/20/guide-firewall-and-router-with-proxmox-extending-its-us/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 09:08:55 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[proxmox]]></category>
		<category><![CDATA[shorewall]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/?p=505</guid>
		<description><![CDATA[Last year I wrote a guide on how to use Shorewall as a firewall and router for Proxmox. As a follow up I will answer a few questions I&#8217;ve received about that guide that can help you extend its use. Proxy ARP The most common question is in regards to proxy ARP. Enabling this option [...]


Related posts:<ol><li><a href='http://www.myatus.co.uk/2009/08/31/guide-firewall-and-router-with-proxmox/' rel='bookmark' title='Permanent Link: Guide: Firewall and router with Proxmox'>Guide: Firewall and router with Proxmox</a></li>
<li><a href='http://www.myatus.co.uk/2010/07/17/blocking-w00tw00t-scans/' rel='bookmark' title='Permanent Link: Blocking w00tw00t scans'>Blocking w00tw00t scans</a></li>
<li><a href='http://www.myatus.co.uk/2009/08/24/guide-installing-opensolaris-on-a-remote-dedicated-server/' rel='bookmark' title='Permanent Link: Guide: Installing OpenSolaris on a remote dedicated server'>Guide: Installing OpenSolaris on a remote dedicated server</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-526" title="Online Hoodies" src="http://www.myatus.co.uk/wp-content/uploads/2010/03/online_hoodies-150x150.jpg" alt="&quot;Metro rebrands Hackers&quot; by gwire, attribution license" width="150" height="150" />Last year I wrote a guide on <a title="Guide: Firewall and router with Proxmox" href="http://www.myatus.co.uk/2009/08/31/guide-firewall-and-router-with-proxmox/">how to use Shorewall as a firewall and router for Proxmox</a>. As a follow up I will answer a few questions I&#8217;ve received about that guide that can help you extend its use.</p>
<h2>Proxy ARP</h2>
<p>The most common question is in regards to <em>proxy ARP</em>. Enabling this option will allow you to assign a public IP directly to your guest VM, eliminating the need for port forwarding (DNAT) or having to worry about the MAC address.</p>
<p>As an example use for proxy ARP, it is helpful for those using a a SIP-based VoIP server since a STUN server is no longer required.<span id="more-505"></span></p>
<h3>Enabling Proxy ARP</h3>
<p>The first step is to ensure that Proxy ARP is enabled.  This is a fairly simple task and involves adding an single line to one of your static network stanzas. Which one precisely depends on your system setup; for those who have an <em>eth0</em> stanza, you can use it there. For others who only have a <em>vmbr0..n</em> stanza, the additional line should be placed there.</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">iface eth0 inet static<br />
&nbsp; &nbsp; # ... existing lines ...<br />
&nbsp; &nbsp; post-up echo 1 &gt; /proc/sys/net/ipv4/conf/all/proxy_arp</div></div>
</pre>
<p>These changes will take effect on your next boot or whenever you restart your networking services.</p>
<h3>Add a route to Shorewall</h3>
<p>Shorewall needs to know that you&#8217;d like to use proxy ARP, for which IP that is and where this IP needs to be routed to. The beauty of Shorewall is its simplicity and so this can be quickly done by creating a file named <em>/etc/shorewall/proxyarp</em> that will contain this:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#ADDRESS    INTERFACE    EXTERNAL    HAVEROUTE    PERSISTENT<br />
92.22.33.44 vmbr0 &nbsp; &nbsp; &nbsp; &nbsp;eth0</div></div>
</pre>
<p>Translated, this informs Shorewall that the public IP 92.22.33.44 attached to <em>eth0</em> needs to be forwarded to a guest VM (using this public IP) attached to the <em>vmbr0</em> bridge.</p>
<p>As you can tell from the first line, there are two additional options: <em>haveroute</em> and <em>persistent</em>.</p>
<p>The <em>haveroute</em> option determines whether Shorewall should create a route from the external interface to the bridge. For guest containers based on OpenVZ, Proxmox will take of creating the route. But for fully virtualised containers (based on KVM), you need to create this route yourself. In this case we tell Shorewall to create the route for us, by keep this option&#8217;s value at its default value (blank, or <em>No</em>).</p>
<p>When the <em>haveroute</em> option is set to No (default), the <em>persistent</em> option tells Shorewall if it should keep the created route active if Shorewall is stopped. Generally, and for security reasons, you should leave this at its default option (blank or <em>No</em>). This prevents the guest VM from being exposed without a firewall protecting it.</p>
<h3>Creating Shorewall rules</h3>
<p>In the original guide all traffic from the public side to internal VMs is blocked. This continues to be the same when you are using proxy ARP and thus need to create rules that permit traffic to certain ports. This can be done by adding rules like:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ACCEPT    net    dmz:92.22.33.44    udp    5060</div></div>
</pre>
<p>This will permit UDP traffic on port 5060 to proceed to the guest VM on IP 92.22.33.44. You can also use the Shorewall macros, for example:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">HTTP/ACCEPT    net     dmz:92.22.33.44</div></div>
</pre>
<p>And in this case it will make a web server on 92.22.33.44 accessible to the public.</p>
<p>Alternatively, you may setup a single rule that accepts all traffic on  all ports:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ACCEPT    net     dmz:92.22.33.44</div></div>
</pre>
<p>However you should take care that the guest VM has its own set of rules to block unwanted or unsafe traffic.</p>
<p>The main thing to take care of with these proxy ARP firewall rules is to use <em>&#8220;ACCEPT&#8221;</em> and not <em>&#8220;DNAT&#8221;</em> as explained in the original guide.</p>
<h2>Multiple public IPs</h2>
<p>Another common question is in regards to multiple public IP addresses. The original guide assumed that the host has one public IP address, so here are a few additional pointers.</p>
<p>If you are following the original guide, then <em>any</em> public IP will be applied the same rule. So let&#8217;s say you have two public IP addresses, 94.11.22.33 and 94.22.33.44 and the following rule:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ACCEPT    net    fw    tcp    5900:5999</div></div>
</pre>
<p>With this rule, you can use both 93.11.22.33:5900 or 94.22.33.44:5900 to connect to Proxmox&#8217;s VNC. But you wish to restrict it to a specific IP address, then you need to modify the rule as following:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ACCEPT    net   fw:94.22.33.44    tcp    5900:5999</div></div>
</pre>
<p>Now you can only use 94.22.33.44:5900 to connect, but not 93.11.22.33:5900.</p>
<p>The same applies to port forwarding (DNAT) rules, which is written in a slightly different format. Let&#8217;s say we have this rule:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">DNAT    net    dmz:10.0.0.1    tcp    1234</div></div>
</pre>
<p>This will forward <em>any</em> public IP to port 1234 on the guest VM at 10.0.0.1. So both 94.11.22.33:1234 and 94.22.33.44:1234 will work. If you wish to restrict this to a certain public IP address, the rule needs to be modified as following:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">DNAT    net    dmz:10.0.0.1    tcp    1234    -    94.22.33.44</div></div>
</pre>
<p>Only 94.22.33.44:1234 will be allowed at this point.</p>
<h3>Memorable names</h3>
<p>If you have many IP addresses, it becomes easy to forget which IP to use. You can use Shorewall&#8217;s &#8220;params&#8221; file to give IPs a memorable name. Edit the file <em>/etc/shorewall/params</em> as following:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">IP_ALEX=94.11.22.33<br />
IP_SONIA=94.22.33.44<br />
IP_ERIC=94.33.44.55<br />
IP_VM1=10.0.0.1<br />
IP_VM2=10.0.0.2<br />
IP_VM3=10.0.0.3</div></div>
</pre>
<p>Now you can use these names instead of the IP address in any of your Shorwall rules, like so:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">HTTP/DNAT    net     dmz:$IP_VM1    -    -    -    $IP_SONIA</div></div>
</pre>
<p>And this would forward HTTP traffic from 94.22.33.44 to a guest VM running on 10.0.0.1.</p>
<h2>Mixed use and bridging</h2>
<p>The original guide not only adds a firewall, but also helped those who&#8217;s hosting provided blocked IPs on unauthorized MACs. One such hosting provided was OVH, and they have recently introduced a &#8220;Virtual MACs for VPS&#8221; option that allows you to assign an IP address to a MAC. This eliminates the need for Proxy ARP or port forwarding/NAT, however the original guide will still prove itself useful for protecting the host.</p>
<p>I will provide a sample setup below, which can be modified to suit your needs and network configuration. This assumes you have have a basic understanding of networking and read my <a title="Guide: Firewall and router with Proxmox" href="http://www.myatus.co.uk/2009/08/31/guide-firewall-and-router-with-proxmox/">previous guide</a>.</p>
<h3>Interfaces</h3>
<p>We modify the <em>/etc/network/interfaces</em> as following:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># The loopback network interface<br />
auto lo<br />
iface lo inet loopback<br />
<br />
# Public Network. Make sure to only use MACs that were assigned to you<br />
auto vmbr0<br />
iface vmbr0 inet static<br />
&nbsp;# The following settings are specific to your hosting provider:<br />
&nbsp;address 94.11.22.33<br />
&nbsp;netmask 255.255.255.0<br />
&nbsp;network 94.11.22.0<br />
&nbsp;broadcast 94.11.22.255<br />
&nbsp;gateway 94.11.22.254<br />
&nbsp;# The following assumes eth0 is the public-side NIC, the remained is always the same<br />
&nbsp;bridge_ports eth0<br />
&nbsp;bridge_stp off<br />
&nbsp;bridge_fd<br />
<br />
# Optional Private Network. This network cannot be access directly from the public side<br />
auto vmbr1<br />
iface vmbr1 inet auto<br />
 address 10.0.0.1<br />
 network 255.0.0.0<br />
 broadcast 10.255.255.25<br />
&nbsp;bridge_ports none<br />
 bridge_stp off<br />
 bridge_fd 0</div></div>
</pre>
<p>The host, accessible by 94.11.22.33, will have two bridges at this point: <em>vmbr0</em> serving the public-side and <em>vmbr1</em> serving inter-VM communication.</p>
<p>To assign a public IP address to a KVM, you use the <em>vmbr0</em> bride and must ensure the MAC corresponds to the one provided by your hosting provider (if a MAC restriction is in place).</p>
<p>You can also add a 2nd NIC (or as the only NIC) to the KVM, which is bridged with <em>vmbr1</em>. In this case, you need to use an IP within the 10.0.0.2-10.255.255.254 range, and as gateway 10.0.0.1. This particular IP range can only be used between other VMs on the same host / bridge, unless you use port forwarding or a VPN on the same IP range.</p>
<h3>Shorewall Interfaces and Zones</h3>
<p>The basic <em>/etc/shorewall/interfaces</em> will be:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#ZONE    INTERFACE    BROADCAST    OPTIONS<br />
pub    vmbr0        detect        routeback,bridge<br />
loc    vmbr1        detect        routeback,bridge<br />
<br />
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE</div></div>
</pre>
<p>You could also add the <em>blacklist</em> option, or any of the other possible Shorewall options if you wish.</p>
<p>The accompanying /etc/shorewall/zones will look like this:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#ZONE    TYPE        OPTIONS        IN            OUT<br />
#                    OPTIONS            OPTIONS<br />
fw    firewall<br />
pub    ipv4<br />
loc    ipv4<br />
<br />
#LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE</div></div>
</pre>
<p>You now have three distinct Shorewall zones. The <em>fw</em> zone is a self-reference to the host (in our sample setup 94.11.22.33 and 10.0.0.1). The <em>pub</em> zone represents the publicly accessible <em>vmbr0</em> bridge and <em>loc</em> our internal <em>vmbr1</em> bridge.</p>
<h3>Shorewall Policy</h3>
<p>The following policy defines these basic rules:</p>
<ul>
<li>Traffic from the the host anywhere else is permitted</li>
<li>Traffic from the public side to the host and the internal network is denied</li>
<li>Traffic from the internal side to the host is denied, anywhere else is permitted</li>
</ul>
<p>Edit <em>/etc/shorewall/policy</em>:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#SOURCE    DEST    POLICY        LOG    LIMIT:        CONNLIMIT:<br />
#                    LEVEL    BURST        MASK<br />
<br />
# From Firewall:<br />
fw        fw    ACCEPT<br />
fw        pub    ACCEPT<br />
fw        loc    ACCEPT<br />
<br />
# Public Bridge (read the policy warnings!):<br />
pub        pub    ACCEPT<br />
pub        loc    ACCEPT<br />
pub        fw    DROP        info<br />
<br />
# Local (internal) Bridge:<br />
loc        loc    ACCEPT<br />
loc        pub    ACCEPT<br />
loc        fw    DROP        info<br />
<br />
# THE FOLLOWING POLICY MUST BE LAST<br />
#<br />
all    all    REJECT        info<br />
<br />
#LAST LINE -- DO NOT REMOVE</div></div>
</pre>
<h3>Policy Warnings</h3>
<p>With this sample policy it means that <span style="text-decoration: underline;">each publicly accessible guest VM should have its own firewall</span>. If you wish to change this behavior, and let Shorewall handle the firewall for each such guest VM, then change the Public Bridge section:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">pub        pub    DROP &nbsp; &nbsp; &nbsp;info</div></div>
</pre>
<p>You then need to create specific rules that allow traffic to VMs on <em>vmbr0</em>.</p>
<p>A similar warning applies to traffic from <em>vmbr0</em> to <em>vmbr1</em>. The policy assumes that <em>vmbr0</em> does not receive any routable traffic on a private IP range (also called <em>&#8220;martians&#8221;</em>). Although this is often the case, it depends on the hosting provider&#8217;s internal networking. If you are not sure whether there&#8217;s routable traffic on a private IP range from the public side, you have two options. The first is to disallow all traffic from <em>vmbr0</em> (pub) to <em>vmbr1</em> (loc) by editing the Public Bridge section:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">pub        loc    DROP &nbsp; &nbsp; &nbsp;info</div></div>
</pre>
<p>The alternative is to have a set of rules in <em>/etc/shorewall/rules</em> like so:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># ...<br />
SECTION NEW<br />
<br />
# Leave these at the top, right after &quot;SECTION NEW&quot;!<br />
DROP        pub:10.0.0.0/8        all<br />
DROP        pub:192.168.0.0/16    all<br />
DROP        pub:172.168.0.0/12    all<br />
<br />
# ... Other rules follow ...<br />
<br />
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE</div></div>
</pre>
<blockquote><p><strong>In all cases, you should verify whether traffic is truly blocked and never assume that it is!<br />
</strong></p></blockquote>
<h2>Shorewall and Fail2ban</h2>
<p><a title="Fail2ban" href="http://www.fail2ban.org/" target="_blank"><img class="alignleft size-full wp-image-523" title="Fail2ban Logo" src="http://www.myatus.co.uk/wp-content/uploads/2010/03/fail2ban_logo.png" alt="" width="135" height="130" />Fail2ban</a> in its own words <em>&#8220;scans log files like /var/log/pwdfail or /var/log/apache/error_log and bans IP that makes too many password failures. It updates firewall rules to reject the IP address&#8221;</em>. This can for instance be used to (temporarily) ban a bot that is attempting a brute-force entry through SSH.</p>
<p>Fail2ban is an ideal companion to Shorewall and can be installed in a matter of minutes on a Proxmox host. You start by installing Fail2ban from the Debian packages:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> fail2ban</div></div>
</pre>
<h3>Configure Shorewall</h3>
<p>Next you need to edit one line in the Shorewall configuration file, located at <em>/etc/shorewall/shorewall.conf</em>:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">BLACKLISTNEWONLY=No</div></div>
</pre>
<p>That&#8217;s all you need to configure in Shorewall. Remember to apply your settings by restarting Shorewall with the command <em>&#8220;shorewall restart&#8221;</em>.</p>
<h3>Configure Fail2ban</h3>
<p>The last step is to configure Fail2ban. The file <em>/etc/fail2ban/jail.conf</em> is extensively documented and of particular interest are the following settings:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">...<br />
#<br />
# Destination email address used solely for the interpolations in<br />
# jail.{conf,local} configuration files.<br />
destemail = myemail@address.com<br />
<br />
...<br />
#<br />
# ACTIONS<br />
#<br />
<br />
# Default banning action (e.g. iptables, iptables-new,<br />
# iptables-multiport, shorewall, etc) It is used to define<br />
# action_* variables. Can be overriden globally or per<br />
# section within jail.local file<br />
banaction = shorewall<br />
<br />
...<br />
# Choose default action.  To change, just override value of 'action' with the<br />
# interpolation to the chosen action shortcut (e.g.  action_mw, action_mwl, etc$<br />
# globally (section [DEFAULT]) or per specific section<br />
action = %(action_mwl)s</div></div>
</pre>
<p>Inform fail2ban of these changes by issuing the following command:</p>
<pre>
<div class="codecolorer-container bash blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">fail2ban-client reload</div></div>
</pre>
<p>The <em>destemail</em> variable should be changed to your own e-mail address, where you will be informed of any ban actions. The <em>banaction</em> variable specifies that Shorewall should be used to block possible intruders. And finally, the <em>action</em> variable tells fail2ban to ban any detected intruder and then send an you a detailed e-mail with the relevant log lines (that caused the ban). Following is an example of an actual e-mail:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Hi,<br />
<br />
The IP 193.86.5.103 has just been banned by Fail2Ban after<br />
3 attempts against ssh.<br />
<br />
Here are more information about 193.86.5.103:<br />
<br />
% This is the RIPE Database query service.<br />
% The objects are in RPSL format.<br />
%<br />
% The RIPE Database is subject to Terms and Conditions.<br />
% See &lt;a class=&quot;moz-txt-link-freetext&quot; href=&quot;http://www.ripe.net/db/support/db-terms-conditions.pdf&quot;&gt;http://www.ripe.net/db/support/db-terms-conditions.pdf&lt;/a&gt;<br />
<br />
% Note: This output has been filtered.<br />
% &nbsp; &nbsp; &nbsp; To receive output for a database update, use the &quot;-B&quot; flag.<br />
<br />
% Information related to '193.86.4.0 - 193.86.5.255'<br />
<br />
inetnum: &nbsp; &nbsp; &nbsp;193.86.4.0 - 193.86.5.255<br />
netname: &nbsp; &nbsp; &nbsp;BRANO<br />
descr: &nbsp; &nbsp; &nbsp; &nbsp;BRANO, Inc.<br />
descr: &nbsp; &nbsp; &nbsp; &nbsp;Hradec nad Moravici<br />
country: &nbsp; &nbsp; &nbsp;CZ<br />
admin-c: &nbsp; &nbsp; &nbsp;BK230-RIPE<br />
tech-c: &nbsp; &nbsp; &nbsp; TP231-RIPE<br />
status: &nbsp; &nbsp; &nbsp; ASSIGNED PA<br />
mnt-by: &nbsp; &nbsp; &nbsp; GTSCZ-MNT<br />
source: &nbsp; &nbsp; &nbsp; RIPE # Filtered<br />
<br />
person: &nbsp; &nbsp; &nbsp; Bohumil Kriz<br />
address: &nbsp; &nbsp; &nbsp;BRANO, Inc.<br />
address: &nbsp; &nbsp; &nbsp;Computer Centre<br />
address: &nbsp; &nbsp; &nbsp;Hradec nad Moravici<br />
address: &nbsp; &nbsp; &nbsp;747 41<br />
address: &nbsp; &nbsp; &nbsp;The Czech Republic<br />
phone: &nbsp; &nbsp; &nbsp; &nbsp;+420 653 918118<br />
fax-no: &nbsp; &nbsp; &nbsp; +420 653 911791<br />
nic-hdl: &nbsp; &nbsp; &nbsp;BK230-RIPE<br />
source: &nbsp; &nbsp; &nbsp; RIPE # Filtered<br />
<br />
person: &nbsp; &nbsp; &nbsp; Tomas Partl<br />
address: &nbsp; &nbsp; &nbsp;Brano, Inc.<br />
address: &nbsp; &nbsp; &nbsp;Computer Centre<br />
address: &nbsp; &nbsp; &nbsp;Hradec nad Moravici<br />
address: &nbsp; &nbsp; &nbsp;747 41<br />
address: &nbsp; &nbsp; &nbsp;The Czech Republic<br />
phone: &nbsp; &nbsp; &nbsp; &nbsp;+420 653 918371<br />
fax-no: &nbsp; &nbsp; &nbsp; +420 653 911791<br />
nic-hdl: &nbsp; &nbsp; &nbsp;TP231-RIPE<br />
source: &nbsp; &nbsp; &nbsp; RIPE # Filtered<br />
<br />
% Information related to '193.86.0.0/16AS2819'<br />
<br />
route: &nbsp; &nbsp; &nbsp; &nbsp;193.86.0.0/16<br />
descr: &nbsp; &nbsp; &nbsp; &nbsp;CZNET-A<br />
origin: &nbsp; &nbsp; &nbsp; AS2819<br />
mnt-by: &nbsp; &nbsp; &nbsp; GTSCZ-A-MNT<br />
source: &nbsp; &nbsp; &nbsp; RIPE # Filtered<br />
<br />
Lines containing IP:193.86.5.103 in /var/log/auth.log<br />
<br />
Feb 27 03:32:02 host sshd[21460]: Failed password for root from 193.86.5.103 port 35833 ssh2<br />
Feb 27 03:32:04 host sshd[21502]: Failed password for root from 193.86.5.103 port 36302 ssh2<br />
Feb 27 03:32:06 host sshd[21504]: Failed password for root from 193.86.5.103 port 36719 ssh2<br />
<br />
Regards,<br />
<br />
Fail2Ban</div></div>
</pre>
<p>By default fail2ban is configured to monitor SSH, which for a Proxmox host works without any additional changes. Personally I prefer a ban on 3 attempts instead of the default 6, so I have made this one change in the <em>/etc/fail2ban/jail.conf</em> file:</p>
<pre>
<div class="codecolorer-container text blackboard no_translate none" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[ssh]<br />
maxretry = 3</div></div>
</pre>
<p>But again, the configuration file is quite well documented, so any personal preferences or modifications should be easy to accomplish.</p>
<h6 style="text-align: right;">&#8220;Online Hoodies&#8221; photo by <a href="http://www.flickr.com/photos/gwire/2981340426/" target="_blank">gwire</a>, CC Attribution License</h6>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 4641px; width: 1px; height: 1px; overflow: hidden;">
<pre>Hi,

The IP 193.86.5.103 has just been banned by Fail2Ban after
3 attempts against ssh.

Here are more information about 193.86.5.103:

% This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See <a class="moz-txt-link-freetext" href="http://www.ripe.net/db/support/db-terms-conditions.pdf">http://www.ripe.net/db/support/db-terms-conditions.pdf</a>

% Note: This output has been filtered.
%       To receive output for a database update, use the "-B" flag.

% Information related to '193.86.4.0 - 193.86.5.255'

inetnum:      193.86.4.0 - 193.86.5.255
netname:      BRANO
descr:        BRANO, Inc.
descr:        Hradec nad Moravici
country:      CZ
admin-c:      BK230-RIPE
tech-c:       TP231-RIPE
status:       ASSIGNED PA
mnt-by:       GTSCZ-MNT
source:       RIPE # Filtered

person:       Bohumil Kriz
address:      BRANO, Inc.
address:      Computer Centre
address:      Hradec nad Moravici
address:      747 41
address:      The Czech Republic
phone:        +420 653 918118
fax-no:       +420 653 911791
nic-hdl:      BK230-RIPE
source:       RIPE # Filtered

person:       Tomas Partl
address:      Brano, Inc.
address:      Computer Centre
address:      Hradec nad Moravici
address:      747 41
address:      The Czech Republic
phone:        +420 653 918371
fax-no:       +420 653 911791
nic-hdl:      TP231-RIPE
source:       RIPE # Filtered

% Information related to '193.86.0.0/16AS2819'

route:        193.86.0.0/16
descr:        CZNET-A
origin:       AS2819
mnt-by:       GTSCZ-A-MNT
source:       RIPE # Filtered

Lines containing IP:193.86.5.103 in /var/log/auth.log

Feb 27 03:32:02 host sshd[21460]: Failed password for root from 193.86.5.103 port 35833 ssh2
Feb 27 03:32:04 host sshd[21502]: Failed password for root from 193.86.5.103 port 36302 ssh2
Feb 27 03:32:06 host sshd[21504]: Failed password for root from 193.86.5.103 port 36719 ssh2

Regards,

Fail2Ban</pre>
</div>
<div class="shr-publisher-505"></div>

<p>Related posts:<ol><li><a href='http://www.myatus.co.uk/2009/08/31/guide-firewall-and-router-with-proxmox/' rel='bookmark' title='Permanent Link: Guide: Firewall and router with Proxmox'>Guide: Firewall and router with Proxmox</a></li>
<li><a href='http://www.myatus.co.uk/2010/07/17/blocking-w00tw00t-scans/' rel='bookmark' title='Permanent Link: Blocking w00tw00t scans'>Blocking w00tw00t scans</a></li>
<li><a href='http://www.myatus.co.uk/2009/08/24/guide-installing-opensolaris-on-a-remote-dedicated-server/' rel='bookmark' title='Permanent Link: Guide: Installing OpenSolaris on a remote dedicated server'>Guide: Installing OpenSolaris on a remote dedicated server</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/03/20/guide-firewall-and-router-with-proxmox-extending-its-us/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>WP Flickr Background version 1.0.3 (Beta) available</title>
		<link>http://www.myatus.co.uk/2010/03/06/wp-flickr-background-version-103-betaavailable/</link>
		<comments>http://www.myatus.co.uk/2010/03/06/wp-flickr-background-version-103-betaavailable/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 07:41:05 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-flickr-background]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/?p=478</guid>
		<description><![CDATA[Version 1.0.3 has been released, which fixes a few minor bugs and introduces a new option. It is still considered to be in a Beta stage, which most likely will change with the next release. Changes A new option has been introduced to hide the license and attribution information in the footer. Bug fix: Config [...]


Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background-version-1-0-2-beta-available/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.2 (Beta) available'>WP Flickr Background version 1.0.2 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background/' rel='bookmark' title='Permanent Link: WP Flickr Background'>WP Flickr Background</a></li>
<li><a href='http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/' rel='bookmark' title='Permanent Link: WP Flickr Background in Alpha testing'>WP Flickr Background in Alpha testing</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Version 1.0.3 has been released, which fixes a few minor bugs and introduces a new option. It is still considered to be in a Beta stage, which most likely will change with the next release.</p>
<h3>Changes</h3>
<ul>
<li>A new option has been introduced to hide the license and attribution information in the footer.</li>
<li>Bug fix: Config hash file was never initialized</li>
<li>Bug fix: Enabling &#8220;cacheable&#8221; option resulted in fatal PHP errors in some cases</li>
<li>Bug fix: Preview option did not work when &#8220;cacheable&#8221; option was enabled</li>
<li>Bug fix: &#8220;All Rights Reseved&#8221; licenses had no URLs</li>
</ul>
<p>In addition, WP Flickr Background is no longer compatible with WordPress version 2.8 or older.</p>
<p>Links: Direct download <a class="downloadlink" href="http://www.myatus.co.uk/wp-content/plugins/download-monitor/download.php?id=1" title="Version1.0.3 downloaded 192 times" >WP Flickr Background (192)</a> | <a title="Wordpress Plugin Directory" href="http://wordpress.org/extend/plugins/wp-flickr-background/" target="_blank">WordPress Plugin Directory</a></p>
<div class="shr-publisher-478"></div>

<p>Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background-version-1-0-2-beta-available/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.2 (Beta) available'>WP Flickr Background version 1.0.2 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background/' rel='bookmark' title='Permanent Link: WP Flickr Background'>WP Flickr Background</a></li>
<li><a href='http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/' rel='bookmark' title='Permanent Link: WP Flickr Background in Alpha testing'>WP Flickr Background in Alpha testing</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/03/06/wp-flickr-background-version-103-betaavailable/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Red Cross&#8217; Citibank details on Twitter could be false.</title>
		<link>http://www.myatus.co.uk/2010/03/01/red-cross-citibank-details-on-twitter-could-be-false/</link>
		<comments>http://www.myatus.co.uk/2010/03/01/red-cross-citibank-details-on-twitter-could-be-false/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 01:18:57 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Musings]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[chile]]></category>
		<category><![CDATA[chilequake]]></category>
		<category><![CDATA[fraud warning]]></category>
		<category><![CDATA[red cross]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/?p=465</guid>
		<description><![CDATA[A few moments ago I received a message on Twitter that contained information on how you could help the Red Cross with its efforts in Chile. While the intentions are good, this can quickly become a target of fraudsters. My biggest concern is that a fraudster will simply replace the account information to one he [...]


Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/02/28/hawaii-tsunami-sprecks-gallery/' rel='bookmark' title='Permanent Link: Hawaii Tsunami, Sprecks image gallery'>Hawaii Tsunami, Sprecks image gallery</a></li>
<li><a href='http://www.myatus.co.uk/2009/12/15/add-hashtags-support-to-wordtwit/' rel='bookmark' title='Permanent Link: Add hashtags support to WordTwit'>Add hashtags support to WordTwit</a></li>
<li><a href='http://www.myatus.co.uk/2010/03/02/lifestream-for-march-2nd/' rel='bookmark' title='Permanent Link: Lifestream for March 2nd'>Lifestream for March 2nd</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.myatus.co.uk/wp-content/uploads/2010/03/Twitter_Chile_nono.png"><img class="alignleft size-thumbnail wp-image-466" title="Twitter &quot;Red Cross&quot; message" src="http://www.myatus.co.uk/wp-content/uploads/2010/03/Twitter_Chile_nono-150x150.png" alt="" width="150" height="150" /></a>A few moments ago I received a message on <a title="Twitter" href="http://www.twitter.com" target="_blank">Twitter</a> that contained information on how you could help the Red Cross with its efforts in Chile. While the intentions are good, this can quickly become a target of fraudsters.</p>
<p>My biggest concern is that a fraudster will simply replace the account information to one <em>he owns him or herself</em>. Because it is such a hot topic on Twitter at the moment, this altered message would make its rounds quickly. <span id="more-465"></span></p>
<p>I was able to trace the original message back to <a title="Chilean Red Cross" href="http://twitter.com/CruzRojainforma" target="_blank">@CruzRojainforma</a>, the Chilean Red Cross. So far the retweeted message hasn&#8217;t been altered &#8211; other than being translated into English. But I&#8217;ve urged people to stop retweeting the account details and visit the official Red Cross website at <a title="Red Cross" href="http://www.redcross.org" target="_blank">www.redcross.org</a> instead. There&#8217;s a link right on their main page that explains how you can donate time or money to the Chilean earthquake efforts.</p>
<p>On a final note, Twitter is also used to find missing persons. And with positive results I may add, as <a title="Twitter – As powerful as an earthquake" href="http://stardustglobalventures.com/2010/02/27/twitter-as-powerful-as-an-earthquake/" target="_blank">this article</a> explains. Google also has a <a title="Google Person Finder, Chile Earthquake" href="http://chilepersonfinder.appspot.com/" target="_blank">Person Finder</a> database running, which it had done for te Haiiti earthquake as well. But please ensure that you do not give out too much personal details about the person you&#8217;re looking for, because it becomes a (nearly) permanent part of the Internet.</p>
<p>Again, the intentions are good, but there are too many people out there waiting to take advantage of every possible situation so be careful!</p>
<p>Fuerza Chile!</p>
<div class="shr-publisher-465"></div>

<p>Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/02/28/hawaii-tsunami-sprecks-gallery/' rel='bookmark' title='Permanent Link: Hawaii Tsunami, Sprecks image gallery'>Hawaii Tsunami, Sprecks image gallery</a></li>
<li><a href='http://www.myatus.co.uk/2009/12/15/add-hashtags-support-to-wordtwit/' rel='bookmark' title='Permanent Link: Add hashtags support to WordTwit'>Add hashtags support to WordTwit</a></li>
<li><a href='http://www.myatus.co.uk/2010/03/02/lifestream-for-march-2nd/' rel='bookmark' title='Permanent Link: Lifestream for March 2nd'>Lifestream for March 2nd</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/03/01/red-cross-citibank-details-on-twitter-could-be-false/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hawaii Tsunami, Sprecks image gallery</title>
		<link>http://www.myatus.co.uk/2010/02/28/hawaii-tsunami-sprecks-gallery/</link>
		<comments>http://www.myatus.co.uk/2010/02/28/hawaii-tsunami-sprecks-gallery/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 02:03:37 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Musings]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[chile]]></category>
		<category><![CDATA[earthquake]]></category>
		<category><![CDATA[hawaii]]></category>
		<category><![CDATA[tsunami]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/?p=446</guid>
		<description><![CDATA[Well, like many others, I&#8217;ve been following the developing stories surrounding the tsunami that was caused by the earthquake near Santiago, Chile. One of the many island groups that lay in the path of the tsunami was Hawaii and I&#8217;ve been keeping an eye on the webcams provided by MauiWindCam. They were one of the [...]


Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/03/01/lifestream-for-march-1st/' rel='bookmark' title='Permanent Link: Lifestream for March 1st'>Lifestream for March 1st</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.myatus.co.uk/wp-content/uploads/2010/02/chileem.jpg"><img class="alignleft size-thumbnail wp-image-450" title="Chile tsunami path by NOAA" src="http://www.myatus.co.uk/wp-content/uploads/2010/02/chileem-150x150.jpg" alt="" width="150" height="150" /></a>Well, like many others, I&#8217;ve been following the developing stories surrounding the tsunami that was caused by the earthquake near Santiago, Chile. One of the many island groups that lay in the path of the tsunami was Hawaii and I&#8217;ve been keeping an eye on the webcams provided by <a title="MauiWindCam" href="http://www.mauiwindcam.com/" target="_blank">MauiWindCam</a>. They were one of the few live webcam sites in Hawaii capable of dealing with the huge influx of other curious people. For those who missed this, I&#8217;ve recorded a number of images that can be viewed in the gallery below.<span id="more-446"></span></p>
<p>While the actual waves were thankfully less high than expected, you do notice two distinct surges in the images. The view here is of the Sprecks towards the West Maui mountains.</p>
<div class="ngg-galleryoverview"><div class="slideshowlink"><a class="slideshowlink" href="http://www.myatus.co.uk/2010/02/28/hawaii-tsunami-sprecks-gallery/?show=gallery">[Show picture list]</a></div>[[Show as slideshow]]</div>
<div class="ngg-clear"></div>

<p>Here&#8217;s a video which will give a better idea of what it looked like on the ground:</p>
<p style="text-align: center;"><object style="height: 344px; width: 425px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100" height="100" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/If88d-t0x4w" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /><embed style="height: 344px; width: 425px;" type="application/x-shockwave-flash" width="100" height="100" src="http://www.youtube.com/v/If88d-t0x4w" wmode="transparent" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I have another set (with a smoother timeline) from a different location as well, which may add soon as well. A few images from that set stood out and I will share this one with you here:</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-452" title="Where's everyone?" src="http://www.myatus.co.uk/wp-content/uploads/2010/02/campone_cellphone_tsumami.jpg" alt="" width="600" height="440" /></p>
<p>Apparently this person wasn&#8217;t aware that there was a tsunami warning in effect and that you shouldn&#8217;t be on the beach, especially not making any phone calls.</p>
<div class="shr-publisher-446"></div>

<p>Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/03/01/lifestream-for-march-1st/' rel='bookmark' title='Permanent Link: Lifestream for March 1st'>Lifestream for March 1st</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/02/28/hawaii-tsunami-sprecks-gallery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WP Flickr Background version 1.0.2 (Beta) available</title>
		<link>http://www.myatus.co.uk/2010/02/26/wp-flickr-background-version-1-0-2-beta-available/</link>
		<comments>http://www.myatus.co.uk/2010/02/26/wp-flickr-background-version-1-0-2-beta-available/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 03:43:10 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-flickr-background]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/?p=430</guid>
		<description><![CDATA[Well, a little over a month ago I had put the final touches to the WP Flickr Background plugin and entered it into Alpha stage. Over the entire month and with a few thousand visitors, there were only two issues reported (one of which was unrelated). Satisfied with this, I&#8217;ve now made version 1.0.2 available [...]


Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/03/06/wp-flickr-background-version-103-betaavailable/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.3 (Beta) available'>WP Flickr Background version 1.0.3 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background/' rel='bookmark' title='Permanent Link: WP Flickr Background'>WP Flickr Background</a></li>
<li><a href='http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/' rel='bookmark' title='Permanent Link: WP Flickr Background in Alpha testing'>WP Flickr Background in Alpha testing</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Well, a little over a month ago I had put the final touches to the WP Flickr Background plugin and entered it into Alpha stage. Over the entire month and with a few thousand visitors, there were only two issues reported (one of which was unrelated).</p>
<p>Satisfied with this, I&#8217;ve now made version 1.0.2 available as a Beta product. That means you can now use it for your own purposes, however I do not recommend using this in a production environment just yet (although nothing is stopping you from doing so &#8211; use at your own risk!).<span id="more-430"></span></p>
<p>The likely issues that I&#8217;m expecting are with the installation, plugin usage and the back-end (administration). But hopefully those will only be a few. In meantime, I will start the registration procedure with WordPress.org so that the code will be available in the SVN, and the plugin available for download / upgrade within WordPress itself. Hopefully this will be a matter of just a few days.</p>
<p>If you are running in any kind of issue, how small it may seem, I&#8217;d really like to know about it so I can improve the plugin. You can use the <a title="Contact me" href="http://www.myatus.co.uk/contact/">contact</a> form, or leave a comment below and I will make note of it.</p>
<p>The static page for WP Flickr Background is <a title="WP Flickr Backrgound" href="http://www.myatus.co.uk/wp-flickr-background">http://www.myatus.co.uk/wp-flickr-background</a>, and it will be updated with the latest version as it becomes available. You can also click on <a title="Downloads" href="http://www.myatus.co.uk/downloads/">Downloads</a> at the top.</p>
<p>Enjoy!</p>
<p>P.S.: A small update, WP Flickr Background is also available through the <a title="Flickr App Garden" href="http://www.flickr.com/services/" target="_blank">Flickr App Garden</a>.</p>
<p>P.P.S.: Quicker than expected, WordPress has accepted the plugin into the <a title="Wordpress Plugin Directory" href="http://wordpress.org/extend/plugins/wp-flickr-background/" target="_blank">Plugin Directory</a>. If you wish to use the development version (provided you know what you are doing!), see the <a title="SVN" href="http://plugins.svn.wordpress.org/wp-flickr-background/" target="_blank">SVN</a>.</p>
<div class="shr-publisher-430"></div>

<p>Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/03/06/wp-flickr-background-version-103-betaavailable/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.3 (Beta) available'>WP Flickr Background version 1.0.3 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background/' rel='bookmark' title='Permanent Link: WP Flickr Background'>WP Flickr Background</a></li>
<li><a href='http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/' rel='bookmark' title='Permanent Link: WP Flickr Background in Alpha testing'>WP Flickr Background in Alpha testing</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/02/26/wp-flickr-background-version-1-0-2-beta-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP Flickr Background</title>
		<link>http://www.myatus.co.uk/2010/02/26/wp-flickr-background/</link>
		<comments>http://www.myatus.co.uk/2010/02/26/wp-flickr-background/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 03:19:40 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/?p=402</guid>
		<description><![CDATA[WP Flickr Background is a simple to use WordPress plugin that allows you to display a photo from Flickr as the theme background, without the need to modify any files. All you need to do is create one or more galleries within the plugin&#8217;s settings, each containing a collection of photos from Flickr that you [...]


Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background-version-1-0-2-beta-available/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.2 (Beta) available'>WP Flickr Background version 1.0.2 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/03/06/wp-flickr-background-version-103-betaavailable/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.3 (Beta) available'>WP Flickr Background version 1.0.3 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/' rel='bookmark' title='Permanent Link: WP Flickr Background in Alpha testing'>WP Flickr Background in Alpha testing</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>WP Flickr Background is a simple to use WordPress plugin that allows you to display a photo from Flickr as the theme background, without the need to modify any files.</p>
<p>All you need to do is create one or more galleries within the plugin&#8217;s settings, each containing a collection of photos from Flickr that you have chosen, and WP Flickr will randomly select a photo from the active gallery to display as the theme background.</p>
<p>You can also customise a gallery by adding CSS styling code that will be loaded along with the photo, allowing you to color match the WordPress theme to the particular photo displayed or for other use.<span id="more-402"></span></p>
<p>Links: Direct download: <a class="downloadlink" href="http://www.myatus.co.uk/wp-content/plugins/download-monitor/download.php?id=1" title="Version1.0.3 downloaded 192 times" >WP Flickr Background (192)</a> | <a title="Wordpress Plugin Directory" href="http://wordpress.org/extend/plugins/wp-flickr-background/" target="_blank">WordPress Plugin Directory</a></p>
<p><div class='postTabs_divs postTabs_curr_div' id='postTabs_0_402'>
<span class='postTabs_titles'><b>Features</b></span></p>
<ul>
<li>Decide how often the background image should change (ie., every day, once per browser session, etc.)</li>
<li>Stretch a background photo horizontally and/or vertically</li>
<li>Align background photos according to the visitor&#8217;s screen layout</li>
<li>Optionally disable the original theme&#8217;s background</li>
<li>Optional Javascript compression</li>
<li>Support for WordPress caches such as WP Super Cache</li>
<li>Multiple galleries</li>
<li>Custom CSS style sheet per gallery, loaded with the theme if it&#8217;s active</li>
</ul>
<p></div>

<div class='postTabs_divs' id='postTabs_1_402'>
<span class='postTabs_titles'><b>Screenshots</b></span></p>
<p><a href="http://www.myatus.co.uk/wp-content/uploads/2010/02/screenshot-1.jpg"><img class="alignleft size-thumbnail wp-image-403" title="Editing a gallery" src="http://www.myatus.co.uk/wp-content/uploads/2010/02/screenshot-1-150x150.jpg" alt="" width="150" height="150" /></a><a href="http://www.myatus.co.uk/wp-content/uploads/2010/02/screenshot-2.jpg"><img class="alignleft size-thumbnail wp-image-404" title="Overview of available galleries" src="http://www.myatus.co.uk/wp-content/uploads/2010/02/screenshot-2-150x150.jpg" alt="" width="150" height="150" /></a><a style="border: none;" href="http://www.myatus.co.uk/wp-content/uploads/2010/02/screenshot-3.jpg"><img class="size-thumbnail wp-image-407 alignnone" title="Main configuration screen, with tooltips" src="http://www.myatus.co.uk/wp-content/uploads/2010/02/screenshot-3-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p></div>

<div class='postTabs_divs' id='postTabs_2_402'>
<span class='postTabs_titles'><b>Requirements</b></span></p>
<ul>
<li> WordPress version 2.9 or better</li>
<li>PHP version 4.2.3 or better</li>
<li>A browser with Javascript support enabled</li>
</ul>
<p></div>

<div class='postTabs_divs' id='postTabs_3_402'>
<span class='postTabs_titles'><b>Getting Started</b></span></p>
<ol>
<li>Upload the contents of the ZIP file to the <em>/wp-content/plugins/</em> directory</li>
<li>Activate the plugin through the <strong>Plugins </strong>menu in WordPress</li>
<li>Access the plugin&#8217;s configuration through the <strong>Settings/WP Flickr Background</strong> menu to:</li>
</ol>
<ul>
<li>Configure options</li>
<li> Add galleries and photos</li>
<li>Read more detailed help</li>
</ul>
<p></div>

</p>
<p>If you have an idea for WP Flickr Background or wish to report a bug, click the <em>feedback</em> tab shown on your left or visit <a title="UserVoice for Myatu's" href="http://myatu.uservoice.com/forums/43891">UserVoice</a>.</p>
<script type='text/javascript'>jQuery(document).ready(function() { if(postTabs_getCookie('postTabs_402')) postTabs_show(postTabs_getCookie('postTabs_402'),402); });</script><div class="shr-publisher-402"></div>

<p>Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background-version-1-0-2-beta-available/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.2 (Beta) available'>WP Flickr Background version 1.0.2 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/03/06/wp-flickr-background-version-103-betaavailable/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.3 (Beta) available'>WP Flickr Background version 1.0.3 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/' rel='bookmark' title='Permanent Link: WP Flickr Background in Alpha testing'>WP Flickr Background in Alpha testing</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/02/26/wp-flickr-background/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>I&#8217;m back!</title>
		<link>http://www.myatus.co.uk/2010/01/23/im-back/</link>
		<comments>http://www.myatus.co.uk/2010/01/23/im-back/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 06:33:52 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/?p=364</guid>
		<description><![CDATA[I apologize to everyone who had difficulty accessing the website in recent days! I had taken down the website to make some changes to the web server, which quickly became a major overhaul. I figured that since it was already down, I might as well do the things I had long planned. A good portion [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I apologize to everyone who had difficulty accessing the website in recent days!</p>
<p>I had taken down the website to make some changes to the web server, which quickly became a major overhaul. I figured that since it was already down, I might as well do the things I had long planned.</p>
<p>A good portion of it is implemented now, but I&#8217;m not completely done. I&#8217;ll give it my best effort to ensure there will be little to no downtime. Once again, my apologies!</p>
<div class="shr-publisher-364"></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/01/23/im-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP Flickr Background in Alpha testing</title>
		<link>http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/</link>
		<comments>http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 01:20:00 +0000</pubDate>
		<dc:creator>Myatu</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/</guid>
		<description><![CDATA[If you&#8217;re new to this website, you probably haven&#8217;t noticed. But the background you&#8217;re seeing is actually something new. And random. And streamed from Flickr. It&#8217;s a new plugin that I am developing for WordPress called &#8216;WP Flickr Background&#8217;. A little over two weeks ago I changed my theme to Motion by 85ideas, and was [...]


Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background/' rel='bookmark' title='Permanent Link: WP Flickr Background'>WP Flickr Background</a></li>
<li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background-version-1-0-2-beta-available/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.2 (Beta) available'>WP Flickr Background version 1.0.2 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/03/06/wp-flickr-background-version-103-betaavailable/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.3 (Beta) available'>WP Flickr Background version 1.0.3 (Beta) available</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.myatus.co.uk/wp-content/uploads/2010/01/screenshot-3.jpg"><img class="alignleft size-thumbnail wp-image-360" title="WP Flickr Background" src="http://www.myatus.co.uk/wp-content/uploads/2010/01/screenshot-3-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p>If you&#8217;re new to this website, you probably haven&#8217;t noticed. But the background you&#8217;re seeing is actually something new. And random. And streamed from Flickr. It&#8217;s a new plugin that I am developing for WordPress called &#8216;WP Flickr Background&#8217;.</p>
<p>A little over two weeks ago I changed my theme to <a title="Motion by 85ideas" href="http://85ideas.com/public-releases/wordpress-theme-motion/" target="_blank">Motion by 85ideas</a>, and was intrigued by its effective use of transparencies and the background. And since I quickly get bored looking at the same thing, I thought &#8216;Why not make this background random&#8217;? Flickr provides millions of photos, many of them under a <a title="Creative Commons" href="http://creativecommons.org/" target="_blank">Creative Commons</a> Attribution License, and this would be an excellent source for those random backgrounds. So I started coding&#8230;<span id="more-359"></span></p>
<p>Interestingly, it wasn&#8217;t as straight forward as one would expect. After all, you could simply use a dynamically generated CSS style sheet with a &#8216;background&#8217; element pointing to a random Flickr photo. Right?</p>
<p>But small photos cascade and your website will look like a bad 1995 rendition of your first HTML page. And the large photos may be <em>SO </em>large, you end up staring at just a grain of sand instead of a beach.</p>
<p>CSS3, the brand-spanking new version of CSS style sheets, supports stretching of background images. Unfortunately, not a single browser I have tried supports it. So I reverted to good-old image hacking, basically injecting the background in a negative Z-indexed <em>&lt;div&gt;</em> block at a fixed position.</p>
<p>Yes, that last sentence is a great conversation breaker. But trust me, it is the <em>injection</em> portion that&#8217;s trickiest. For one, I do not like it when plugins require me to manually modify files, let alone modify files in the first place. So I assume there are other people out there who think alike. So how can I change a WordPress theme without actually modifying its files? Enter Javascript, jQuery to be specific, and we are on our way to great trickery!</p>
<p>So in the end, WP Flickr Background will use Javascript to add a new background image overlaid by the actual (original) contents. And it works! At least, it does so with Opera 10, Firefox 3, Google Chrome 3, MSIE 8 and Safari 4. Hence I am now putting the plugin through a public Alpha test, waiting for complaints to roll in: &#8220;Your website looks weird&#8221; and &#8220;I&#8217;m getting Javascript errors&#8221; are some of the things I am expecting to see during testing, but hopefully there will be none! You will let me know, right?</p>
<p>If I am satisfied that there are no major issues with the plugin, then I will make it available for download. In meantime, I will be re-arranging a few things on the website once again to make room for the new plugin and a few others I am thinking about writing. So please excuse construction going on in the next few days!</p>
<div class="shr-publisher-359"></div>

<p>Related posts:<ol><li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background/' rel='bookmark' title='Permanent Link: WP Flickr Background'>WP Flickr Background</a></li>
<li><a href='http://www.myatus.co.uk/2010/02/26/wp-flickr-background-version-1-0-2-beta-available/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.2 (Beta) available'>WP Flickr Background version 1.0.2 (Beta) available</a></li>
<li><a href='http://www.myatus.co.uk/2010/03/06/wp-flickr-background-version-103-betaavailable/' rel='bookmark' title='Permanent Link: WP Flickr Background version 1.0.3 (Beta) available'>WP Flickr Background version 1.0.3 (Beta) available</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.myatus.co.uk/2010/01/20/wp-flickr-background-in-alpha-testing/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
