<?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>Alien Pastures &#187; apache</title>
	<atom:link href="http://alien.slackbook.org/blog/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://alien.slackbook.org/blog</link>
	<description>My thoughts on Slackware, life and everything</description>
	<lastBuildDate>Mon, 06 Feb 2012 00:27:43 +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>Alien Tip: protected apache URL</title>
		<link>http://alien.slackbook.org/blog/alien-tip-protected-apache-url/</link>
		<comments>http://alien.slackbook.org/blog/alien-tip-protected-apache-url/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 13:25:45 +0000</pubDate>
		<dc:creator>alienbob</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[restrictions]]></category>

		<guid isPermaLink="false">http://alien.slackbook.org/blog/?p=109</guid>
		<description><![CDATA[I run a apache webserver at home which is accessible on the local LAN as well as on the internet, In order to make an internal server visible on the Internet, I use port-forwarding on my cable router: incoming http requests are forwarded to my web server. The issue is that I want to shield [...]]]></description>
			<content:encoded><![CDATA[<p>I run a apache webserver at home which is accessible on the local LAN as well as on the internet, In order to make an internal server visible on the Internet, I use port-forwarding on my cable router: incoming http requests are forwarded to my web server.</p>
<p><strong>The issue is that I want to shield some private pages from public access. </strong>Outside the local LAN, I want these pages to be password protected. At the same time, I want these pages to have no restrictions when I access them from another computer on the LAN at home.</p>
<p>This is how I did that:</p>
<p>In apache&#8217;s configuration file (/etc/httpd/httpd.conf) you can limit page access by based on the validity of one of multiple options. In my case:</p>
<ul>
<li> you are allowed direct access based on a hostmask/IP address, or if that condition is not satisfied,</li>
<li>you have to enter a valid username/password.</li>
</ul>
<p>You achieve this by adding  something like this inside a <span style="color: #0000ff;">&lt;Directory&gt;&lt;</span><span style="color: #0000ff;">/Directory</span><span style="color: #0000ff;">&gt; </span>or <span style="color: #0000ff;">&lt;Location&gt;&lt;</span><span style="color: #0000ff;">/Location</span><span style="color: #0000ff;">&gt;</span> block where you define the behaviour of a web page:</p>
<blockquote><p><span style="color: #0000ff;">require valid-user<br />
Allow from .myhome.lan<br />
Satisfy any</span></p></blockquote>
<p>What I assumed here was that your home computers all have hostnames which end on &#8220;<span style="color: #0000ff;">.myhome.lan</span>&#8220;. If the apache webserver receives a page request from one of your computers, you will automatically get access to your protected URL. If your computer hostname does not end on &#8220;<span style="color: #0000ff;">.myhome.lan</span>&#8221; (for instance when you access the webserver from a computer on the internet), the second pre-condition will be checked by the apache webserver. A login form will be presented to you and you will have to enter your credentials. If apache decides that your credentials are that of a &#8220;valid user&#8221; then you will get access to the page.</p>
<p>If your network at home does not use domain names for the computers (the &#8220;<span style="color: #0000ff;">.myhome.lan</span>&#8221; is the domain name used in the above example) then the above line &#8220;<span style="color: #0000ff;">Allow from .myhome.lan</span>&#8221; will not work. Fortunately, you can use (partial) IP address as well, so that the example would become:</p>
<blockquote><p><span style="color: #0000ff;">require valid-user<br />
Allow from 192.168<br />
Satisfy any</span></p></blockquote>
<p>which would give full access to any computer with an IP address in the range <span style="color: #0000ff;">192.168.0.0/16</span> .</p>
<p>For more information about protecting your web pages:</p>
<ul>
<li> See <a href="http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#allow" target="_blank">http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#allow</a> for a full<br />
description of the &#8220;Allow&#8221; syntax.</li>
<li>See <a href="http://httpd.apache.org/docs/2.2/howto/auth.html" target="_blank">http://httpd.apache.org/docs/2.2/howto/auth.html</a> which has examples for ad<br />
ding user authentication to your web pages.</li>
</ul>
<p>More tips will probably follow. I have a lot of these useful snippets for which a whole Wiki page is just too much.</p>
<p>Cheers, Eric</p>
]]></content:encoded>
			<wfw:commentRss>http://alien.slackbook.org/blog/alien-tip-protected-apache-url/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

