<?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; Apache</title>
	<atom:link href="http://diginc.us/category/apache/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>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="p1086"><td class="code" id="p108code6"><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="p1087"><td class="code" id="p108code7"><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="p1088"><td class="code" id="p108code8"><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="p1089"><td class="code" id="p108code9"><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="p10810"><td class="code" id="p108code10"><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>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="p3523"><td class="code" id="p35code23"><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="p3524"><td class="code" id="p35code24"><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="p3525"><td class="code" id="p35code25"><pre class="bash" style="font-family:monospace;">host = localhost</pre></td></tr></table></div>

<p> to</p>

<div class="wp_codebox"><table><tr id="p3526"><td class="code" id="p35code26"><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="p3527"><td class="code" id="p35code27"><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="p3528"><td class="code" id="p35code28"><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="p3529"><td class="code" id="p35code29"><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="p3530"><td class="code" id="p35code30"><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="p3531"><td class="code" id="p35code31"><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="p3532"><td class="code" id="p35code32"><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="p3533"><td class="code" id="p35code33"><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="p3534"><td class="code" id="p35code34"><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:49:06 -->
