Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multi hosts (vhosts) and Doc
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
CarlUman
Apprentice
Apprentice


Joined: 07 Jul 2004
Posts: 158
Location: SE Iowa

PostPosted: Sat Feb 05, 2005 12:46 am    Post subject: Multi hosts (vhosts) and Doc Reply with quote

Have a few security questions on apache and php with multiple domains.
I currently have in apache2.conf and commonapache2.conf
Code:

DocumentRoot /www


My vhosts.conf is similar to this
Code:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/example1.com/htdocs
ServerName www.example1.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/example2.org/htdocs
ServerName www.example2.org
</VirtualHost>


What did I open myself up to by using DocumentRoot /www in the first two config files? Or did the full path for the virtual hosts close up any holes?

Next question on PHP is how can I have multiple open_basedir = so I can get one for each virual host/domain? The php.ini file talks about a per-directory or per-virualhost web server configuration file. Does this mean that I can setup some config file for each virualhost? If so can I get any details?

Thanks in advance for help
Carl

I still have SSL, PostgreSQL, Courier, and ftp to go 8O
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Sat Feb 05, 2005 2:05 am    Post subject: Reply with quote

It means, simply put, that any request that ends up at your IP for which there is no virtual host will get directed to the base documentroot - probably not what you want.

You can circumvent this in two ways:

1. set your base document root to an unused directory somewhere, say /www/baseroot, possibly only providing a simple page that tells people there is nohing there... or
2. you can set up a _default_ virtualhost; this will receive all requests for nonexistent virtualhosts. See the apache docs at httpd.apache.org for how.

This does include somebody requesting your IP address, so it is rather important that you set this up properly.

As you probably already surmised, the way you have this set up currently means that anybody requesting your IP directly has access to all virtualhosts.

As for php virtualhosts with different php.ini files - you can of course reset the php config for every virtualhost; almost any global directive is valid inside a virtualhost block.

I'm personally not that sure using php's documentroot is of much use; it tends to be sufficiently locked down when you use apache's directory permissions.
But if you want maximum security - go for it.
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
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