[Zope] How do you Restrict ZServer socket connections

Hung Jung Lu hungjunglu@hotmail.com
Sun, 12 Mar 2000 15:18:05 PST


<jo-@totient.demon.co.uk> wrote:
>Fine, But Now I want to make Zserver only accept connections from
>a set of known IP address (ie that where my apache server runs)

If you are using Linux, this job is best done with
the firewall itself (like ipchains.) Otherwise it
is not very secure.

That being said, inside Zope itself, you can put in your
index_html (or equivalent)

<dtml-if "REQUEST.REMOTE_ADDR != '127.0.0.1'">
  <dtml-return "''">
</dtml-if>

Of course, you can return a nasty message, or redirect
the request to some other web addresses by using
<dtml-var "RESPONSE.redirect(...)"> :) If you are using
SiteAccess, you can put a hook at the root folder to
bounce off anyone that you don't like.

The REQUEST variable holds other environment variables
that might be of your interest. You can either use

<dtml-var REQUEST>

to print out the variable content, or simply append
/REQUEST to your URLs when you are browsing a Zope
site:

http://your.site.name/yourfolder/yourpage/REQUEST

Hung Jung

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com