Updated: Comment #1

Problem/Motivation

Core updated the htaccess templates: https://drupal.org/SA-CORE-2013-003

However aegir does not use those, we wrap that config in the vhost.
As an added problem core now warns via hook_requirements about missing htaccess content.

Proposed resolution

Work has already started before the SA came out in https://security.drupal.org/node/82028

  1. Update our template
  2. Overwrite the standard htaccess files, just to stop the hook_requirements warning.
  3. Run a verify task on all sites to update the config.

Remaining tasks

  • Overwriting the htaccess can cause file permission warnings. ( is the unlink added in [#1] enough?)
  • Needs testing

Comments

helmo’s picture

Title: Aegir needs a new release to match SA-CORE-2013-002 » Aegir needs a new release to match SA-CORE-2013-003
Issue summary: View changes
helmo’s picture

Issue summary: View changes
StatusFileSize
new4.89 KB

The suggested template was expanded in https://security.drupal.org/node/81938#comment-54833 which still needed to be added to the aegir patch.
Here's the update.

I've also added unlink statements in _provision_drupal_ensure_htaccess_update to prevent the chmod warnings.....

helmo’s picture

Status: Active » Needs review
StatusFileSize
new6.83 KB
new669 bytes

I've updated the code some more to mimic the code from core's hook_requirements().

We now check the htaccess contents before overwriting and explicitly sync it to slave servers.

The hosting patch has been updated to match the hook_update_n number.

helmo’s picture

StatusFileSize
new6.86 KB

The provision code needed a bit more cleanup.

anarcat’s picture

Why do we actually need to hack the files/.htaccess file? It's not actually used or deployed by Aegir in the first place, is it?

helmo’s picture

Yes it feels silly. But the hook_requirements added to core will show an error on the admin status page until the file is updated.

omega8cc’s picture

Yeah, core should be smarter than that. It again ignores also the fact than Nginx doesn't use .htaccess, like in Aegir in general, so we have hacked that stupid core like this:

  // Test the web server identity.
  if (isset($_SERVER['SERVER_SOFTWARE']) && preg_match("/Nginx/i", $_SERVER['SERVER_SOFTWARE'])) {
    // Skip this on BOA and Nginx since .htaccess is never used in Nginx.
    $is_nginx = TRUE;
  }
  elseif (!isset($_SERVER['SERVER_SOFTWARE'])) {
    // Skip this in Aegir backend where SERVER_SOFTWARE is not set, since .htaccess is never used in Nginx.
    $is_nginx = TRUE;
  }
  else {
    $is_nginx = FALSE;
  }

  // Test the contents of the .htaccess files.
  if ($phase == 'runtime' && !$is_nginx) {

They should really improve this and simply skip this warning if there is non-Apache server discovered, at least. I'm going to submit a patch for core, I think.

anarcat’s picture

Yeah, good idea. Better than trying every webserver out there, core should actually make an AJAX request to see if the files directory is accessible directly, instead of second-guessing...

Please do refer to the core issue when/if you create it!

omega8cc’s picture

Turns out there was already such issue in the core queue, so I have submitted patches for D6, D7 and D8 there: #1559116: Make core aware of Nginx and PHP-FPM to avoid confusing alerts

Of course it still doesn't help when Apache is used, but with .htaccess support disabled, like it is in Aegir by default. Should be a separate issue in core, I guess.

Yep, running real test (like backup_migrate does) instead of just web server identity checks (like: what if Nginx is masked as Apache to satisfy Drupal core assumptions related to upload progress support?) would be much better in this case.

anarcat’s picture

Status: Needs review » Fixed

patches applied.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.