<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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/"
> <channel><title>Comments on: Lighttpd restrict or deny access by IP address</title> <atom:link href="http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: dr_agon</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-169053</link> <dc:creator>dr_agon</dc:creator> <pubDate>Wed, 23 Feb 2011 19:59:53 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-169053</guid> <description>correction to my previous post:
$HTTP[&quot;remoteip&quot;] != “200.19.1.5&#124;210.45.2.7″ {
in incorrect, of course.
You can match only one IP using == or != operator, like this:
$HTTP[&quot;remoteip&quot;] != “200.19.1.5″ {</description> <content:encoded><![CDATA[<p>correction to my previous post:</p><p>$HTTP["remoteip"] != “200.19.1.5|210.45.2.7″ {<br
/> in incorrect, of course.<br
/> You can match only one IP using == or != operator, like this:<br
/> $HTTP["remoteip"] != “200.19.1.5″ {</p> ]]></content:encoded> </item> <item><title>By: dr_agon</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-168779</link> <dc:creator>dr_agon</dc:creator> <pubDate>Wed, 16 Feb 2011 02:57:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-168779</guid> <description>Nice info, thanks.
Note, that you must be careful with comparison operators.
If you want to deny access from everywhere except given IPs like in the example:
$HTTP[&quot;remoteip&quot;] !~ &quot;200.19.1.5&#124;210.45.2.7&quot; {
the IPs like 200.19.1.5x (i.e. 200.19.1.51, .52. and so on) FAILS the condition and are allowed access.
!~ and =~ are substring operators. You must either use them with ^ and $, or just use != and ==.
$HTTP[&quot;remoteip&quot;] != &quot;200.19.1.5&#124;210.45.2.7&quot; {
will do exact IP matching.</description> <content:encoded><![CDATA[<p>Nice info, thanks.</p><p>Note, that you must be careful with comparison operators.<br
/> If you want to deny access from everywhere except given IPs like in the example:</p><p>$HTTP["remoteip"] !~ &#8220;200.19.1.5|210.45.2.7&#8243; {</p><p>the IPs like 200.19.1.5x (i.e. 200.19.1.51, .52. and so on) FAILS the condition and are allowed access.<br
/> !~ and =~ are substring operators. You must either use them with ^ and $, or just use != and ==.</p><p>$HTTP["remoteip"] != &#8220;200.19.1.5|210.45.2.7&#8243; {<br
/> will do exact IP matching.</p> ]]></content:encoded> </item> <item><title>By: Dan</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-150420</link> <dc:creator>Dan</dc:creator> <pubDate>Sun, 30 Aug 2009 13:50:27 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-150420</guid> <description>What about denying access to subdomains? How is this done as what I have tried doesn&#039;t work. If I have http://subdomain.example.com and I only wish IP 12.345.678.23 to access it how would this be done. The following doesn&#039;t work:
&lt;code&gt;
$HTTP[&quot;remoteip&quot;] != &quot;111.111.111.111&quot; {  #example ip
$HTTP[&quot;url&quot;] =~ &quot;^subdoman.example.com&quot; {
url.access-deny = ( &quot;&quot; )
}
}
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>What about denying access to subdomains? How is this done as what I have tried doesn&#8217;t work. If I have <a
href="http://subdomain.example.com" rel="nofollow">http://subdomain.example.com</a> and I only wish IP 12.345.678.23 to access it how would this be done. The following doesn&#8217;t work:</p><p><code><br
/> $HTTP["remoteip"] != "111.111.111.111" {  #example ip<br
/> $HTTP["url"] =~ "^subdoman.example.com" {<br
/> url.access-deny = ( "" )<br
/> }<br
/> }<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: André</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-146779</link> <dc:creator>André</dc:creator> <pubDate>Mon, 19 Jan 2009 08:21:01 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-146779</guid> <description>Shougun:
Did you even look at the first example?</description> <content:encoded><![CDATA[<p>Shougun:<br
/> Did you even look at the first example?</p> ]]></content:encoded> </item> <item><title>By: Shougun</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-145143</link> <dc:creator>Shougun</dc:creator> <pubDate>Tue, 30 Sep 2008 10:01:10 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-145143</guid> <description>How would you allow on one IP address to view the site, but deny the rest?</description> <content:encoded><![CDATA[<p>How would you allow on one IP address to view the site, but deny the rest?</p> ]]></content:encoded> </item> <item><title>By: Dude</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-143654</link> <dc:creator>Dude</dc:creator> <pubDate>Fri, 02 May 2008 10:08:07 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-143654</guid> <description>When using a regular expression match, I seem to have had success by simply leaving out the octet I wanted to use as a wild card.
instead of &quot;/24&quot;: $HTTP[&quot;remoteip&quot;] =~ “127.0.0.1&#124;10.0.0″
instead of &quot;/16&quot;: $HTTP[&quot;remoteip&quot;] =~ “127.0.0.1&#124;10.0″
It&#039;s been more than a year since the last reply, but hey, a search led me here.</description> <content:encoded><![CDATA[<p>When using a regular expression match, I seem to have had success by simply leaving out the octet I wanted to use as a wild card.</p><p>instead of &#8220;/24&#8243;: $HTTP["remoteip"] =~ “127.0.0.1|10.0.0″<br
/> instead of &#8220;/16&#8243;: $HTTP["remoteip"] =~ “127.0.0.1|10.0″</p><p>It&#8217;s been more than a year since the last reply, but hey, a search led me here.</p> ]]></content:encoded> </item> <item><title>By: xmlspy</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-79406</link> <dc:creator>xmlspy</dc:creator> <pubDate>Mon, 26 Feb 2007 02:25:09 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-79406</guid> <description>reply nixcraft
thanks  :)
follow
----------------------
$HTTP[&quot;remoteip&quot;] !~ &quot;222.33.0.0/16&#124;61.236.0.0/16&#124;61.236.32.0/20&#124;61.237.11.0/24&#124;61.232.162.0/24&#124;61.235.240.0/24&#124;221.200.0.0/16&#124;211.98.81.0/24&#124;220.201.62.93&quot; {
url.access-deny = (&quot;&quot;)
}
----------------------
why 222.33.36.58 can&#039;t access wesite ?</description> <content:encoded><![CDATA[<p>reply nixcraft</p><p>thanks  :)</p><p>follow</p><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br
/> $HTTP["remoteip"] !~ &#8220;222.33.0.0/16|61.236.0.0/16|61.236.32.0/20|61.237.11.0/24|61.232.162.0/24|61.235.240.0/24|221.200.0.0/16|211.98.81.0/24|220.201.62.93&#8243; {<br
/> url.access-deny = (&#8220;&#8221;)<br
/> }<br
/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p><p>why 222.33.36.58 can&#8217;t access wesite ?</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-73908</link> <dc:creator>nixcraft</dc:creator> <pubDate>Thu, 15 Feb 2007 04:57:17 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-73908</guid> <description>xmlspy,
Noop, it is not possible to specify range using --. However, you can specify network such as 10.0.0.0/8 network or 70.6.2..5/29. For example:
&lt;pre&gt;
$HTTP[&quot;remoteip&quot;] != &quot;10.0.0.0/8&quot; {
url.access-deny = ( &quot;&quot; )
}
}
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>xmlspy,</p><p>Noop, it is not possible to specify range using &#8211;. However, you can specify network such as 10.0.0.0/8 network or 70.6.2..5/29. For example:</p><pre>
  $HTTP["remoteip"] != "10.0.0.0/8" {
   url.access-deny = ( "" )
  }
}
</pre>]]></content:encoded> </item> <item><title>By: xmlspy</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-72863</link> <dc:creator>xmlspy</dc:creator> <pubDate>Tue, 13 Feb 2007 08:03:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-72863</guid> <description>how to block multi IPs use mod_access in lighttpd?
eg:
From 202.133.122.0 To 202.133.122.255
From 202.222.222.0----202.222.222.255</description> <content:encoded><![CDATA[<p>how to block multi IPs use mod_access in lighttpd?<br
/> eg:<br
/> From 202.133.122.0 To 202.133.122.255<br
/> From 202.222.222.0&#8212;-202.222.222.255</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-41764</link> <dc:creator>nixcraft</dc:creator> <pubDate>Sat, 16 Dec 2006 00:09:35 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-41764</guid> <description>I don&#039;t think so you can get HTTP_X_FORWARDED_FOR in conditional tags. However you can try something as follows:.
&lt;code&gt;$HTTP[&quot;url&quot;] =~ &quot;^/path/to/rss/&quot; {
$HTTP[&quot;remoteip&quot;] != &quot;your-shared-server-ip&quot; {
url.access-deny = ( &quot;&quot; )
}
}&lt;/code&gt;
Or just paste your current config (removing your actual domain and IP for security purpose) and exact requirements (output) you want. Then may be I can help you out.
Another possibility is - If you just need to give access to localhost lighttpd from Apache, configure iptables to drop all access.</description> <content:encoded><![CDATA[<p>I don&#8217;t think so you can get HTTP_X_FORWARDED_FOR in conditional tags. However you can try something as follows:.</p><p><code>$HTTP["url"] =~ "^/path/to/rss/" {<br
/> $HTTP["remoteip"] != "your-shared-server-ip" {<br
/> url.access-deny = ( "" )<br
/> }<br
/> }</code></p><p>Or just paste your current config (removing your actual domain and IP for security purpose) and exact requirements (output) you want. Then may be I can help you out.</p><p>Another possibility is &#8211; If you just need to give access to localhost lighttpd from Apache, configure iptables to drop all access.</p> ]]></content:encoded> </item> <item><title>By: Bryan</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-41752</link> <dc:creator>Bryan</dc:creator> <pubDate>Fri, 15 Dec 2006 23:48:20 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-41752</guid> <description>Hello,
Thanks for the information.  I tried several variations without success.
I spoke with my hosting provider.  He explained that the remote ips will be 127.0.0.1 because of the Apache 2 proxy.
Is there a way to use the Apache HTTP_X_FORWARDED_FOR in the conditional instead of remoteip?
The access seems to use that to record ips. This article talks about it a little.  http://forum.lighttpd.net/topic/1372#3626
Thanks again for your help.  I know this isn&#039;t a standard question but there are probably a lot people in similiar Apache 2/Lighttpd setups.
Thanks,
Bryan</description> <content:encoded><![CDATA[<p>Hello,</p><p>Thanks for the information.  I tried several variations without success.</p><p>I spoke with my hosting provider.  He explained that the remote ips will be 127.0.0.1 because of the Apache 2 proxy.</p><p>Is there a way to use the Apache HTTP_X_FORWARDED_FOR in the conditional instead of remoteip?</p><p>The access seems to use that to record ips. This article talks about it a little. <a
href="http://forum.lighttpd.net/topic/1372#3626" rel="nofollow">http://forum.lighttpd.net/topic/1372#3626</a></p><p>Thanks again for your help.  I know this isn&#8217;t a standard question but there are probably a lot people in similiar Apache 2/Lighttpd setups.</p><p>Thanks,</p><p>Bryan</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-41649</link> <dc:creator>nixcraft</dc:creator> <pubDate>Fri, 15 Dec 2006 19:21:32 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-41649</guid> <description>Hello Bryan,
127.0.0.1 is local loopback IP address. This ip address is not routable so you cannot use this IP for restriction i.e. any traffic that a server program sends on the loopback network is addressed to the same server.
To solve your problem use IP address. For example
IF user agent is not foo and if it is not our server IP address do something or
deny access
&lt;code&gt;
$HTTP[&quot;useragent&quot;] !~ &quot;foo&quot; {
$HTTP[&quot;remoteip&quot; ] != &quot;SERVER-IP&quot; {
do-something
}
}
&lt;/code&gt;
You can restrict RSS usage using URL match also.</description> <content:encoded><![CDATA[<p>Hello Bryan,</p><p>127.0.0.1 is local loopback IP address. This ip address is not routable so you cannot use this IP for restriction i.e. any traffic that a server program sends on the loopback network is addressed to the same server.</p><p>To solve your problem use IP address. For example</p><p>IF user agent is not foo and if it is not our server IP address do something or<br
/> deny access<br
/> <code><br
/> $HTTP["useragent"] !~ "foo" {<br
/> $HTTP["remoteip" ] != "SERVER-IP" {<br
/> do-something<br
/> }<br
/> }<br
/> </code></p><p>You can restrict RSS usage using URL match also.</p> ]]></content:encoded> </item> <item><title>By: Bryan</title><link>http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-41641</link> <dc:creator>Bryan</dc:creator> <pubDate>Fri, 15 Dec 2006 19:04:35 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/lighttpd-restrict-or-deny-access-by-ip-address.html#comment-41641</guid> <description>Great article! I have a question relating to restricting access to a local server.
I have two applications(Radiant &amp; Mephisto) on the same shared server.  I want to be able to restrict access to RSS feeds generated by Mephisto to the other application (Radiant).
I reasoned that this could be accomplished using either the servers IP address or localhost.  When I tried 127.0.0.1, it did not restrict anyone.
Am I on the right track with my logic for this type of mod_access module?  Alternatively, is it possible to restrict by domain?
Thanks,
Bryan</description> <content:encoded><![CDATA[<p>Great article! I have a question relating to restricting access to a local server.</p><p>I have two applications(Radiant &amp; Mephisto) on the same shared server.  I want to be able to restrict access to RSS feeds generated by Mephisto to the other application (Radiant).</p><p>I reasoned that this could be accomplished using either the servers IP address or localhost.  When I tried 127.0.0.1, it did not restrict anyone.</p><p>Am I on the right track with my logic for this type of mod_access module?  Alternatively, is it possible to restrict by domain?</p><p>Thanks,</p><p>Bryan</p> ]]></content:encoded> </item> </channel> </rss>
