O'Reilly logo

Practical Internet Groupware by Jon Udell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Protecting Scripts in Apache

The techniques we’ve seen so far can protect statically served files and would work for the static version of the docbase viewer we developed in Chapter 7. What about the other viewer that relies on a server-side script to dish out pages dynamically? In that case you’d need to protect the directory from which the script runs or perhaps the script itself. Here’s a CGI URL that produces a record from the ProductAnalysis docbase:

/cgi-bin/Docbase/doc-view.pl?app=ProductAnalysis&
  index=company&doc=1999-03-14-000027.htm

In Apache you can protect that script like this:

<Directory /web/cgi-bin/Docbase>
AuthType Basic
AuthDBMUserFile /secure/subscribers
require user valid-user
</Directory>

Since Apache’s notion of access control is directory oriented, though, this setup restricts access to all the docbases accessible by way of /cgi-bin/Docbase scripts. If you need a more granular approach, you can instead do this:

<Directory /web/cgi-bin/Docbase/ProductAnalysis>

The problem with this method is that you’ll need to locate a copy of doc-view.pl, or at least a wrapper that would refer to a common instance of doc-view.pl, in each docbase’s CGI subdirectory.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required