cgi-bin incompatibility between NCSA and Apache

cgi-bin incompatibility between NCSA and Apache

Post by Alan J. Flavel » Tue, 07 Mar 2000 04:00:00



I've inherited a situation from an NCSA server in which the user
has a subdirectory of ordinary files underneath their cgi-bin
subdirectory.  Their cgi-bin is using ScriptAlias.

Apparently under NCSA this worked OK, it seems that the scriptalias
property was apparently not inherited into the subdirectory.

But when I try to service the same file structure from Apache, it
refuses to access the files in the subdirectory, reporting "file
permissions deny server execution" i.e thinking that it is supposed to
execute them (and their execute permissions are off, but of course
this isn't the real problem).

Although this seems to be poor practice and I wouldn't recommend it
for a new application, it looks as if I should find some way to
support it for this case.  Is there some way I can leave scriptalias
in effect for the cgi-bin directory itself, but turn it off so that
the subdirectory is treated as a normal one?

(Of course I could change the configuration of the cgi-bin directory
itself, so that only *.cgi (or whatever) files are executed.  But this
would be moving quite a long way away from the original.)

Practical suggestions would be welcomed.  :-)

 
 
 

cgi-bin incompatibility between NCSA and Apache

Post by Nick K » Wed, 08 Mar 2000 04:00:00




Quote:

> I've inherited a situation from an NCSA server in which the user
> has a subdirectory of ordinary files underneath their cgi-bin
> subdirectory.  Their cgi-bin is using ScriptAlias.

Interesting.   If it were some-newbie asking, I'd suppose they had an
AllowOverride: none on the cgi-bin in question.  But you know better.

YM you have something like:

$LUSER/cgi-bin
$LUSER/cgi-bin/someprog.cgi
$LUSER/cgi-bin/docs
$LUSER/cgi-bin/docs/some-doc.txt

Did you try rearranging it:

mv $LUSER/cgi-bin/docs $LUSER/cgi-bin-docs

with an AliasMatch in httpd.conf?

--
Nick Kew

We're so advanced here ... our nearest main road is called the A 386

 
 
 

cgi-bin incompatibility between NCSA and Apache

Post by Alan J. Flavel » Wed, 08 Mar 2000 04:00:00



> > I've inherited a situation from an NCSA server in which the user
> > has a subdirectory of ordinary files underneath their cgi-bin
> > subdirectory.  Their cgi-bin is using ScriptAlias.

> Interesting.   If it were some-newbie asking, I'd suppose they had an
> AllowOverride: none on the cgi-bin in question.

I'm probably being dim from having looked too closely at this,
but I don't quite follow your train of thought here, sorry.  There is
actually no .htaccess file in these user subdirectories.  The NCSA
server just seems to have behaved differently in this regard.

Quote:> But you know better.

Thanks for the vote of confidence - I'm certainly wondering.

Quote:> YM you have something like:

> $LUSER/cgi-bin
> $LUSER/cgi-bin/someprog.cgi
> $LUSER/cgi-bin/docs
> $LUSER/cgi-bin/docs/some-doc.txt

Worse than that - the someprog.cgi manipulates (i.e writes and reads)
data files in the $LUSER/cgi-bin/data/  subdirectory.   (Names changed
to protect the...).

Quote:> Did you try rearranging it:

> mv $LUSER/cgi-bin/docs $LUSER/cgi-bin-docs

At the time when I asked the question, I was just trying to
transparently migrate the setup from NCSA to Apache, without imposing
any changes on the user.

I'm thinking I ought to persuade them to change this anyhow.
The design was theirs (he mumbles in sort-of self defence).

 
 
 

cgi-bin incompatibility between NCSA and Apache

Post by Joshua Sliv » Wed, 08 Mar 2000 04:00:00




>> > I've inherited a situation from an NCSA server in which the user
>> > has a subdirectory of ordinary files underneath their cgi-bin
>> > subdirectory.  Their cgi-bin is using ScriptAlias.

