<?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>diginc</title>
	<atom:link href="http://diginc.us/feed/" rel="self" type="application/rss+xml" />
	<link>http://diginc.us</link>
	<description>\'dij-iŋk\</description>
	<lastBuildDate>Thu, 19 May 2011 14:49:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Autostart a Virtualbox VM in Windows 7 the Easy Way</title>
		<link>http://diginc.us/microsoft/2011/autostart-a-virtualbox-vm-in-windows-7-the-easy-way/</link>
		<comments>http://diginc.us/microsoft/2011/autostart-a-virtualbox-vm-in-windows-7-the-easy-way/#comments</comments>
		<pubDate>Thu, 19 May 2011 04:34:28 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=235</guid>
		<description><![CDATA[I&#8217;ve seen a few tutorials out there about setting up a headless Virtualbox service in windows in order to autostart a VM and wasted a few hours of my life following pages of instructions ending in giving up. I recently &#8230; <a href="http://diginc.us/microsoft/2011/autostart-a-virtualbox-vm-in-windows-7-the-easy-way/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen a few tutorials out there about setting up a headless Virtualbox service in windows in order to autostart a VM and wasted a few hours of my life following pages of instructions ending in giving up.  I recently reinstalled windows 7 on my home HTPC/Server and wanted a linux VM to autostart whenever Windows decided to run updates and auto restart.  I swore I wouldn&#8217;t attempt the awful services method again and would insead follow the principle of keep it simple stupid.  </p>
<p>My only caveat in setting up this autostarting headless VM was that Windows 7 remain password protected when it started up (task scheduler&#8217;s on start trigger function didn&#8217;t prove much help with this goal BTW)&#8230;a little less simple but I managed to keep it under 3 steps somehow, mostly thanks to superuser&#8217;s superb knowledge base and some luck googling.  Keep in mind I have a single user setup on this windows 7 machine.  Multiple users might require you force the machine to always logon to your VirtualBox/Startup script user by default after a reboot&#8230;so you&#8217;ve been warned.  Here&#8217;s how it&#8217;s done: </p>
<ol>
<li>download <a href="http://www.ntwind.com/software/utilities/hstart.html">hstart</a> (see README)
<li>Remove/un-check the &#8220;User must enter a username and password to use this computer&#8221; checkbox option from Start -> Run -> `control userpasswords2` (But wait&#8230;didn&#8217;t you just say&#8230;YES KEEP READING)</li>
<li>write a batch script in your startup folder containing (psudocode): C:/hstart.exe /NOCONSOLE &#8220;VMBoxHeadless.exe -start-vm &#8216;your-vm-name&#8217;&#8221; followed by &#8220;rundll32.exe user32.dll,LockWorkStation&#8221;</li>
</li>
</ol>
<p>The name VMBoxHeadless is a bit misleading since you still have a cmd window to leave open as long as you want your VM running if you run it through a batch script, that&#8217;s where hstart comes in.  Then you have to tell windows to logon automatically instead of waiting for the user to enter a username/password.  Finally your batch script run VMBoxHeadless through hstart and then just re-locks your computer afterwards and you have a primed and ready VM waiting for you upon restart.  If your VM name has spaces it might require escaped quotes or single quotes around it, I used a hyphen in my name so I didn&#8217;t have to deal with that problem.</p>
<p>Here&#8217;s an eaxmple batch script</p>
<p>C:\Users\HTPC\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\hstart a-serv headless.bat:</p>

<div class="wp_codebox"><table><tr id="p2352"><td class="code" id="p235code2"><pre class="winbatch" style="font-family:monospace;"><span style="color: #ff0000;">&quot;E:\scripts\hstart64.exe&quot;</span> <span style="color: #66cc66;">/</span>NOCONSOLE <span style="color: #ff0000;">&quot;C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe -startvm a-serv&quot;</span> 
rundll32.exe user32.dll,LockWorkStation</pre></td></tr></table></div>

<p>References (yay superuser!)<br />
<a href="http://superuser.com/questions/120875/what-is-the-best-way-to-hide-a-command-prompt-window">What is the best way to hide a command prompt window?</a><br />
<a href="http://superuser.com/questions/21179/command-line-cmd-command-to-lock-a-windows-machine">Command line cmd command to lock a windows machine</a></p>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/microsoft/2011/autostart-a-virtualbox-vm-in-windows-7-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Synchronize save games between windows computers.  Cloud save games with Dropbox. [Minecraft/Dragon Age]</title>
		<link>http://diginc.us/microsoft/2011/synchronize-save-games-between-windows-computers-cloud-save-games-with-dropbox-minecraftdragon-age/</link>
		<comments>http://diginc.us/microsoft/2011/synchronize-save-games-between-windows-computers-cloud-save-games-with-dropbox-minecraftdragon-age/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 07:06:17 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=226</guid>
		<description><![CDATA[Steam Cloud in games like Valve&#8217;s Half Life franchise and Torchlight is really handy for synchronizing save games across laptops/desktops or work computers. But I want it in more games! So I did it my self with some easy symbolic &#8230; <a href="http://diginc.us/microsoft/2011/synchronize-save-games-between-windows-computers-cloud-save-games-with-dropbox-minecraftdragon-age/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Steam Cloud in games like Valve&#8217;s Half Life franchise and Torchlight is really handy for synchronizing save games across laptops/desktops or work computers.  But I want it in more games!  So I did it my self with some easy symbolic links and a <a href="http://db.tt/hzfiGnk">Dropbox account</a> (signup for one now using my link if you don&#8217;t have one yet).  Here are two quick examples of how you would make Minecraft and Dragon Age: Origins saves go to your dropbox rather than your user account tied to your computer.  You&#8217;ll have to do this on each computer you want to syncronize save games to the cloud.  Keep in mind, if you don&#8217;t know what you&#8217;re doing and screw up you might loose your saves by trying this so here&#8217;s your warning: <strong>Back up your save folders before running the below commands</strong>.  </p>
<p>I&#8217;m writing the symbolic link commands so they are as copy pastable as possible, for multiple windows releases.  If all else fails, use the full path rather than the environment variable (%APPDATA%, %HOMEPATH%).</p>
<p>Lets Begin, first make a folder in your dropbox folder called &#8216;Game Saves&#8217; to house your new save games.  Then within this new saves folder make a folder for your games, (e.g. Minecraft/Dragon Age)</p>
<p>Now you need to know where your save game folder is for each game, we&#8217;ll start with Minecraft.  In either windows XP, Vista, or 7 you can just go to your Start button, Run (or windows+R shortcut) and enter `%APPDATA%\.minecraft\` and you&#8217;ll see the saves folder.  Move it to some place safe or just rename it to &#8220;saves_backup&#8221;.  Then you want to put another copy of the `saves` folder in your newly crated `Dropbox\Game Saves\Minecraft\` folder. [Note: Copying a large Minecraft saves folder can take a while because of the massive amount of tiny files used by Minecraft]</p>
<p>After that&#8217;s done successfully, open another Run prompt from the Windows Start menu and this time type in `cmd`.  In the black DOS command prompt that opens enter this (Note you may need to change the Dropbox path if yours is &#8220;My Dropbox&#8221; or customized)</p>

<div class="wp_codebox"><table><tr id="p2266"><td class="code" id="p226code6"><pre class="winbatch" style="font-family:monospace;">mklink <span style="color: #66cc66;">/</span>D <span style="color: #ff0000;">&quot;%APPDATA%\.minecraft\saves&quot;</span> <span style="color: #ff0000;">&quot;%HOMEPATH%\Dropbox\Save Games\Minecraft\saves&quot;</span></pre></td></tr></table></div>

<p>For Dragon Age: Origins you should find your save games in `%HOMEPATH%\Documents\BioWare\Dragon Age`.  Move and or backup the Characters folder.  Then copy the Characters folder to `Dropbox\Game Saves\Dragon Age Origins\`</p>

<div class="wp_codebox"><table><tr id="p2267"><td class="code" id="p226code7"><pre class="winbatch" style="font-family:monospace;">mklink <span style="color: #66cc66;">/</span>D <span style="color: #ff0000;">&quot;%HOMEPATH%\Documents\BioWare\Dragon Age\Characters&quot;</span> <span style="color: #ff0000;">&quot;%HOMEPATH%\Dropbox\Save Games\Dragon Age\Characters&quot;</span></pre></td></tr></table></div>

<p>Just to reiiterate the fact you have to change your path, here is another command I had to run using a different dropbox path (one computer used &#8216;My Dropbox&#8217;, the other just used &#8216;Dropbox&#8217; for some reason).</p>

<div class="wp_codebox"><table><tr id="p2268"><td class="code" id="p226code8"><pre class="winbatch" style="font-family:monospace;">mklink <span style="color: #66cc66;">/</span>D <span style="color: #ff0000;">&quot;%HOMEPATH%\Documents\BioWare\Dragon Age\Characters&quot;</span> <span style="color: #ff0000;">&quot;%HOMEPATH%\My Dropbox\Save Games\Dragon Age\Characters&quot;</span></pre></td></tr></table></div>

<p>This concept is easily applied to any game.  Just change the paths to match where that game&#8217;s saved files folder are located; usually they&#8217;re in my `documents/my saves`, or` my docuemnts/publisher name`, or one of application data&#8217;s folders.</p>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/microsoft/2011/synchronize-save-games-between-windows-computers-cloud-save-games-with-dropbox-minecraftdragon-age/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using IPTables with Dynamic IP hostnames like dyndns.org</title>
		<link>http://diginc.us/linux/2010/using-iptables-with-dynamic-ip-hostnames-like-dyndns-org/</link>
		<comments>http://diginc.us/linux/2010/using-iptables-with-dynamic-ip-hostnames-like-dyndns-org/#comments</comments>
		<pubDate>Wed, 26 May 2010 15:51:42 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=172</guid>
		<description><![CDATA[Whenever IPTables has a hostname in a rule it looks up the hostname&#8217;s IP address and uses that instead of the actual hostname &#8211; so it&#8217;s stuck with the IP until the next time IPTables is flushed/restarted. Here&#8217;s a quick &#8230; <a href="http://diginc.us/linux/2010/using-iptables-with-dynamic-ip-hostnames-like-dyndns-org/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Whenever IPTables has a hostname in a rule it looks up the hostname&#8217;s IP address and uses that instead of the actual hostname &#8211; so it&#8217;s stuck with the IP until the next time IPTables is flushed/restarted.  Here&#8217;s a quick little python script to stick in a crontab which checks the IP of your dynamic IP hostname (free ones provided by dyndns.org) and will restart iptables if it catches a change in your hostname.  The script was made for CentOS so should work on Red Hat based distributions &#8211; if you don&#8217;t have an /etc/init.d/iptables file you&#8217;ll have to modify the reload iptables command in the source.  Viewable Source After Jump</p>
<p>I just set this up as root and in root&#8217;s crontab.</p>
<p><a href="/examples/iptables_dyndns_update.py">Download Source</a></p>
<p><span id="more-172"></span></p>
<p><strong>Source:</strong></p>

<div class="wp_codebox"><table><tr id="p17211"><td class="code" id="p172code11"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> gettextoutput<span style="color: black;">&#40;</span><span style="color: #dc143c;">cmd</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;Return (status, output) of executing cmd in a shell.&quot;&quot;&quot;</span>
    pipe = <span style="color: #dc143c;">os</span>.<span style="color: black;">popen</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'{ '</span> + <span style="color: #dc143c;">cmd</span> + <span style="color: #483d8b;">'; } 2&gt;&amp;1'</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
    pipe = <span style="color: #dc143c;">os</span>.<span style="color: black;">popen</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">cmd</span> + <span style="color: #483d8b;">' 2&gt;&amp;1'</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
    text = pipe.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> text<span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>: text = text<span style="color: black;">&#91;</span>:-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> text
&nbsp;
home_dyndns = <span style="color: #483d8b;">&quot;example.dyndns.org&quot;</span>
log_dyndns = <span style="color: #483d8b;">&quot;./new_home_ip_check.log&quot;</span>
last_dyndns = gettextoutput<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;cat &quot;</span> + log_dyndns<span style="color: black;">&#41;</span>
cur_dyndns = gettextoutput<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;host &quot;</span> + home_dyndns<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Log: &quot;</span>+ last_dyndns
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Cur: &quot;</span>+ cur_dyndns
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> last_dyndns == cur_dyndns:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;IPs match, no restart necessary&quot;</span>
<span style="color: #ff7700;font-weight:bold;">else</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Updating last IP with current&quot;</span>
    <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;echo '&quot;</span> + cur_dyndns + <span style="color: #483d8b;">&quot;' &gt; &quot;</span> + log_dyndns<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Restarting iptables to update&quot;</span>
    <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;/etc/init.d/iptables restart&quot;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p><strong>Output looks like:</strong></p>

<div class="wp_codebox"><table><tr id="p17212"><td class="code" id="p172code12"><pre class="bash" style="font-family:monospace;">Log: example.dyndns.org has address 114.76.37.112
Cur: example.dyndns.org has address 114.76.37.112
IPs match, no restart necessary
&nbsp;
Log: example.dyndns.org has address 114.76.37.113
Cur: example.dyndns.org has address 114.76.37.112
Updating <span style="color: #c20cb9; font-weight: bold;">last</span> IP with current
Restarting iptables to update
Flushing firewall rules:                                   <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span>
Setting chains to policy ACCEPT: filter                    <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span>
Unloading iptables modules:                                <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span>
Applying iptables firewall rules:                          <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span>
Loading additional iptables modules: ip_conntrack_netbios_n<span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://diginc.us/linux/2010/using-iptables-with-dynamic-ip-hostnames-like-dyndns-org/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Bash Script: Confirm domains in your DNS Bind server are still pointed at your address (haven&#8217;t moved to other DNS)</title>
		<link>http://diginc.us/linux/2010/bash-script-confirm-domains-in-your-dns-bind-server-are-still-pointed-at-your-address-havent-moved-to-other-dns/</link>
		<comments>http://diginc.us/linux/2010/bash-script-confirm-domains-in-your-dns-bind-server-are-still-pointed-at-your-address-havent-moved-to-other-dns/#comments</comments>
		<pubDate>Fri, 07 May 2010 16:02:13 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Bind]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=161</guid>
		<description><![CDATA[Here&#8217;s a quick script I wrote last year which I forgot about until today. I thought I should share it since it works fairly well with some modifications &#8211; it could be refined/improved quite a bit; I&#8217;m not the best &#8230; <a href="http://diginc.us/linux/2010/bash-script-confirm-domains-in-your-dns-bind-server-are-still-pointed-at-your-address-havent-moved-to-other-dns/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick script I wrote last year which I forgot about until today.  I thought I should share it since it works fairly well with some modifications &#8211; it could be refined/improved quite a bit; I&#8217;m not the best bash/shell scripter.  Be prepared to get your hands dirty with mods if you want to use this.  Here&#8217;s a quick run down &#038; description of what&#8217;s going on.</p>
<p>The script&#8217;s input is the bind9 file containing all zone entries you want to confirm are pointed to your server, I suggest making a copy &#8211; not working with any live configs.  The script will run an lookup using `<code>host -t ns</code>` on google&#8217;s DNS server to find out what the outside world thinks the domains&#8217; name servers are; I tried `<code>whois</code>` in the past but it was too unreliable due to timeouts &#038; limits on the number of calls per minute.  Then it checks the results of that host lookup against the hostnames, all capitalized hostnames, and IP addresses of your DNS servers (3 in my case).  If any one of the DNS servers matches than we know the domain is still using our DNS.  The other options are 1) it doesn&#8217;t find any DNS servers that are ours 2) it finds the phrase &#8216;not found&#8217; which host returns if the domain is expired or there are no &#8216;NS&#8217; type records in DNS.  The script echos to shell what DNS servers match as it runs, but it only logs the DNS servers that don&#8217;t have any matches (so they can be removed by automation or manually later).</p>
<p>With the zone-audit.log output I then can remove the domains that aren&#8217;t using our DNS since they&#8217;re no longer in use.  Please leave feedback in the comments if you think of a good improvement.</p>
<p>Code after the jump or <a href="/examples/confirm-dns-zones.php">Here</a><br />
<span id="more-161"></span></p>

<div class="wp_codebox"><table><tr id="p16114"><td class="code" id="p161code14"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #007800;">domains</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">'s/^zone\s*\&quot;\([^\&quot;]*\)\&quot;\s* {[^\r]*/\1/p'</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>confirm-dns-zones<span style="color: #000000; font-weight: bold;">/</span>named.master<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>confirm-dns-zones<span style="color: #000000; font-weight: bold;">/</span>zone-audit.log
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$domains</span>
<span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Checking <span style="color: #007800;">$i</span>&quot;</span>
  <span style="color: #007800;">domain_ns</span>=<span style="color: #000000; font-weight: bold;">`</span>host <span style="color: #660033;">-t</span> ns <span style="color: #007800;">$i</span> 8.8.8.8 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$domain_ns</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'NS1.EXAMPLE'</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'ns1.example'</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'4.3.2.1'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span> contains DNS1 (4.3.2.1)&quot;</span>
    <span style="color: #007800;">match_dns1</span>=TRUE
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #666666; font-style: italic;">#echo &quot;DNS1 NOT FOUND&quot;</span>
    <span style="color: #007800;">match_dns1</span>=FALSE
  <span style="color: #000000; font-weight: bold;">fi</span>;
&nbsp;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'NS2.EXAMPLE'</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'ns2.example'</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'4.3.2.2'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span> contains DNS2 (4.3.2.2)&quot;</span>
    <span style="color: #007800;">match_dns2</span>=TRUE
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #666666; font-style: italic;">#echo &quot;DNS2 NOT FOUND&quot;</span>
    <span style="color: #007800;">match_dns2</span>=FALSE
  <span style="color: #000000; font-weight: bold;">fi</span>;
&nbsp;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'NS3.EXAMPLE'</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'ns3.example'</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'4.3.2.3'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span> contains DNS3 (4.3.2.3)&quot;</span>
    <span style="color: #007800;">match_dns3</span>=TRUE
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #666666; font-style: italic;">#echo &quot;DNS3 NOT FOUND&quot;</span>
    <span style="color: #007800;">match_dns3</span>=FALSE
  <span style="color: #000000; font-weight: bold;">fi</span>;
&nbsp;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$match_dns1</span> == FALSE <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">$match_dns2</span> == FALSE <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">$match_dns3</span> == FALSE <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;* ERROR: <span style="color: #007800;">$i</span> - None of our DNS found for this domain using 8.8.8.8&quot;</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>confirm-dns-zones<span style="color: #000000; font-weight: bold;">/</span>zone-audit.log
  <span style="color: #000000; font-weight: bold;">fi</span>;
&nbsp;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$domain_ns</span> =~ <span style="color: #ff0000;">'not found'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;* Possible script error or missing DNS / Expired domain&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;* ERROR: <span style="color: #007800;">$i</span> - Possible script error or missing DNS / Expired domain&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>confirm-dns-zones<span style="color: #000000; font-weight: bold;">/</span>zone-audit.log
  <span style="color: #000000; font-weight: bold;">fi</span> 
&nbsp;
  <span style="color: #7a0874; font-weight: bold;">echo</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;----------------&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span>
  <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://diginc.us/linux/2010/bash-script-confirm-domains-in-your-dns-bind-server-are-still-pointed-at-your-address-havent-moved-to-other-dns/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Encrypt forms&#8217; passwords before submitting with jquery</title>
		<link>http://diginc.us/code/2010/encrypt-forms-passwords-before-submitting-with-jquery/</link>
		<comments>http://diginc.us/code/2010/encrypt-forms-passwords-before-submitting-with-jquery/#comments</comments>
		<pubDate>Wed, 05 May 2010 19:49:07 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=153</guid>
		<description><![CDATA[If a site&#8217;s login/registration isn&#8217;t encrypted using SSL why would you risk sending a user&#8217;s password in plain text to the form&#8217;s processing script? Because you didn&#8217;t know any better and didn&#8217;t read this how-to, that&#8217;s why. With today&#8217;s average &#8230; <a href="http://diginc.us/code/2010/encrypt-forms-passwords-before-submitting-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If a site&#8217;s login/registration isn&#8217;t encrypted using SSL why would you risk sending a user&#8217;s password in plain text to the form&#8217;s processing script?  Because you didn&#8217;t know any better and didn&#8217;t read this how-to, that&#8217;s why.  With today&#8217;s average computer and connection speed adding a little encryption and downloading small library (in addition to jquery&#8217;s 76k or so) isn&#8217;t a big deal.  Here&#8217;s how I&#8217;m encrypting a password before form submission:</p>
<p><a href="/examples/pre-encrypt-password.php">Browser/Client side password encryption example</a><br />
<a href="/examples/pre-encrypt-password.zip">Download Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/code/2010/encrypt-forms-passwords-before-submitting-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spamato vs SpamBayes [Win7]</title>
		<link>http://diginc.us/microsoft/2009/spamato-vs-spambayes-win7/</link>
		<comments>http://diginc.us/microsoft/2009/spamato-vs-spambayes-win7/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 20:51:54 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Outlook]]></category>
		<category><![CDATA[Spamato]]></category>
		<category><![CDATA[SpamBayes]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=132</guid>
		<description><![CDATA[Which spam prevention product wins: SpamBayes vs Spamato? SpamBayes is the clear winner in my mind. I used Spamato with my outlook 2007 first and recently switched to Spambayes because Spamato simply wouldn&#8217;t work with Windows 7 even after going &#8230; <a href="http://diginc.us/microsoft/2009/spamato-vs-spambayes-win7/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Which spam prevention product wins: <a href="http://spambayes.sourceforge.net/">SpamBayes</a> vs <a href="www.spamato.net">Spamato</a>?  SpamBayes is the clear winner in my mind.</p>
<p>I used Spamato with my outlook 2007 first and recently switched to Spambayes because Spamato simply wouldn&#8217;t work with Windows 7 even after going through an enormous hassle of <a href="http://saranspot.blogspot.com/2009/02/installing-dotnet-framework-11-on.html">hacking Microsoft&#8217;s .NET Framework 1.1 installer</a> to get it to install in Windows 7.</p>
<p>I&#8217;m really glad I switched, SpamBayes has amazing accuracy when trained with your Spam/Ham folders.  It even has a &#8216;Junk Suspects&#8217; folder which has caught all (1 or 2) my ham messages which is mistook for spam.  I don&#8217;t think any Ham has ended up in the Junk folder unless it was an automated mail/newsletter and those quickly stopped going to junk after useing the &#8216;recovering from spam&#8217; toolbar button to improve training.</p>
<p>I used Spamato for more than a year and it works fairly well, I liked it and recommended it to others.  Every time I recommended it to a non technical person I cringed a little bit after remembering the fact that it requires a couple, not so simple to explain over the phone, prerequisites.</p>
<p>The finite accuracy seems better in SpamBayes and the installation is definitely a hell of a lot easier than Spamato.  </p>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/microsoft/2009/spamato-vs-spambayes-win7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using fail2ban to open back door ports in your iptables [Port Knocking]</title>
		<link>http://diginc.us/linux/2009/using-fail2ban-to-open-back-doors-ports-in-your-iptables/</link>
		<comments>http://diginc.us/linux/2009/using-fail2ban-to-open-back-doors-ports-in-your-iptables/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 21:38:26 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[auth2accept]]></category>
		<category><![CDATA[auth2allow]]></category>
		<category><![CDATA[fail2accept]]></category>
		<category><![CDATA[fail2allow]]></category>
		<category><![CDATA[fail2ban]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=108</guid>
		<description><![CDATA[The opposite of fail2ban would probably be called auth2allow (authenticate to allow) or fail2allow &#8211; but that&#8217;s not necessary because fail2ban&#8217;s configs can be customized to do exactly what I&#8217;m talking about. What am I talking about you ask? Basically &#8230; <a href="http://diginc.us/linux/2009/using-fail2ban-to-open-back-doors-ports-in-your-iptables/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The opposite of <a href="http://www.fail2ban.org">fail2ban</a> would probably be called auth2allow (authenticate to allow) or fail2allow &#8211; but that&#8217;s not necessary because fail2ban&#8217;s configs can be customized to do exactly what I&#8217;m talking about.  What am I talking about you ask?  Basically what I&#8217;ve done and am about to explain how to do is setup fail2ban to look for a successful login on a FTP to allow the authenticated IP to get access to another port that isn&#8217;t as secure as FTP so is usually 100% black listed in IPTables.  It&#8217;s just a hack of a security mechanism to allow your self or others into places securely through obscure means.  Like most security it&#8217;s not perfect but it seems pretty solid in my mind.  </p>
<p>If someone can authenticate on the FTP (could even be anonymous ftp, but I&#8217;d recommend using a special username you want to specifically grant access) then fail2ban triggers an ALLOW command for their IP on some port (or all ports), for example SSH (22) or apache https (443) with a private site on it that you want to keep private and totally hidden from the internet at large.  This concept could really apply to anything.  Any command IPTables can run can be triggered through something fail2ban sees in a log file basically, the possibilities are endless.  In my example I&#8217;ll use https, port 443, but in real life I&#8217;m using an obscure port number and the program running on it that is not very secure by default.</p>
<p>So here are my slightly modified configuration files for setting up a custom fail2ban service that does the opposite of what fail2ban typically does.</p>
<p><span id="more-108"></span></p>
<p>In /etc/fail2bain/jail.conf I added:</p>

<div class="wp_codebox"><table><tr id="p10820"><td class="code" id="p108code20"><pre class="bash" style="font-family:monospace;"> <span style="color: #7a0874; font-weight: bold;">&#91;</span>vsftpd2allow443<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
 enabled  = <span style="color: #c20cb9; font-weight: bold;">true</span>
 port     = <span style="color: #000000;">443</span>
 filter   = vsftpd-<span style="color: #000000;">2</span>-https
 banaction = iptables-accept-https
 logpath  = <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>vsftpd.log
 maxretry = <span style="color: #000000;">1</span>
 bantime  = <span style="color: #660033;">-1</span></pre></td></tr></table></div>

<p>filter has to match the name of the corresponding file in the <code>/etc/fail2ban/filter.d</code> folder.  banaction has to match the corresponding file in the <code>/etc/fail2ban/action.d</code> folder.  Max retry is 1 so the person doesn&#8217;t need to successfully login to the FTP more than once to get access to our secret port back door.  Bantime -1 should add the person for ever.  For added security try <code>bantime = 86400</code> for 1 days access (bantime uses seconds).</p>
<p>Next make a copy of a default action for a template:</p>

<div class="wp_codebox"><table><tr id="p10821"><td class="code" id="p108code21"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-vip</span> <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>action.d<span style="color: #000000; font-weight: bold;">/</span>iptables.conf <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>action.d<span style="color: #000000; font-weight: bold;">/</span>iptables-accept-https.conf</pre></td></tr></table></div>

<p>Then modify all the DENYs to ACCEPT and change the port:</p>

<div class="wp_codebox"><table><tr id="p10822"><td class="code" id="p108code22"><pre class="bash" style="font-family:monospace;"> actionban = iptables <span style="color: #660033;">-I</span> fail2ban-<span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">&lt;</span>ip<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-j</span> DROP
 <span style="color: #666666; font-style: italic;"># Becomes</span>
 actionban = iptables <span style="color: #660033;">-I</span> fail2ban-<span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">&lt;</span>ip<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
 actionunban = iptables <span style="color: #660033;">-D</span> fail2ban-<span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">&lt;</span>ip<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-j</span> DROP
 <span style="color: #666666; font-style: italic;"># Becomes</span>
 actionunban = iptables <span style="color: #660033;">-D</span> fail2ban-<span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">&lt;</span>ip<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
 port = <span style="color: #c20cb9; font-weight: bold;">ssh</span>
 <span style="color: #666666; font-style: italic;"># Becomes</span>
 port = <span style="color: #000000;">443</span></pre></td></tr></table></div>

<p>And lastly you need your fail2ban filter that watches vsftpd for successful authenticions of our special user who gets special ports opened up for them.  Since I&#8217;m using vsftpd as my FTP I just copied it&#8217;s current filter and modified it to look for good auths instead of bad auths.</p>

<div class="wp_codebox"><table><tr id="p10823"><td class="code" id="p108code23"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-vip</span> <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>vsftpd.conf <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>vsftpd-<span style="color: #000000;">2</span>-accept-https.conf</pre></td></tr></table></div>

<p>Change &#8216;<code>specialuser</code>&#8216; to whatever FTP user you want to gain special access to your server.</p>

<div class="wp_codebox"><table><tr id="p10824"><td class="code" id="p108code24"><pre class="bash" style="font-family:monospace;"> failregex = vsftpd<span style="color: #7a0874; font-weight: bold;">&#40;</span>?:\<span style="color: #7a0874; font-weight: bold;">&#40;</span>pam_unix\<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>?<span style="color: #7a0874; font-weight: bold;">&#40;</span>?:\<span style="color: #7a0874; font-weight: bold;">&#91;</span>\d+\<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>?:.<span style="color: #000000; font-weight: bold;">*</span> authentication failure; .<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #007800;">rhost</span>=<span style="color: #000000; font-weight: bold;">&lt;</span>HOST<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>?:\s+<span style="color: #007800;">user</span>=\S<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>?\s<span style="color: #000000; font-weight: bold;">*</span>$
     \<span style="color: #7a0874; font-weight: bold;">&#91;</span>.+\<span style="color: #7a0874; font-weight: bold;">&#93;</span> FAIL LOGIN: Client <span style="color: #ff0000;">&quot;&lt;HOST&gt;&quot;</span>\s<span style="color: #000000; font-weight: bold;">*</span>$
 <span style="color: #666666; font-style: italic;"># Becomes</span>
 failregex = vsftpd<span style="color: #7a0874; font-weight: bold;">&#40;</span>?:\<span style="color: #7a0874; font-weight: bold;">&#40;</span>pam_unix\<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>?<span style="color: #7a0874; font-weight: bold;">&#40;</span>?:\<span style="color: #7a0874; font-weight: bold;">&#91;</span>\d+\<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>?:.<span style="color: #000000; font-weight: bold;">*</span> authentication failure; .<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #007800;">rhost</span>=<span style="color: #000000; font-weight: bold;">&lt;</span>HOST<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>?:\s+<span style="color: #007800;">user</span>=\S<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>?\s<span style="color: #000000; font-weight: bold;">*</span>$
     \<span style="color: #7a0874; font-weight: bold;">&#91;</span>specialuser\<span style="color: #7a0874; font-weight: bold;">&#93;</span> OK LOGIN: Client <span style="color: #ff0000;">&quot;&lt;HOST&gt;&quot;</span>\s<span style="color: #000000; font-weight: bold;">*</span>$</pre></td></tr></table></div>

<p>If you&#8217;re not using VFTPd then fail2ban has many other popular linux FTP client&#8217;s setup in the filter.d folder.  You should also look in your log file (<code>ls /var/log/*ftp*</code> should find it) to find out what syntax it uses to denote a successful FTP login because it will most likely be different than what VSFTPd uses.</p>
<p>Now you just need to remember the password for your <code>specialuser</code> and you just FTP to your server with that login from any computer in the world to open your hidden port to access your secret content.  This idea is mostly for personal use and I recommend against trying to have any beginner users use this as a mechanism for accessing content or even using it in a serious This slight modification isn&#8217;t revolutionary or anything and I may not be the first to come up with it but it definitely isn&#8217;t a well search indexed idea so I thought I&#8217;d throw this out there for others.</p>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/linux/2009/using-fail2ban-to-open-back-doors-ports-in-your-iptables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My linux Quake 3 dedicated server setup notes (Ubuntu 9.04 server)</title>
		<link>http://diginc.us/linux/2009/my-linux-quake-3-dedicated-server-setup-notes-ubuntu-9-04-server/</link>
		<comments>http://diginc.us/linux/2009/my-linux-quake-3-dedicated-server-setup-notes-ubuntu-9-04-server/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 16:18:02 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=93</guid>
		<description><![CDATA[Not really a tutorial, mostly notes to my self so I remember how it&#8217;s done down the road. adduser q3ds cd /home/q3ds Find linuxq3apoint-1.32b-3.x86.run, wget or upload to the q3ds user folder chmod +x linuxq3apoint-1.32b-3.x86.run ./linuxq3apoint-1.32b-3.x86.run &#160; # Returns... # &#8230; <a href="http://diginc.us/linux/2009/my-linux-quake-3-dedicated-server-setup-notes-ubuntu-9-04-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Not really a tutorial, mostly notes to my self so I remember how it&#8217;s done down the road.</p>
<p><span id="more-93"></span></p>

<div class="wp_codebox"><table><tr id="p9331"><td class="code" id="p93code31"><pre class="bash" style="font-family:monospace;">adduser q3ds
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>q3ds</pre></td></tr></table></div>

<p>Find <a href="http://www.google.com/search?q=linuxq3apoint-1.32b-3.x86.run">linuxq3apoint-1.32b-3.x86.run</a>, wget or upload to the q3ds user folder</p>

<div class="wp_codebox"><table><tr id="p9332"><td class="code" id="p93code32"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x linuxq3apoint-1.32b-<span style="color: #000000;">3</span>.x86.run
.<span style="color: #000000; font-weight: bold;">/</span>linuxq3apoint-1.32b-<span style="color: #000000;">3</span>.x86.run
&nbsp;
<span style="color: #666666; font-style: italic;"># Returns...</span>
<span style="color: #666666; font-style: italic;"># Verifying archive integrity...tail: cannot open `+6' for reading: No such file or directory</span>
<span style="color: #666666; font-style: italic;"># Error in check sums 579851737 212141158</span>
<span style="color: #666666; font-style: italic;"># This should fix that error: </span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">_POSIX2_VERSION</span>=<span style="color: #000000;">199209</span>
.<span style="color: #000000; font-weight: bold;">/</span>linuxq3apoint-<span style="color: #000000;">1.31</span>.x86.run 
&nbsp;
<span style="color: #666666; font-style: italic;"># Returns...</span>
<span style="color: #666666; font-style: italic;"># Verifying archive integrity...OK</span>
<span style="color: #666666; font-style: italic;"># Uncompressing Quake III Arena Point Release 1.31 ..................................................................</span>
<span style="color: #666666; font-style: italic;"># This installation doesn't support glibc-2.0 on Linux / x86_64</span>
<span style="color: #666666; font-style: italic;"># Please contact Id software technical support at bugs@idsoftware.com</span>
<span style="color: #666666; font-style: italic;"># The program returned an error code (1)</span>
<span style="color: #666666; font-style: italic;"># OK, time for another fix:</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ia32-libs linux32
<span style="color: #666666; font-style: italic;"># ... press Y &lt;enter&gt; to confirm install</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Try again with 32bit emulation</span>
&nbsp;
linux32 .<span style="color: #000000; font-weight: bold;">/</span>linuxq3apoint-<span style="color: #000000;">1.31</span>.x86.run 
&nbsp;
<span style="color: #666666; font-style: italic;"># Go through the install and change the install path to /home/q3ds/quake3/</span></pre></td></tr></table></div>

<p>Copy/FTP baseq3/pak0.pk3 off our CD or backup into your /home/q3ds/quake3/baseq3 folder.</p>
<p>These are my console screens for running q3ded behind the scenes, they&#8217;re setup for my mod of choice &#8211; <a href="http://weaponsfactory.planetquake.gamespy.com/Quake3/">WFA</a> (whose install files are located @ <a href="http://bitblender.net">bitblender.net</a>:</p>
<p>q3start:</p>

<div class="wp_codebox"><table><tr id="p9333"><td class="code" id="p93code33"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting WFA Server&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>q3ds<span style="color: #000000; font-weight: bold;">/</span>quake3
<span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-L</span> <span style="color: #660033;">-A</span> <span style="color: #660033;">-m</span> <span style="color: #660033;">-d</span> <span style="color: #660033;">-S</span> wfa-server .<span style="color: #000000; font-weight: bold;">/</span>q3ded +<span style="color: #000000; font-weight: bold;">set</span> fs_game wfa +<span style="color: #000000; font-weight: bold;">set</span> dedicated  <span style="color: #000000;">2</span> +<span style="color: #000000; font-weight: bold;">set</span> sv_pure <span style="color: #000000;">0</span> +<span style="color: #000000; font-weight: bold;">set</span> gametype <span style="color: #000000;">4</span> +<span style="color: #7a0874; font-weight: bold;">exec</span> wfa-server.cfg</pre></td></tr></table></div>

<p>q3stop:</p>

<div class="wp_codebox"><table><tr id="p9334"><td class="code" id="p93code34"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-dr</span> wfa-server <span style="color: #660033;">-X</span> quit
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Killing off wfa-server...&quot;</span>;</pre></td></tr></table></div>

<p>q3restart:</p>

<div class="wp_codebox"><table><tr id="p9335"><td class="code" id="p93code35"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Restarting WFA Server&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>q3ds<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>q3stop
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>q3ds<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>q3start</pre></td></tr></table></div>

<p>q3console (ctrl+A+D to detach from console):</p>

<div class="wp_codebox"><table><tr id="p9336"><td class="code" id="p93code36"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-x</span> wfa-server</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://diginc.us/linux/2009/my-linux-quake-3-dedicated-server-setup-notes-ubuntu-9-04-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GNUmp3d init.d with PIDs for running multiple instances of GNUmp3d</title>
		<link>http://diginc.us/linux/2009/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/</link>
		<comments>http://diginc.us/linux/2009/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 05:07:15 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[gnump3d]]></category>
		<category><![CDATA[init.d]]></category>
		<category><![CDATA[invoke-rc.d]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=73</guid>
		<description><![CDATA[I made some modifications to my original gnump3d init.d script when I needed more than one instance of GNUmp3d running (for multiple folders completely separated). I still haven&#8217;t quite figured out how to get the tag database to work for &#8230; <a href="http://diginc.us/linux/2009/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I made some modifications to my original gnump3d init.d script when I needed more than one instance of GNUmp3d running (for multiple folders completely separated).  I still haven&#8217;t quite figured out how to get the tag database to work for my second GNUmp3d instance, if anyone can help please leave a comment.  Here&#8217;s the script and some brief instructions:</p>
<p><span id="more-73"></span></p>
<p>/etc/init.d/gnump3d :</p>

<div class="wp_codebox"><table><tr id="p7344"><td class="code" id="p73code44"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">gmconfig</span>=<span style="color: #ff0000;">&quot;/etc/gnump3d/gnump3d.conf&quot;</span>
<span style="color: #007800;">gmport</span>=<span style="color: #ff0000;">&quot;54321&quot;</span>
<span style="color: #007800;">gmpidfile</span>=<span style="color: #ff0000;">&quot;/var/run/gnump3d_<span style="color: #007800;">$gmport</span>.pid&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$gmpidfile</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;GNUmp3d already running on port <span style="color: #007800;">$gmport</span>&quot;</span>
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting GNUmp3d.&quot;</span>
    <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gnump3d <span style="color: #660033;">--background</span> <span style="color: #660033;">-config</span> <span style="color: #007800;">$gmconfig</span> <span style="color: #660033;">--port</span> <span style="color: #007800;">$gmport</span>
    <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
    <span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-ef</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">&quot;grep&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;config <span style="color: #007800;">$gmconfig</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-c10-15</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$gmpidfile</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">;;</span>
stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$gmpidfile</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Shutting down GNUmp3d.&quot;</span>
    <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$gmpidfile</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$gmpidfile</span>
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;GNUmp3d isn't running on port <span style="color: #007800;">$gmport</span> yet&quot;</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">;;</span>
restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #007800;">$0</span> stop
  <span style="color: #007800;">$0</span> start
<span style="color: #000000; font-weight: bold;">;;</span>
status<span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$gmpidfile</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;GNUmp3d running on port <span style="color: #007800;">$gmport</span> with config <span style="color: #007800;">$gmconfig</span> and pid <span style="color: #007800;">$(cat $gmpidfile)</span>&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-ef</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">&quot;grep&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;config <span style="color: #007800;">$gmconfig</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #666666; font-style: italic;">#echo</span>
    <span style="color: #666666; font-style: italic;"># code to display the other instance of gnump3d here...</span>
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;GNUmp3d isn't running yet&quot;</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 {start|stop|restart|status}&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></td></tr></table></div>

<p>To run more than one copy of gnump3d with this simply make a copy of this script and call it something like gnump3d_2.</p>

<div class="wp_codebox"><table><tr id="p7345"><td class="code" id="p73code45"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-vip</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>gnump3d <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>gnump3d_2</pre></td></tr></table></div>

<p>Then change the new init.d script to point to your new config and port (pid file auto updates by port #).</p>

<div class="wp_codebox"><table><tr id="p7346"><td class="code" id="p73code46"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">gmconfig</span>=<span style="color: #ff0000;">&quot;/etc/gnump3d/gnump3d_2.conf&quot;</span>
<span style="color: #007800;">gmport</span>=<span style="color: #ff0000;">&quot;54322&quot;</span></pre></td></tr></table></div>

<p>Make a copy of the stock gnump3d config and modify the necessary lines.</p>

<div class="wp_codebox"><table><tr id="p7347"><td class="code" id="p73code47"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-vip</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>gnump3d<span style="color: #000000; font-weight: bold;">/</span>gnump3d.conf <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>gnump3d<span style="color: #000000; font-weight: bold;">/</span>gnump3d_2.conf</pre></td></tr></table></div>

<p>In my config I modified these lines:</p>

<div class="wp_codebox"><table><tr id="p7348"><td class="code" id="p73code48"><pre class="bash" style="font-family:monospace;">port = <span style="color: #000000;">54322</span>
root = <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>gnump3d_2
user = gnump3d_2
logfile = <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>gnump3d<span style="color: #000000; font-weight: bold;">/</span>access_2.log
errorlog = <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>gnump3d<span style="color: #000000; font-weight: bold;">/</span>error_2.log
now_playing_path = <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>gnump3d_2<span style="color: #000000; font-weight: bold;">/</span>serving
tag_cache = <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>gnump3d_2<span style="color: #000000; font-weight: bold;">/</span>song.tags</pre></td></tr></table></div>

<p>And lastly we&#8217;ll need to make the cache drectories:</p>

<div class="wp_codebox"><table><tr id="p7349"><td class="code" id="p73code49"><pre class="bash" style="font-family:monospace;"><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>gnump3d_2<span style="color: #000000; font-weight: bold;">/</span>
<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>gnump3d_2<span style="color: #000000; font-weight: bold;">/</span>serving
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">777</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>gnump3d_2
<span style="color: #c20cb9; font-weight: bold;">touch</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>gnump3d_2<span style="color: #000000; font-weight: bold;">/</span>song.tags</pre></td></tr></table></div>

<p>And then you&#8217;re set to startup the second gnump3d instance.</p>

<div class="wp_codebox"><table><tr id="p7350"><td class="code" id="p73code50"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>gnump3d_2 start</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://diginc.us/linux/2009/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu SABnzbd+ protected by an apache2 proxy and htpasswd</title>
		<link>http://diginc.us/apache/2009/ubuntu-sabnzbd-protected-by-an-apache2-proxy-and-htpasswd/</link>
		<comments>http://diginc.us/apache/2009/ubuntu-sabnzbd-protected-by-an-apache2-proxy-and-htpasswd/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 00:00:48 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[sabnzbd]]></category>
		<category><![CDATA[usenet]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=35</guid>
		<description><![CDATA[Basic SABnzbd+ Setup &#8211; SAB for short. There are plenty of tutorials out there which cover configuring a normal SAB installation so I won&#8217;t cover that here. What I am going to do is make my SAB available through a &#8230; <a href="http://diginc.us/apache/2009/ubuntu-sabnzbd-protected-by-an-apache2-proxy-and-htpasswd/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Basic SABnzbd+ Setup</strong> &#8211; SAB for short.</p>
<p>There are plenty of tutorials out there which cover configuring a normal SAB installation so I won&#8217;t cover that here.  What I am going to do is make my SAB available through a web accessible passworded page, this can be accomplished with default SAB features by putting a web username/password in the general configuration section.  However I find it annoying to have to enter the password when I&#8217;m on my internal 192.168 home network just to make it protected from the outside, and I don&#8217;t like the way it presents the username/password prompt in a website form rather than an generic apache pop-up.  I&#8217;m sure open accessibility could be fixed in the SABnzbd+ code but I&#8217;m not a pro python hacker yet so I&#8217;ll just stick to what I know.</p>
<p>Basically I want a generic pop-up password that is only for people outside my network so I&#8217;m not bothered with SAB passwords while at home (And I can&#8217;t get <a href="https://nzbdstatus.bountysource.com/">nzbdStatus</a> to work with a pass enabled).  The htpasswd also acts as a bit of camouflage and additional security.  There are some concepts which aren&#8217;t covered here which are required, you need to know how to configure your own SAB servers, Portforwarding or Firewall/iptables.</p>
<p>If you&#8217;re using a router, you&#8217;re going to want to make sure you&#8217;re not port forwarding the default SAB port of 8080 (which would make it wide open) and only are forwarding the apache2 port you setup for the SAB proxy.  If you&#8217;re not on an internal IP subnet and have a static IP assigned directly to the linux machine you&#8217;re doing this on then I expect you have enough knowledge of IPTables to block the SAB port and allow the proxy port.</p>
<p><span id="more-35"></span></p>
<p><strong>SABnzbd Daemon (optional)</strong></p>
<p>Download the latest SABnzbd version from http://www.sabnzbd.org/download/ to your favorite place to install python apps and optionally install a deamon to auto start SAB: <a href="http://artur.hefczyc.net/node/10">http://artur.hefczyc.net/node/10</a>.  Mine is modified to include a restart command:</p>

<div class="wp_codebox"><table><tr id="p3563"><td class="code" id="p35code63"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># Source: http://sabnzbd.wikidot.com/install-as-a-unix-daemon</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting SABnzbd.&quot;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> sabuser <span style="color: #660033;">-H</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>SABnzbd<span style="color: #000000; font-weight: bold;">/</span>SABnzbd.py <span style="color: #660033;">-d</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>sabuser<span style="color: #000000; font-weight: bold;">/</span>.sabnzbd<span style="color: #000000; font-weight: bold;">/</span>sabnzbd.ini
<span style="color: #000000; font-weight: bold;">;;</span>
stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Shutting down SABnzbd.&quot;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-q</span> <span style="color: #660033;">--delete-after</span> <span style="color: #ff0000;">&quot;http://localhost:8080/sabnzbd/api?mode=shutdown&quot;</span>
<span style="color: #000000; font-weight: bold;">;;</span>
restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">$0</span> stop
<span style="color: #007800;">$0</span> start
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 {start|stop|restart}&quot;</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></td></tr></table></div>

<p>At this point I&#8217;ll assume you have a working sabnzbd installation and have tested to confirm it&#8217;s working.</p>

<div class="wp_codebox"><table><tr id="p3564"><td class="code" id="p35code64"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>sabuser<span style="color: #000000; font-weight: bold;">/</span>.sabnzbd<span style="color: #000000; font-weight: bold;">/</span>sabnzbd.ini</pre></td></tr></table></div>

<p>Change</p>

<div class="wp_codebox"><table><tr id="p3565"><td class="code" id="p35code65"><pre class="bash" style="font-family:monospace;">host = localhost</pre></td></tr></table></div>

<p> to</p>

<div class="wp_codebox"><table><tr id="p3566"><td class="code" id="p35code66"><pre class="bash" style="font-family:monospace;">host = 192.168.0.53</pre></td></tr></table></div>

<p> to make it accessible from elsewhere besides the box running SAB.<br />
That&#8217;s all you need to do with SAB other than configure servers and preferences.</p>
<p><strong>Apache Proxy Setup</strong></p>

<div class="wp_codebox"><table><tr id="p3567"><td class="code" id="p35code67"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> apache2
htpasswd <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>SABnzbd<span style="color: #000000; font-weight: bold;">/</span>.htpasswd username <span style="color: #666666; font-style: italic;"># Enter your password when prompted</span>
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_html</pre></td></tr></table></div>

<p>Ubuntu mod_proxy Denies all but default so you&#8217;ll need to make a similar modification to what follows &#8211; see your Apache error files for something like  if your proxy isn&#8217;t working.  You can either change</p>

<div class="wp_codebox"><table><tr id="p3568"><td class="code" id="p35code68"><pre class="bash" style="font-family:monospace;">Deny from all</pre></td></tr></table></div>

<p> to</p>

<div class="wp_codebox"><table><tr id="p3569"><td class="code" id="p35code69"><pre class="bash" style="font-family:monospace;">Allow from all</pre></td></tr></table></div>

<p> if you expect to be using it from any external IP address or individual IPs you&#8217;ll expect needing access (work IP).  In my case 192.168.0.1 port forwards so that&#8217;s the only one I need but I put in my entire internal subnet for testing purposes.</p>

<div class="wp_codebox"><table><tr id="p3570"><td class="code" id="p35code70"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>mods-enabled<span style="color: #000000; font-weight: bold;">/</span>proxy.conf</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p3571"><td class="code" id="p35code71"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">Proxy</span> *&gt;
  <span style="color: #00007f;">AddDefaultCharset</span> <span style="color: #0000ff;">off</span>
  <span style="color: #00007f;">Order</span> <span style="color: #00007f;">deny</span>,<span style="color: #00007f;">allow</span>
  <span style="color: #00007f;">Deny</span> from <span style="color: #0000ff;">all</span>
  <span style="color: #00007f;">Allow</span> from 192.168.0.0/<span style="color: #ff0000;">24</span>
&lt;<span style="color: #000000; font-weight:bold;">Proxy</span>&gt;</pre></td></tr></table></div>

<p>Add something like this to your apache2 vhost config (logs are optional)</p>

<div class="wp_codebox"><table><tr id="p3572"><td class="code" id="p35code72"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>vhosts.conf</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p3573"><td class="code" id="p35code73"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">Listen</span> <span style="color: #ff0000;">8001</span> <span style="color: #adadad; font-style: italic;"># Use whatever port you want, I usually use obscure ports that aren't regularly scanned.</span>
<span style="color: #00007f;">NameVirtualHost</span> 192.168.0.53:<span style="color: #ff0000;">8001</span>  <span style="color: #adadad; font-style: italic;"># Change 192.168.0.53 to whatever your SAB server's IP is (make sure it's static too).</span></pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p3574"><td class="code" id="p35code74"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost 192.168.0.53:<span style="color: #000000;">8001</span><span style="color: #000000; font-weight: bold;">&gt;</span>
ServerName sabuser.dyndns.org <span style="color: #666666; font-style: italic;"># Enter your hostname or &lt;strong&gt;static&lt;/strong&gt; IP address here.  I use dyndns.org since I have a dynamic IP</span>
ProxyPass <span style="color: #000000; font-weight: bold;">/</span>sabnzbd http:<span style="color: #000000; font-weight: bold;">//</span>192.168.0.53:<span style="color: #000000;">8080</span><span style="color: #000000; font-weight: bold;">/</span>sabnzbd<span style="color: #000000; font-weight: bold;">/</span>
ProxyPassReverse <span style="color: #000000; font-weight: bold;">/</span>sabnzbd http:<span style="color: #000000; font-weight: bold;">//</span>192.168.0.53:<span style="color: #000000;">8080</span><span style="color: #000000; font-weight: bold;">/</span>sabnzbd<span style="color: #000000; font-weight: bold;">/</span>
ProxyPreserveHost On
<span style="color: #666666; font-style: italic;"># Password Protect the external proxy only.</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>Location <span style="color: #000000; font-weight: bold;">/</span>sabnzbd<span style="color: #000000; font-weight: bold;">&gt;</span>
AuthUserFile <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>SABnzbd<span style="color: #000000; font-weight: bold;">/</span>.htpasswd
AuthName <span style="color: #ff0000;">&quot;Authenticate Yourself.&quot;</span>
AuthType Basic
Require valid-user
<span style="color: #000000; font-weight: bold;">&lt;/</span>Location<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #666666; font-style: italic;"># Alternate method, requires rewrite mod:</span>
<span style="color: #666666; font-style: italic;">#RewriteEngine   on</span>
<span style="color: #666666; font-style: italic;">#RewriteRule     (.*) http://192.168.0.53:8080/sabnzbd/$1 [P]</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>References</p>
<p># Apache Proxy<br />
<a href="http://snippets.dzone.com/posts/show/1318">http://snippets.dzone.com/posts/show/1318</a><br />
<a href="http://mail-archives.apache.org/mod_mbox/httpd-users/200307.mbox/%3C20030723191854.43885.qmail@web40903.mail.yahoo.com%3E">http://mail-archives.apache.org/mod_mbox/httpd-users/200307.mbox/%3C20030723191854.43885.qmail@web40903.mail.yahoo.com%3E</a><br />
<a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html">http://httpd.apache.org/docs/2.2/mod/mod_proxy.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/apache/2009/ubuntu-sabnzbd-protected-by-an-apache2-proxy-and-htpasswd/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: diginc.us @ 2012-05-19 22:04:59 -->
