<?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>Atomic Playboy&#187; internet</title>
	<atom:link href="http://atomicplayboy.net/blog/tag/internet/feed/" rel="self" type="application/rss+xml" />
	<link>http://atomicplayboy.net</link>
	<description>All hail the mushroom cloud</description>
	<lastBuildDate>Sat, 22 May 2010 19:43:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Spotify Bay</title>
		<link>http://atomicplayboy.net/blog/2009/02/23/spotify-bay/</link>
		<comments>http://atomicplayboy.net/blog/2009/02/23/spotify-bay/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 14:16:18 +0000</pubDate>
		<dc:creator>Johan Svensson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[BitTorrent]]></category>
		<category><![CDATA[civil liberties]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[Mutify]]></category>
		<category><![CDATA[Spotify]]></category>
		<category><![CDATA[SpotSave]]></category>
		<category><![CDATA[The Pirate Bay]]></category>

		<guid isPermaLink="false">http://atomicplayboy.net/?p=641</guid>
		<description><![CDATA[Welcome to Spotify Bay. There&#8217;s an application called SpotSave making waves in the Spotify community. SpotSave lets you save music from Spotify straight to your computer, no strings attached, with the same quality you hear straight from Spotify itself. I haven&#8217;t tried it myself, because to be quite frank, Spotify stinks and doesn&#8217;t have any [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to Spotify Bay.</p>

<p>There&#8217;s an application called SpotSave making waves in the Spotify community. SpotSave lets you save music from Spotify straight to your computer, no strings attached, with the same quality you hear straight from Spotify itself.</p>

<p>I haven&#8217;t tried it myself, because to be quite frank, <a href="http://atomicplayboy.net/blog/2009/01/09/spotify-stinks/">Spotify stinks</a> and doesn&#8217;t have any music I enjoy after the Great Purge the record industry performed. (Probably because they don&#8217;t really want to see Spotify succeed, because then they&#8217;d have to move forward to a new business model.)</p>

<p>Now, consider the following statements:</p>


<ul>
<li>SpotSave lets you connect to Spotify to download music to your computer.</li>
<li><a href="http://utorrent.com/">µTorrent</a> lets you connect to clients via The Pirate Bay to download music to your computer.</li>
</ul>



<p>Is there any difference here?</p>

<p>Technically? Not really. Technology doesn&#8217;t care about concepts like &#8220;copyright&#8221; and &#8220;fair use.&#8221;</p>

<p>Spotify wasn&#8217;t designed to let you download music &#8212; the intended design is that you stream music to listen to it.</p>

<h2>Pissing in the stream</h2>

<p>Here&#8217;s another thing technology doesn&#8217;t care about &#8212; the <em>intended</em> design. Here we have another couple of statements to consider:</p>


<ul>
<li>Receive a stream of data from the internet and write it to your hard drive.</li>
<li>Receive a stream of data from the internet and don&#8217;t write it to your hard drive.</li>
</ul>



<p>When you <em>download</em>, you receive a data stream from the internet and write it to your hard drive. When you <em>stream</em>, you receive a data stream from the internet and let an application do something with it, and then throw the data away.</p>

<p>From an outside perspective, it looks identical &#8212; a data stream going from the internet to your computer. What happens inside your computer is what makes the difference between streaming and downloading.</p>

<p>Once the data stream reaches your computer, it&#8217;s a Wild West. Spotify <em>intends</em> for me to stream the data to the Spotify application and never save it, but who are they to tell me what to do with a data stream my computer receives from the internet? Sure, there&#8217;s probably some unreadable legalese in the Spotify <span class="caps">EULA </span>about this, but that&#8217;s not exactly enforcable without a Spotify representative watching over my shoulder, is it?</p>

<p>I haven&#8217;t tried SpotSave, but here&#8217;s a qualified guess at what happens: it looks at connections to/from your computer, identifies the ones going to Spotify, and then makes a copy of the streamed music and writes it to disk.</p>

<p>This is very basic stuff, and has been done before. It was a popular method to save web radio transmissions for later use, and probably the main reason the record industry got their panties in a bunch about web radio technology in the first place.</p>

<h2>Floodgates</h2>

<p>Since history tends to repeat itself, this will start an arms race between Spotify and SpotSave. Spotify will start by encrypting their data stream (and I&#8217;m surprised they didn&#8217;t do it in the first place). If the SpotSave authors pick up the thrown gauntlet, they&#8217;ll dig deeper into Spotify&#8217;s allocated memory and rip the decrypted stream out of that instead. Spotify might claim <a href="http://terranova.blogs.com/terra_nova/2008/03/blizzard-v-wow.html">the Blizzard defense</a> and state that they own the copyright of a part of memory in <em>your computer</em> and sue SpotSave for copyright infringement. And so on.</p>

<p>This is why <span class="caps">DRM </span>&#8211; Digital Restriction Management (though some people insist on the R meaning &#8220;Rights&#8221;) &#8212; keeps failing. In order to prevent the product from being copied, they lock it up with encryption. But the customers can&#8217;t play it if it&#8217;s encrypted, so the key to unlock the encrypted data is <em>also</em> included in the product the customer buys.</p>

<p>That&#8217;s right; the customer gets both the lock and the key. It&#8217;s always just a matter of time until someone discovers where the key is hidden, and then the floodgates are wide open again. All it takes is one person to discover it and then tell someone else. Security through obscurity isn&#8217;t.</p>

<p>Here&#8217;s another cute little application of relevance &#8212; <a href="http://code.google.com/p/mutify/">Mutify</a>. Mutify is an app that also listens to the incoming data stream to Spotify. If it detects a song with a title that is in its database, it simply mutes Spotify until the next song starts. The list of &#8220;songs&#8221; are, of course, the ads Spotify plays for non-paying accounts. If there are new ads you can just click &#8220;This is an ad&#8221; in Mutify and enjoy the silence.</p>

<p>The arms race has already started here, and Mutify currently doesn&#8217;t work as intended with Spotify &#8212; Spotify simply pauses the ad when Mutify mutes the sound. Until then, you can just lower the volume yourself. Let&#8217;s see Spotify try to work around <em>that</em>.</p>

<p>On a similar note, there was a faceless TV exec that expressed great horror at the concept of switching to a different channel during the commercial breaks, stating that you violated a <em>social contract</em> by doing so. What if I need to go pee? What if I mute the sound and read a book until the commercials are over?</p>

<h2>Owning your own interpretation</h2>

<p>I have random thoughts about this all the time &#8212; what kind of control do I actually have over the interpretation of data streams arriving at my computer?</p>

<p>Let&#8217;s take web pages. They&#8217;re written in <a href="http://en.wikipedia.org/wiki/HTML"><span class="caps">HTML</span></a>, which is basically a language that tells your web browser how to display a page.</p>

<p>You could argue that I&#8217;m violating a contract by having a program that auto-mutes Spotify whenever an ad plays. Am I violating a contract if I tell my browser to not show images even if the <span class="caps">HTML </span>tells it to?</p>

<p>I use <a href="http://glimmerblocker.org/">GlimmerBlocker</a> to strip out the image tags for ads and banners from the stream of <span class="caps">HTML </span>before it reaches my browser. Am I violating any contract here? I&#8217;m clearly not viewing the page as the designer intended.</p>

<p>It&#8217;s the Wild West again. Once <span class="caps">HTML </span>reaches my computer, it&#8217;s up to me to render it as I see fit. Noone would argue with me if I surfed with images disabled in the browser due to being on a very slow connection. Stripping out useless banner ads not only preserves your sanity, it also makes the page load way faster due to all the needless crap you don&#8217;t have to download.</p>

<p>I&#8217;ve specifically configured my ad blocker to let text ads from Google through. These ads aren&#8217;t intrusive and don&#8217;t tell you to punch the monkey. This is the type of ads I want to encourage, so I let them display.</p>

<p>Once or twice a year I even click on one.</p><script src="http://feeds.feedburner.com/~s/AtomicPlayboy?i=http://atomicplayboy.net/blog/2009/02/23/spotify-bay/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://atomicplayboy.net/blog/2009/02/23/spotify-bay/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Sharing is Caring</title>
		<link>http://atomicplayboy.net/blog/2009/02/06/sharing-is-caring/</link>
		<comments>http://atomicplayboy.net/blog/2009/02/06/sharing-is-caring/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 01:08:49 +0000</pubDate>
		<dc:creator>Johan Svensson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Atom]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[RSS]]></category>

		<guid isPermaLink="false">http://atomicplayboy.net/?p=628</guid>
		<description><![CDATA[Public service announcement: I read my feeds in Google Reader, and I end up sharing tons of entries I find interesting and/or weird. Here&#8217;s the shared page, or go straight to the feed for it. There will be the occasional item in Swedish, but most of it is English. Addendum: I should also mention that [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Public service announcement:</strong> I read my feeds in <a href="https://www.google.com/reader/">Google Reader</a>, and I end up sharing tons of entries I find interesting and/or weird.</p>

<p><a href="https://www.google.com/reader/shared/15863319510059850124">Here&#8217;s the shared page</a>, or go straight to <a href="http://www.google.com/reader/public/atom/user%2F15863319510059850124%2Fstate%2Fcom.google%2Fbroadcast">the feed</a> for it.</p>

<p>There will be the occasional item in Swedish, but most of it is English.</p>

<p><strong>Addendum:</strong> I should also mention that I have a habit of sharing things that I know interest people that follow my shared items. <a href="http://lonelysavage.com/">Breki</a> wrote about Things recently, so I&#8217;ve shared a handful of Things-related entries that show up in my feed.</p>

<p>Want me to share stuff that interests you? Make sure I read your blog and tell me that you follow my shared items, and I&#8217;m almost certain to start sharing stuff you&#8217;ve blogged about recently.</p><script src="http://feeds.feedburner.com/~s/AtomicPlayboy?i=http://atomicplayboy.net/blog/2009/02/06/sharing-is-caring/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://atomicplayboy.net/blog/2009/02/06/sharing-is-caring/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Bookmarks for January 23rd</title>
		<link>http://atomicplayboy.net/blog/2009/01/23/links-090123/</link>
		<comments>http://atomicplayboy.net/blog/2009/01/23/links-090123/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 04:49:40 +0000</pubDate>
		<dc:creator>Johan Svensson</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[civil liberties]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[file sharing]]></category>
		<category><![CDATA[freeware]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[intellectual property]]></category>
		<category><![CDATA[internet]]></category>

		<guid isPermaLink="false">http://atomicplayboy.net/?p=541</guid>
		<description><![CDATA[<p>These are my links for January 23rd from 04:38 to 04:41</p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying <a href="http://wordpress.org/extend/plugins/postalicious/">Postalicious</a> to automagically post <a href="http://ma.gnolia.com/people/AtomicPlayboy/bookmarks">my Ma.gnolia bookmarks</a> whenever I have enough of them to post. I&#8217;ll need to fiddle a bit with the settings, so for the moment I&#8217;m doing a bit of manual stuff. Let&#8217;s see how this works and if I actually manage to write stuff between the generated link dumps&#8230;</p>

<p>I&#8217;ve already found some bug in the default templates that try to stick paragraph tags in silly places.</p>

<p>These are my links for January 23rd from 04:38 to 04:41:</p>
<ul>
<li><a href="http://arstechnica.com/news.ars/post/20090120-dutch-government-study-net-effect-of-p2p-use-is-positive.html">Dutch government study: net effect of <span class="caps">P2P </span>use is positive</a> &#8211; The Dutch Ministry of Economic Affairs commissioned a study by research company <span class="caps">TNO </span>about how much Dutch Internet users download music, movies, and games, and what the social and economic effects of this downloading are.</li>
<li><a href="http://www.smashingmagazine.com/2008/09/23/practika-a-free-icon-set/">Practika: A Free Icon Set</a> &#8211; Practika: a free set of 11 practical and useful high-quality icons, designed by DryIcons, especially for Smashing Magazine and its readers. The icons are available in resolutions 64&times;64px, 128&times;128px</li>

</ul><script src="http://feeds.feedburner.com/~s/AtomicPlayboy?i=http://atomicplayboy.net/blog/2009/01/23/links-090123/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://atomicplayboy.net/blog/2009/01/23/links-090123/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spam of the Year</title>
		<link>http://atomicplayboy.net/blog/2006/05/18/spam-of-the-year/</link>
		<comments>http://atomicplayboy.net/blog/2006/05/18/spam-of-the-year/#comments</comments>
		<pubDate>Thu, 18 May 2006 10:22:16 +0000</pubDate>
		<dc:creator>Johan Svensson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://atomicplayboy.net/blog/2006/05/18/spam-of-the-year/</guid>
		<description><![CDATA[This spam to my Gmail account had me laughing out loud. Subject: Ihre Domain www.gmail.com ist nicht bei Google gelistet! It&#8217;s a German spammer trying to tell me that &#8220;my&#8221; domain, gmail.com, isn&#8217;t listed in Google! So yeah, you stupid spammer dudes at Finke Marketing. Thanks for the chuckles.]]></description>
			<content:encoded><![CDATA[<p>This spam to my Gmail account had me laughing out loud.</p>

<blockquote><p><strong>Subject:</strong> Ihre Domain www.gmail.com ist nicht bei Google gelistet!</p></blockquote>

<p>It&#8217;s a German spammer trying to tell me that &#8220;my&#8221; domain, gmail.com, isn&#8217;t listed in Google!</p>

<p>So yeah, you stupid spammer dudes at <a href="http://www.google.com/search?q=%22finke+marketing%22">Finke Marketing</a>. Thanks for the chuckles.</p><script src="http://feeds.feedburner.com/~s/AtomicPlayboy?i=http://atomicplayboy.net/blog/2006/05/18/spam-of-the-year/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://atomicplayboy.net/blog/2006/05/18/spam-of-the-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hey, Warren!</title>
		<link>http://atomicplayboy.net/blog/2006/03/29/hey-warren/</link>
		<comments>http://atomicplayboy.net/blog/2006/03/29/hey-warren/#comments</comments>
		<pubDate>Wed, 29 Mar 2006 14:45:52 +0000</pubDate>
		<dc:creator>Johan Svensson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Technorati]]></category>
		<category><![CDATA[trackbacks]]></category>
		<category><![CDATA[Warren Ellis]]></category>

		<guid isPermaLink="false">http://atomicplayboy.net/blog/2006/03/29/hey-warren/</guid>
		<description><![CDATA[Stop doing that, Warren. It&#8217;s wide open for abuse, such as me making all your readers who read via your RSS feed see this. What I&#8217;m talking about is publishing all your Technorati occurences and Flickr comments in your article feed. Reading your own stuff? I love it. That&#8217;s what I want. Reading what every [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.warrenellis.com/?p=2151">Stop doing that, Warren</a>. It&#8217;s wide open for abuse, such as me making all your readers who read via your <span class="caps">RSS </span>feed see this.</p>

<p>What I&#8217;m talking about is publishing all your Technorati occurences and Flickr comments in your article feed. Reading your own stuff? I love it. That&#8217;s what I want. Reading what every boring entity on the planet writes about you? In <em>French</em>? No thanks, not interested. I don&#8217;t speak French.</p>

<p>I suppose I could have e-mailed Warren about this instead, but where&#8217;s the fun in that? Feel free to call me a dick in the comments.</p><script src="http://feeds.feedburner.com/~s/AtomicPlayboy?i=http://atomicplayboy.net/blog/2006/03/29/hey-warren/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://atomicplayboy.net/blog/2006/03/29/hey-warren/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snailmail Spam</title>
		<link>http://atomicplayboy.net/blog/2006/03/20/snailmail-spam/</link>
		<comments>http://atomicplayboy.net/blog/2006/03/20/snailmail-spam/#comments</comments>
		<pubDate>Mon, 20 Mar 2006 21:00:35 +0000</pubDate>
		<dc:creator>Johan Svensson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Atomic Playboy]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://atomicplayboy.net/blog/2006/03/20/snailmail-spam/</guid>
		<description><![CDATA[I had a letter waiting for me when I got home after watching V For Vendetta, of which I might rant later. US air mail, eh? I rip it open. Some silly domain registrar, Domain Registry of America (who in the fine print state they are not affiliated with or endorsed by the government of [...]]]></description>
			<content:encoded><![CDATA[<p>I had a letter waiting for me when I got home after watching <em>V For Vendetta</em>, of which I might rant later. US air mail, eh? I rip it open.</p>

<p>Some silly domain registrar, Domain Registry of America (who in the fine print state they are not affiliated with or endorsed by the government of the United States) wants me to host this very domain, and what a fancy name said domain has, at them instead of <a href="http://gandi.net/">Gandi</a>, my current registrar.</p>

<p>I would consider it if their yearly fee wasn&#8217;t <strong>216%</strong> of what I&#8217;m paying right now. €26 per year? I pay €12 now. That pricing has no attachment whatsoever to reality.</p>

<p>And why does your spam look so much like a bill? Hidden deep in a paragraph you say that it isn&#8217;t, yet you do your best to make it look like one. Add some <span class="caps">FUD </span>about &#8220;losing your online identity&#8221; and I put you on my shit list.</p>

<p>Well, thanks for sending me something to light the fireplace with.</p><script src="http://feeds.feedburner.com/~s/AtomicPlayboy?i=http://atomicplayboy.net/blog/2006/03/20/snailmail-spam/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://atomicplayboy.net/blog/2006/03/20/snailmail-spam/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An introduction to mod_security</title>
		<link>http://atomicplayboy.net/blog/2005/01/30/an-introduction-to-mod-security/</link>
		<comments>http://atomicplayboy.net/blog/2005/01/30/an-introduction-to-mod-security/#comments</comments>
		<pubDate>Sun, 30 Jan 2005 20:38:03 +0000</pubDate>
		<dc:creator>Johan Svensson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Noteworthy]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[mod_security]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://atomicplayboy.net/blog/2005/01/16/an-introduction-to-mod_security/</guid>
		<description><![CDATA[An introduction to mod_security and how it can stomp comment spam and referral spam into the ground.]]></description>
			<content:encoded><![CDATA[<p>Inspired by <a href="http://cavlec.yarinareth.net/archives/2005/01/11/killing-referrer-spam/">this article</a> I decided to make a similar article that shows the advantages of <a href="http://modsecurity.org/">mod_security</a> over stopping spam by using <a href="http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html">mod_rewrite</a>.</p>

<p>I started using <a href="http://www.textdrive.com/">TextDrive</a> in June 2004. When comment spam became a very large problem for <a href="http://movabletype.org/">Movable Type</a> users due to poor programming in mt-comments.cgi, a mailing list was set up to figure out a way to fight back against spam. And mod_security was our weapon of choice.</p>

<p><strong>Addition:</strong> I should mention that other TextDrive users usually won&#8217;t have to bother blocking the common spam; we spot attacks very quickly on the aforementioned mailing list and add a global rule to block it across all TextDrive servers.</p>

<p>This is what mod_security has to say about itself in a single paragraph:</p>

<blockquote><p>ModSecurity is an open source intrusion detection and prevention engine for web applications. Operating as an Apache Web server module, the purpose of ModSecurity is to increase web application security, protecting web applications from known and unknown attacks.</p></blockquote>

<p>While mod_rewrite is good at rewriting <span class="caps">URL</span>s, it&#8217;s a very poor choice for fighting spam. It requires quite a lot of obscure commands to block a single <span class="caps">URL. </span>mod_security, on the other hand, can block an <span class="caps">URL </span>with a single line in your .htaccess file.</p>

<p>I won&#8217;t explain how you install mod_security, so let&#8217;s pretend we already covered that part. Now for the good stuff.</p>

<h2>Configuring mod_security</h2>

<p>This is how you start mod_security, either in your global Apache configuration, or in a .htaccess file:</p>

<pre><code>SecFilterEngine DynamicOnly
SecFilterScanPOST On
SecAuditLog logs/audit_log</code></pre>

<p>The first line tells Apache to run mod_security, but only on dynamic pages (PHP, <span class="caps">CGI </span>scripts, whathaveyou). You can also set it to <kbd>On</kbd> instead of <kbd>DynamicOnly</kbd>, if you want to scan all requests for all pages.</p>

<p>The second line is where mod_security really starts to trounce mod_rewrite: enable scanning of <span class="caps">POST </span>headers. This is something that mod_rewrite is unable to do.</p>

<p>The <span class="caps">POST </span>data is the actual data that gets submitted to a web server, such as comment forms. This means that mod_security can filter based on content in the comments, and even in specific fields, if you only want to make a rule based on the author of a comment.</p>

<p>The third line tells Apache where to store the audit log from mod_security. This log file contains everything that mod_security catches, if you have configured it to log that particular rule.</p>

<p>Let&#8217;s add a fourth line before we begin the actual block rules: the default action.</p>

<pre><code>SecFilterDefaultAction &quot;deny,log,status:412&quot;</code></pre>

<p>This set the default action for rules that have no action defined, so that you don&#8217;t have to re-type the action for every rule. This line sets the default mode to &#8220;block the request, log it, and give the client an Error 412.&#8221;</p>

<p>I prefer Error 412 (Precondition Failed) over Error 403 (Access Denied). 403 is &#8220;You&#8217;re not allowed to be here,&#8221; while 412 is &#8220;We don&#8217;t serve your kind here.&#8221; 403 is the &#8220;Staff only&#8221; sign; 412 is the bouncer at the door checking his list of misbehaving persons.</p>

<h2>Let&#8217;s start blocking!</h2>

<p>Now, let&#8217;s build some rules. The basic rules have two formats:</p>

<pre><code>SecFilter PATTERN [ACTION]</code></pre>

<p>This scans the request for <span class="caps">PATTERN, </span>and uses the default action if it matches <span class="caps">PATTERN.</span> It also accepts an optional <span class="caps">ACTION </span>argument, which uses the same format as the <kbd>SecFilterDefaultAction </kbd> above. If you have lots of spam to block, it&#8217;s easier to define a default action and only use the first version to block spam.</p>

<p>However, it doesn&#8217;t scan the <span class="caps">POST </span>headers unless we told mod_security to do so. Which we did above. So you could create a rule to stop viagra spam like this:</p>

<pre><code>SecFilter &quot;viagra&quot;</code></pre>

<p>This will block referral spam containing &#8220;viagra&#8221; in the <span class="caps">URL </span>or in a comment (since we enabled <span class="caps">POST </span>scans). But since SecFilter scans the entire request, it also checks for it in the user agent field. While I don&#8217;t know about any browsers called &#8220;Viagra&#8221; we can never be sure that they really do exist, and that&#8217;s why I prefer to be very specific about what part of the request should be scanned. We really don&#8217;t want to block legitimate users by accident, like comments containing &#8220;Hey, I get tons of Viagra spam too!&#8221;</p>

<p>You can also use regular expressions in the rules:</p>

<pre><code>SecFilter &quot;(viagra|mortgage|herbal)&quot;</code></pre>

<p>If we want to use an action different than the default action, we can do it like this:</p>

<pre><code>SecFilter &quot;viagra&quot; &quot;allow,nolog&quot;</code></pre>

<p>This will allow anything containing &#8220;viagra&#8221; to pass the filter, and it won&#8217;t be logged in the audit log.</p>

<h2>Selective blocking</h2>

<p>To do a more specific scan, we can use <kbd>SecFilterSelective</kbd> instead. It takes the following arguments:</p>

<pre><code>SecFilterSelective LOCATION PATTERN [ACTION]</code></pre>

<p>Now we can define what part of the request we want to scan in, by supplying the <span class="caps">LOCATION </span>argument before the <span class="caps">PATTERN </span>argument. Let&#8217;s say we get tons of referral spam by someone pimping his &#8220;buyviagra.com&#8221; site. We can scan in the referral header only and block his entire domain from ever referring us:</p>

<pre><code>SecFilterSelective &quot;HTTP_REFERER&quot; &quot;buyviagra.com&quot;</code></pre>

<p><strong><span class="caps">NOTE</span>:</strong> As of mod_security 1.8, there is no need to escape dots in domain names. This is managed automatically by mod_security.</p>

<p>Presto! We never see referral spam from that domain again. Note that I did not supply the <span class="caps">ACTION </span>argument, since it saves me some typing to let the default action trickle down from the settings above. It also makes it easier to read the rules.</p>

<p>Note, however, that this only blocks referrals from that specific domain. There&#8217;s nothing stopping him from referral spamming with &#8220;buymyviagradamnit.com&#8221; instead. We can of course use regular expressions here as well:</p>

<pre><code>SecFilterSelective &quot;HTTP_REFERER&quot; &quot;(viagra|mortgage|texasholdem)&quot;</code></pre>

<p>There are many fields you can scan selectively, and you can also define several fields to scan on the same line. Just separate them by commas in the <span class="caps">LOCATION </span>argument. For a list of all fields you can scan selectively, please see <a href="http://www.modsecurity.org/documentation/">the reference manual</a>.</p>

<h2>Blocking IP addresses</h2>

<p>If there&#8217;s a specific IP address that hits you especially hard, you can block it by scanning the <span class="caps">REMOTE</span>_ADDR header:</p>

<pre><code>SecFilterSelective &quot;REMOTE_ADDR&quot; &quot;^83.142.57.250$&quot;</code></pre>

<p>Note that I begin the pattern with ^ and end it with $. These are regular expression special characters that tell it to only match from the beginning of the line, as well as the end of the line. If I didn&#8217;t have the starting ^, I would not only block 83.142.57.250, but also 183.142.57.250 since it contains the same pattern. Using them both means &#8220;match the entire line.&#8221;</p>

<h2>Scanning <span class="caps">POST </span>payloads</h2>

<p>So far we&#8217;ve done the same things that we can do with mod_rewrite, and the only advantage has been that it saved us some typing and resulted in more readable lines. Now for something that mod_rewrite cannot do: scanning <span class="caps">POST </span>content!</p>

<p>The <span class="caps">POST </span>headers contain the contents of forms that are submitted to the server from the browser. Scanning this means you can scan the contents of comments, and find attempted spam even there. Use the <span class="caps">POST</span>_PAYLOAD location to scan:</p>

<pre><code>SecFilterSelective &quot;POST_PAYLOAD&quot; &quot;(mortgage|viagra)&quot;</code></pre>

<p>And now nobody can post comments containing <kbd>mortgage</kbd> or <kbd>viagra</kbd> any more.</p>

<p>But it doesn&#8217;t stop there! You can also scan inside specific arguments in the <span class="caps">POST </span>payload. Let&#8217;s say we want to allow people to talk about viagra and other spammy words, but disallow those words in the <span class="caps">URL </span>field in Movable Type and WordPress. In both of these, the <span class="caps">URL </span>field is called <kbd>url</kbd>.</p>

<pre><code>SecFilterSelective &quot;ARG_url&quot; &quot;(mortgage|viagra)&quot;</code></pre>

<h2>Closing statements</h2>

<p>That was a brief introduction to the most useful features of mod_security. Remember to always think about what it is you will <em>really</em> block with the rule you just wrote, and figure out a way to be specific enough without trapping legitimate users.</p>

<p>Mark Pilgrim once <a href="http://diveintomark.org/archives/2003/11/15/more-spam">wrote an entry</a> about the futility of blocking specific domains, and I agree completely.</p>

<blockquote><p>Savor this moment, folks. You can tell your children stories of how, back in the early days of weblogging, you could print out the entire spam blacklist on a single sheet of paper. Maybe with two or three columns and a smallish font, but still. Boy, those were the days.</p>

<p>And they won&#8217;t last. They absolutely won&#8217;t last. They won&#8217;t last a month. The domain list will grow so unwieldy so quickly, you won&#8217;t know what hit you. It&#8217;ll get so big that it will take real bandwidth just to host it. Keeping it a free download will make you go broke. Code is free, but bandwidth never will be. Do you have a business plan? You&#8217;ll need one within 6 months. <cite>Mark Pilgrim</cite></p></blockquote>

<p>This is why it will be very tiresome to block specific domains. Right now there is a spammer who has bought expired domains, and use them for referral and comment spam. There&#8217;s nothing spammy about these domain names; no &#8220;viagra&#8221; or &#8220;mortgage&#8221; that you can scan for. As the master of your own domain, there&#8217;s not really much you can do about attacks like these except for blocking the individual domains.</p>

<p>The real battle here must be fought at a server-wide level. There are Apache modules in the works that can scan hits across entire web servers and all the domains hosted there, and find patterns in these hits. Unless it&#8217;s the Google bot doing a drive-by, 200 domains hosted by the same company are very unlikely to be hit by the same comment spam within 24 hours, and here you can find a pattern and block it.</p>

<p>There is already a module originally designed to fight <a href="http://searchsecurity.techtarget.com/sDefinition/0,,sid14_gci557336,00.html">DDoS attacks</a>. By modifying the thresholds on this module, it can be used to block IP addresses that try to flood with comments or referrals too fast.</p>

<p>But it will almost always be the spammer that chooses the battlefield. The spammers just have to open the floodgate on their spam tools; it is us normal users that have to bother about verifying the visitors and comments so we don&#8217;t block the genuine stuff by accident. There are good countermeasures against comment spam, but the only 100% certain method is to disable comments completely.</p>

<p>It wouldn&#8217;t be too hard to script a browser to make it a spam tool, and I have reason to suspect that spammers already do this. Imagine a worm that infects Windows computers around the world (not too taxing on the imagination), and then sits hidden and uses Internet Explorer to act, sound and smell like a genuine browser, including calculacing <a href="http://www.hashcash.org/">hash cash</a> and other popular spam/DDoS countermeasures. The spammers don&#8217;t care; they have all the time in the world and aren&#8217;t even using their own computers for the calculations.</p>

<p>Imagine 500,000 of these computers, all able to be remotely controlled by spammers who then pay for access to their network of distributed zombie machines with real browsers doing the work as to better look like a genuine commenter. Even if a zombie only sends one spam comment per minute to avoid detection by flood countermeasures, that&#8217;s still 100,000 comments in a minute from the entire zombie net. 360,000,000 comments in a day.</p>

<p>The hash cash and other checksum systems will say that these are genuine comments. That&#8217;s why a good spam countermeasure uses several methods to scan the incoming comment. Again, the spammers put the burden of using resources on their victims.</p>

<h2>Further reading</h2>


<ul>
<li><a href="http://www.modsecurity.org/documentation/">ModSecurity documentation</a></li>
<li><a href="http://www.modsecurity.org/documentation/modsecurity-manual.pdf">ModSecurity reference manual</a> (PDF)</li>
<li><a href="http://www.fornax.net/regex/">A Whirlwind Guide to Regular Expressions</a></li>
</ul>

<script src="http://feeds.feedburner.com/~s/AtomicPlayboy?i=http://atomicplayboy.net/blog/2005/01/30/an-introduction-to-mod-security/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://atomicplayboy.net/blog/2005/01/30/an-introduction-to-mod-security/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Nasty crawlers</title>
		<link>http://atomicplayboy.net/blog/2004/12/11/nasty-crawlers/</link>
		<comments>http://atomicplayboy.net/blog/2004/12/11/nasty-crawlers/#comments</comments>
		<pubDate>Sat, 11 Dec 2004 15:03:52 +0000</pubDate>
		<dc:creator>Johan Svensson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[mod_security]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://atomicplayboy.net/blog/2004/12/11/nasty-crawlers/</guid>
		<description><![CDATA[There&#8217;s a discussion on the TextDrive forums about how the MSN spider bot behaves. And it&#8217;s quite rude. Microsoft wanted to be able to boast with a large page index when their new MSN Search went public beta. So they released the leash on the MSN crawler and let it index at full speed, saturating [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s <a href="http://forum.textdrive.com/viewtopic.php?id=1289">a discussion</a> on the TextDrive forums about how the <span class="caps">MSN </span>spider bot behaves. And it&#8217;s quite rude.</p>

<p>Microsoft wanted to be able to boast with a large page index when their new <span class="caps">MSN</span> Search went public beta. So they released the leash on the <span class="caps">MSN </span>crawler and let it index at full speed, saturating the bandwidth of the victim site if necessary.</p>

<p>That equals about $150 of bandwidth bills in two weeks for TextDrive, or $4000 yearly. So it was banned for a while until it behaved properly. Paying $4000 per year just to be in a search engine is madness.</p>

<p><span class="caps">MSN</span> Search isn&#8217;t very smart either. Quite frankly, it&#8217;s <em>stupid</em>. It wasn&#8217;t <em>quite</em> banned from TextDrive servers; it actually got a redirect via <a href="http://www.modsecurity.org/">mod_security</a> to the <a href="http://search.msn.com/webmasters/default.aspx"><span class="caps">MSN</span> Bot info page</a>. It then parsed the info on <em>that</em> page as if it was the result from the pages it was denied access to, and added it as a search result for those pages.</p>

<p>Stupid, stupid, stupid.</p>

<p>I also had a visit from the <a href="http://www.popdex.com/">Popdex</a> crawler today.</p>

<p>My definition of rude and abusive bots is as follows: if it leaves a referrer without the referring page actually containing a link to my site, it is considered fraudulent behavior. If it gorges and gobbles pages at a rapid pace, it is considered abuse of my site.</p>

<p>The Popdex crawler did both. It crawled 350 pages in two minutes. Twice per page, for 700 requests in two minutes. And it filled my logs with fake referrals to popdex.com.</p>

<p>Bam. Banned.</p><script src="http://feeds.feedburner.com/~s/AtomicPlayboy?i=http://atomicplayboy.net/blog/2004/12/11/nasty-crawlers/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://atomicplayboy.net/blog/2004/12/11/nasty-crawlers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
