Koozali.org: home of the SME Server

How to modify httpd.conf to allow CGIs in primary/html?

Offline ntblade

  • *
  • 252
  • +0/-0
How to modify httpd.conf to allow CGIs in primary/html?
« on: May 20, 2005, 11:16:48 AM »
Hi,
I've installed Bugzilla in the primary ibay html directory of a 6.0.1 server.  I need to allow execution of CGIs in the html directory, they (the scripts) don't go in the cgi-bin directory in a Bugzilla installation.

I modified httpd.conf from this...

#------------------------------------------------------------
# Primary ibay directories (Primary i-bay)
#------------------------------------------------------------

<Directory /home/e-smith/files/ibays/Primary/html>
    Options Indexes
    Options +Includes
    AllowOverride None
    order deny,allow
    deny from all
    allow from all
</Directory>

To this...

#------------------------------------------------------------
# Primary ibay directories (Primary i-bay)
#------------------------------------------------------------

# Merge this to ibay below
#   <Directory /var/www/html/bugzilla>
#   AddHandler cgi-script .cgi
#   Options +Indexes +ExecCGI
#   DirectoryIndex index.cgi
#       AllowOverride Limit
#   </Directory>

<Directory /home/e-smith/files/ibays/Primary/html>
    AddHandler cgi-script .cgi
    Options Indexes
    Options +Includes +ExecCGI
    DirectoryIndex index.cgi
    AllowOverride Limit
    order deny,allow
    deny from all
    allow from all
</Directory>

Which allows CGIs to run and allows the .htaccess file to be read by bugzilla.

Now my first question is how I should modify the httpd.conf template fragments so that only the primary ibay is affected when the file is expanded?

Does the above configuration look OK / safe?  The server will only be accessed via intranet / VPN.  It WON'T be on the internet.

Many thanks

Norrie

PS
Would this be a worthwile howto to write up?

Offline ntblade

  • *
  • 252
  • +0/-0
How to modify httpd.conf to allow CGIs in primary/html?
« Reply #1 on: May 20, 2005, 02:02:17 PM »
Right, here's my first attempt...

#------------------------------------------------------------
# Information bay directories
#------------------------------------------------------------

<snip>

   my $dynamicContent = $properties{'CgiBin'} || "disabled";
   $OUT .= "\n";
   $OUT .= "#------------------------------------------------------------\n";
   $OUT .= "# $key ibay directories ($properties{'Name'})\n";
   $OUT .= "#------------------------------------------------------------\n";

   $OUT .= "\n";
   
   if ($key eq 'Primary')
   {
       $OUT .= "#------------------------------------------------------------\n";
       $OUT .= "# Primary ibay modified to allow Bugzilla CGIs to run in html\n";
       $OUT .= "# directory. \n";
       $OUT .= "# See /etc/e-smith/templates-custom/etc/httpd/conf/-\n";
       $OUT .= "# httpd.conf/90e-smithAccess40ibays\n";
       $OUT .= "#------------------------------------------------------------\n";
       $OUT .= "\n";
       $OUT .= "<Directory /home/e-smith/files/ibays/$key/html>\n";
       $OUT .= "    AddHandler cgi-script .cgi\n";
       $OUT .= "    Options Indexes\n";
       $OUT .= "    Options +Includes +ExecCGI\n";
       $OUT .= "    DirectoryIndex index.cgi\n";
       $OUT .= "    AllowOverride Limit\n";
       $OUT .= "    order deny,allow\n";
       $OUT .= "    deny from all\n";
       $OUT .= "    allow from all\n";
       $OUT .= "</Directory>\n";   
   }
   else
   {
       $OUT .= "<Directory /home/e-smith/files/ibays/$key/html>\n";
       $OUT .= "    Options Indexes\n";
       if ($dynamicContent eq 'enabled')
       {
      $OUT .= "    Options +Includes\n";
       }
       else
       {
           $OUT .= "    <FilesMatch \"\\.(php|php3|phtml)\$\">\n";
      $OUT .= "        order deny,allow\n";
      $OUT .= "        Deny from all\n";
      $OUT .= "    </FilesMatch>\n";
      $OUT .= "    Options +IncludesNOEXEC\n";
       }
       $OUT .= "    AllowOverride None\n";
       $OUT .= "    order deny,allow\n";
       $OUT .= "    deny from all\n";
       $OUT .= "    allow from $allow\n";
       if ($pass)
       {
      $OUT .= "    AuthName \"$properties{'Name'}\"\n";
      $OUT .= "    AuthType Basic\n";
      $OUT .= "    AuthExternal pwauth\n";
      $OUT .= "    require user $key\n";
      $OUT .= "    Satisfy $satisfy\n";
       }
       $OUT .= "</Directory>\n";

<snipped to end>


This works.  However,  Have I potentially messed up my server?

Are any other of the .../Primary/html directory properties modified by actions in the web interface?

All help / comments much appreciated.

Cheers
Norrie
8o)