Koozali.org: home of the SME Server

Apache Directory Browsing doesn't work in 5.6 ?

Ian Lowe

Apache Directory Browsing doesn't work in 5.6 ?
« on: April 04, 2003, 02:34:15 AM »
I have added extra diskspace in my SME Server, by mounting a couple of drives up in /home/music/mp3al and /home/music/mp3mz

I have (surprise) MP3 files on those disks, and present them as a single ibay "ourmusic" by means of symlinks. This works perfectly well through Samba, and presents a source of entertainment for my wife and I.

I'm trying to enhance the thing a little, so I installed netjuke in the html part of the ourmusic ibay. It loads, it talks to the database, and it can import MP3 files in the root of those drives *however* it is unable to follow the symlinks to the music directories,

After a dig around, I added a new httpd.conf template file, to add the Options FollowSymLinks. I expanded the template and restarted apache. No matter what options I use, Apache refuses to follow a symlink..

And then, I realised that (again, with no regard for what the httpd.conf file says) directory browsing of any kind is disabled.I can get apache to follow a symlink to a file, but not to a directory (it gives a 403 error).

I can only conclude that 5.6's Apache Directory Browsing is broken.

Any ideas/fixes/suggestions?

Ian Lowe

Re: Apache Directory Browsing doesn't work in 5.6 ?
« Reply #1 on: April 04, 2003, 12:03:49 PM »
Strange.
This morning, it's working okay. Highly, highly strange.

Ian Lowe

Re: Apache Directory Browsing doesn't work in 5.6 ?
« Reply #2 on: April 04, 2003, 05:11:07 PM »
And there it goes again..
This is profoundly strange. Directory Browsing is again not working, yet the entries in /etc/httpd/conf/httpd.conf clearly have "Options Indexes" under them.

I installed the PDF Printer from NightSpirit, but am at a loss to see what's changed. In my /var/log/httpd logs, I get a "Directory index forbidden by rule" error.

:|

Dan Brown

Re: Apache Directory Browsing doesn't work in 5.6 ?
« Reply #3 on: April 04, 2003, 05:14:08 PM »
Strange indeed.  I know that in ibays, it's disabled unless "execution of dynamic content" is turned on--I think that's bad design, but it's apparently intentional.  Don't know what this has to do with your situation, though.

Ian Lowe

Re: Apache Directory Browsing doesn't work in 5.6 ?
« Reply #4 on: April 04, 2003, 08:38:22 PM »
Got it. (I think)

If you add a custom template as described in these forums, and replace this line:

   if ($dynamicContent eq 'enabled')
   {
       $OUT .= "    Options +Includes\n";
                }

with this one:

   if ($dynamicContent eq 'enabled')
   {

       $OUT .= "    Options +Includes FollowSymLinks\n";
                }

Then, when the template is expanded, the httpd.conf file ends up containing a double line, like this:


    Options Indexes
    Options +Includes FollowSymLinks
    AllowOverride None
    order deny,allow
    deny from all
    allow from all


And *DOES NOT WORK* In this case, symbolic links are followed, but Directory Browsing doesn't happen.

If I manually edit the httpd.conf file, and add these guys on the same line, like so:


    Options Indexes FollowSymLinks +Includes
    AllowOverride None
    order deny,allow
    deny from all
    allow from all


Then it works perfectly.

Rich Lafferty

Re: Apache Directory Browsing doesn't work in 5.6 ?
« Reply #5 on: April 04, 2003, 09:05:03 PM »
I just replied to Ian's bug report, but I'll followup here in case someone
comes across this searching.

The templating system works as expected, putting the text from the
template fragments into the httpd.conf when you expand it, except that
that's not how Apache's httpd.conf works.

Every Options line *overrides* the previous one unless its arguments
are *all* -option or +option. In the first example, the Options are set
to Indexes, and then are cleared and set to FollowSymLinks and

In the second option, the options are cleared and set to all three.

The right way to go about this is to either:

  - have an empty custom template for the first Options and one with
    three entries for the second, or

  - have the second Options line read "+FollowSymlinks +Includes".

Cheers,
--Rich

Sascha

Re: Apache Directory Browsing doesn't work in 5.6 ?
« Reply #6 on: July 15, 2003, 02:04:06 AM »
Sorry Rich, I have no idea what you are saying here. I managed to get it to work fine by editing the following file:

/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess40ibays

Find the section with the following script:

if ($dynamicContent eq 'enabled')
        {
            $OUT .= "    Options +Includes\n";
        }
else

Now change it to:

if ($dynamicContent eq 'enabled')
        {
            $OUT .= "    Options +Includes\n";
            $OUT .= "    Options FollowSymlinks\n";
        }
else

I also had to change the permissions on the directory in server-manager.
Eventually I used admin-write everyone-read which is equivalent to doing a chown on the entire html directory in the ibay.

This appears to be non-standard since you are not making a custom template
but are tampering with core templates. I apologise for the messiness, but it certainly works, and survives ibay additions and other templated activity.