One suggestion which, as usual, I have not tested, is to get rid
of the ScriptAlias and try to use an Alias plus a SetHandler
in a LocationMatch or FilesMatch section to make the cgi's execute.
Something like

Alias /cgi-bin/ /path/to/cgi-bin/

<Directory /path/to/cgi-bin/>
Options ExecCGI
</Directory>

<LocationMatch /cgi-bin/[^/]*>
SetHandler cgi-script
</Location>

--
Joshua Slive

http://finance.commerce.ubc.ca/~slive/

 
 
 

cgi-bin incompatibility between NCSA and Apache

Post by Alan J. Flavel » Wed, 08 Mar 2000 04:00:00



Quote:> One suggestion which, as usual, I have not tested, is to get rid
> of the ScriptAlias and [...]
> Alias /cgi-bin/ /path/to/cgi-bin/
> <Directory /path/to/cgi-bin/>
> Options ExecCGI
> </Directory>
> <LocationMatch /cgi-bin/[^/]*>
> SetHandler cgi-script
> </Location>

            ^Match

Yes, I've now set something like that up in a test directory, and it
seems to work, thanks!  I can see now what I need to do for the user.

 
 
 

cgi-bin incompatibility between NCSA and Apache

Post by Thomas Bind » Wed, 08 Mar 2000 04:00:00


Hi!



Quote:> Practical suggestions would be welcomed.  :-)

Mhmm, I just tried the following and it seems to work, though I'm not
sure whether I've understood your problem correctly:

ScriptAlias /cgi-bin/ /opt/apache/cgi-bin/

<Directory "/opt/apache/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/opt/apache/cgi-bin/*">
    SetHandler default-handler
</Directory>

This allows me to access http://localhost/cgi-bin/printenv as a CGI, but
http://localhost/cgi-bin/html/index.html (and the contents of any other
subdirectory of cgi-bin) is served as a normal HTML document.

Ciao

Thomas

--


 
 
 

cgi-bin incompatibility between NCSA and Apache

Post by Alan J. Flavel » Thu, 09 Mar 2000 04:00:00


[normal-ish CGI configuration ... then:]

Quote:> <Directory "/opt/apache/cgi-bin/*">
>     SetHandler default-handler
> </Directory>

Ah yes, default-handler, thanks.

Quote:> This allows me to access http://localhost/cgi-bin/printenv as a CGI, but
> http://localhost/cgi-bin/html/index.html (and the contents of any other
> subdirectory of cgi-bin) is served as a normal HTML document.

Yes, you've understood my question exactly; thanks!
 
 
 

1. /cgi-bin/phf /cgi-bin/test-cgi /cgi-bin/handler

I've been seeing a number of attacks of this sort recently
from various sites in the http logs.  The time correlation
between the logs on various hosts suggests that the attacker
was scanning sequentially upward in IP addresses.  Since all
tcp and udp packets to ports below 1024 except for http,
smtp, and ident are filtered out for most, including the
attacking, sites, I'm not seeing anything else in the logs.

209.61.73.47 - - [04/Jul/1998:07:19:27 -0500] "GET /cgi-bin/phf" 404 -
209.61.73.47 - - [04/Jul/1998:07:19:28 -0500] "GET /cgi-bin/test-cgi" 404 -
209.61.73.47 - - [04/Jul/1998:07:19:28 -0500] "GET /cgi-bin/handler" 404 -

Is this a signature of some known attackware?  If so, what
other attacks accompany these http probes?

--

2. Increasing the number of pty or tty to 512 ?

3. cgi-bin/view-source?cgi-bin/view-source

4. iptables

5. NCSA httpd1.5 no longer sees /cgi-bin!

6. Adaptec AHA-2940 plus Iomega ZIP SCSI

7. NCSA httpd cgi-bin application vulnerability.

8. apache: give /home/mailman/cgi-bin permissions to run cgi-scripts.

9. Cannot execute CGI programs in /cgi-bin with Apache

10. apache: cgi script not in cgi-bin

11. cgi-bin (C bin) hangs under Linux

12. Apache Cgi-bin