<?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 &#187; proxy</title>
	<atom:link href="http://diginc.us/tag/proxy/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.2.1</generator>
		<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="p3513"><td class="code" id="p35code13"><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="p3514"><td class="code" id="p35code14"><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="p3515"><td class="code" id="p35code15"><pre class="bash" style="font-family:monospace;">host = localhost</pre></td></tr></table></div>

<p> to</p>

<div class="wp_codebox"><table><tr id="p3516"><td class="code" id="p35code16"><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="p3517"><td class="code" id="p35code17"><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="p3518"><td class="code" id="p35code18"><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="p3519"><td class="code" id="p35code19"><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="p3520"><td class="code" id="p35code20"><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="p3521"><td class="code" id="p35code21"><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="p3522"><td class="code" id="p35code22"><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="p3523"><td class="code" id="p35code23"><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="p3524"><td class="code" id="p35code24"><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-02-06 00:38:23 -->
