Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
allow symlinks problem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Sun Jul 25, 2004 9:16 pm    Post subject: allow symlinks problem Reply with quote

router root # cat -n /etc/apache2/conf/commonapache2.conf |grep Symlinks
Code:
  38  Options +FollowSymlinks


router root # head -46 /etc/apache2/conf/commonapache2.conf |grep -v '#'
Code:
User apache
Group apache
ServerAdmin xxxxxxxxxxxxxx
ServerName xxxxxxxxxxxxxxxxxx
<Directory />
 Options -Indexes Multiviews ExecCGI
Options +FollowSymlinks
  AllowOverride None
</Directory>

router root #

ie only got 1 symlink reference in the file
allow symlinks everywhere
disallow .htaccess files

restart apache & request the page

[Sun Jul 25 18:24:16 2004] [notice] Apache configured -- resuming normal operations
[Sun Jul 25 18:26:11 2004] [error] [client 192.168.0.8] Symbolic link not allowed: /var/www/localhost/htdocs/index.php

anyone tell me what ive done wrong ?
Back to top
View user's profile Send private message
Chris W
l33t
l33t


Joined: 25 Jun 2002
Posts: 972
Location: Brisbane, Australia

PostPosted: Mon Jul 26, 2004 4:27 am    Post subject: Reply with quote

The most obvious thing you've done wrong is attempt undo all the careful security measures built into the default commonapache2.conf, such a global deny access policy on files and directories, and then replace them with an inherently uncool thing. The <Directory path> directive applies permissions to a real directory path: in your case the Apache server will happily supply any file requested (i.e. anything under the root directory), including password files and the like. Whether this results in an exploitable weakness is a matter of luck in the remainder of the configuration. You should put this back the way it was:
Code:
### First, we configure the "default" to be a very restrictive set of
### permissions.  Also, for security, we disable indexes globally.
###
### Restricted set of options:
###
<Directory />
  Options -All -Multiviews
  AllowOverride None
  <IfModule mod_access.c>
    Order deny,allow
    Deny from all
  </IfModule>
</Directory>


The bit you are interested in, and seem to have removed or changed, is at around line 770 of commonapache2.conf. The default file also has FollowSymlinks active in the /var/www/localhost/htdoc and sub-directories:
Code:
###
### This should be changed to whatever you set DocumentRoot to.
###
<Directory /var/www/localhost/htdocs>
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
    Options -Indexes FollowSymLinks MultiViews
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
    AllowOverride All
#
# Controls who can get stuff from this server.
#
    <IfModule mod_access.c>
      Order allow,deny
      Allow from all
    </IfModule>
</Directory>

Given that it should follow any symlink in /var/www/localhost/htdocs the problem probably lies with the symlink. It may be pointing to a non-existent file, or it may be pointing to a file that the web server (i.e. user apache) has no permission to see/read. The first option is probably the most likely. On my system you get the error you describe if the symlink points nowhere, and a different one if the file is not readable.
_________________
Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein
Back to top
View user's profile Send private message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Mon Jul 26, 2004 11:41 am    Post subject: Reply with quote

thanks - ive been struggling with this for a while and have made it as simple as I can. once the b***** thing is working i can then tighten up the security/access.
FWIW this stuff is only accessbible from my LAN at the moment.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum