Closed (won't fix)
Project:
Provision
Version:
6.x-2.x-dev
Component:
HTTP Service
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Nov 2011 at 19:11 UTC
Updated:
27 May 2013 at 15:37 UTC
Jump to comment: Most recent file
Comments
Comment #1
blueprint commentedIf I understand the request correctly we should implement:
SetEnvIf, the Request_URI part to ensure that the _SERVER["db_passwd"] part is not exposed to scripts outside the scope of 'index.php'.
for instance:
SetEnvIf Request_URI "index.php$" db_passwd=secret
This is easy to change in provision by modifiying a template method.
I'm working on integrating cgi changes since it's also a problem that the aegir debian builds require mod_php (we use fastcgi....)
Comment #2
blueprint commentedto be explicit (for version 1.6 packages for debian):
in /usr/share/drush/commands/provision/http/apache_ssl/vhost_ssl.tpl.php
the complete file
Tested with aegir 1.6 debs from the aegir project. (hostmaster fine, sites fine).
WARNING: there are probably things which will break here!
Comment #3
blueprint commentedJust realized I TESTED slightly different code:
Comment #4
blueprint commentedAttaching patch
Comment #5
blueprint commentedComment #6
blueprint commentedI had missed a case (well, many actuall, when setenv works as expected) ...
try:
SetEnvIfNoCase Request_URI \/$ HTTP_r_uri=slash
SetEnvIfNoCase Request_URI \/index\.php$ HTTP_r_uri=index
That is, you need two cases for calls to drupal in a certain root. Match \/$ and \/index\.php$
Otherwise you'll miss everything with no query :)
Comment #7
anarcat commentedI don't understand this setup very well, so I am not sure I am in the right position to review this.
I would like to hear more details about how those servers are configured. Is this done through php-fpm? Because if it is, it seems to me the environment from the webserver shouldn't necessarily contaminate the FastCGI processes...
Also, how do we ensure that database credentials *are* passed to the site? If we do not set that environment and cloaking is enabled in settings.php, this will just break sites...
I'd be curious to understand how this is done in Nginx too.
Comment #8
omega8cc commentedNot sure if this still happens in Apache - after all we unset all those variables immediately after reading them:
I have committed cloaked credentials support in Nginx, and when used with PHP-FPM it *doesn't* expose credentials via phpinfo() if the request comes via Drupal (because they are unset already).
It *does* expose credentials when you create whitelisted PHP file, like /update.php and you will put just phpinfo() there, but at least in Nginx configuration we already deny any unknown, non-Drupal PHP files from being executed, so we don't need any extra SetEnvIfNoCase-like tricks in Nginx.
I guess we need similar allow/deny rules in the Apache config to deny arbitrary PHP files from being executed.
Note also that index.php is not the only legitimate Drupal PHP file which should have an access to the db credentials.
Comment #9
anarcat commentedThis is exactly what I wanted to hear, thank you so much!!! :)
As for php5-cgi (aka people running Aegir not under Apache or Nginx: how do you *do* that anyways??): I would say we will simply not fix this until that install process is streamlined and documented, with driver à l'appui.
Cheers!