[Zope] IP restriction

Peter Bengtsson mail@peterbe.com
Fri, 3 Aug 2001 14:09:58 +0200


Yes, use the variable REMOTE_ADDR environment variable.

set for example an property to your all-directory to "123.234.345.*"
and for "his" directory you set a property of "789" or something

Then you can just:

requiredIP=string.split(self.all_directoryIP,'*')[0]
if self.REQUEST.REMOTE_ADDR[:len(requiredIP)]==requiredIP:
     print "allow access"

This won't work if you use Apache ProxyPassing (unless some lucky
mastertweakings) since you loose the REMOTE_ADDR variable.


> Hello.
>
> I'm new in this list, and I hope we can help us.
>
> My first question is:
>
> I want that only a group of IP's can acces to a directory and his
> subdirectories.
> Do you now how can I do this restriction?
> I dont`t want that the user login zope, I only want to see his IP and
permit
> or not permit pass it to the directory.
>
> Thanks.
>
>
> Rubén
>
>               )
>             (
>               )
>             (
>               )
>
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )