LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-18-2003, 01:27 PM   #1
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
securing apache & PHP


I'm currently configuring a webserver based on Apache v2.0.43 and PHP v4.3.0. This server will be used for several customers. Now with a standard setup of PHP it will be possible (if you know that this is a virtual server) to read out the other customers. Let's suppose the directory is


/var/www/customer1


Then customer2 could for instance display the content of /var/www and get all other customers names. To prevent this it would be required to use a specific USER to run a virtualhost. But this is not possible if you don't choose to install PHP as cgi-binary (and then using suexec) or does anybody have a working solution for this ?

I've already restricted the directory to /var/www and the subdirectories already using open_safedir, but as from that point I do not have further ideas currently ...
 
Old 01-18-2003, 01:32 PM   #2
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Original Poster
Rep: Reputation: 46
A short demonstration would be probably something like posted here
 
Old 01-18-2003, 02:16 PM   #3
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Original Poster
Rep: Reputation: 46
After enabling safe_mode the demonstration failed ... (I removed the open_basedir restriction). The trick is to set the base directory for all virtual hosts owned by root ... this prevents the readout ... (if safe_mode is active).

(Be sure to set safe_mod_gid to OFF otherwise users which are in the same group can read the others directories...)

Also set safe_mode_exec_dir to some empty directory to prevent scripting attacks ...



Well to use open_basedir on a virtualhost basis it also secures things ... like described in http://www.php.net/manual/en/security.apache.php ... in detail (with the extension of doc_root for additional security):

Code:
Example:
<VirtualHost www.example.com>
ServerName www.example.com
 DocumentRoot /www-home/example.com
[...]
 <Location />
  php_admin_value doc_root     \ "/www-home/example.com/"
  php_admin_value open_basedir     \ "/www-home/example.com/:/usr/lib/php/"
</Location>
</VirtualHost>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware guide for AMP Apache MySQL & PHP xushi Slackware 35 05-11-2006 11:18 AM
ISS & ASP/.NET or Apache & PHP fuelinjection General 3 12-06-2005 07:41 AM
securing php, apache and mysql javier_ccs Linux - Security 5 10-18-2005 11:08 AM
From RedHat9 to FreeBSD (Apache 2 & Mysql & PHP 4) guardian653 *BSD 5 12-11-2003 05:31 PM
Apache & PHP & RH8 hammerstein02 Linux - Software 3 02-07-2003 04:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration