If I set http basic authentication for a site in a pack server I get 500 Internal server error when I open the site.

Apache error.log

[Tue Jun 07 12:31:01.813192 2016] [authn_file:error] [pid 27258] (2)No such file or directory: [client REDACTED] AH01620: Could not open password file: /var/aegir/config/server_REDACTED/apache/passwords.d/example.com

I'm not really familiar with the aegir architecture, but I think this is because this module uses d()->service('http')->sync($path) to sync the password file and Provision_Service_http_pack::sync only syncs to master servers (that's the whole point of pack servers).

I can try to make a patch, but I need some orientation first. My first thought is to check if the server is a pack and explicitly sync to the slave servers in _http_basic_auth_create_file, but I don't think that's ideal.

CommentFileSizeAuthor
#3 password_file_is_not-2744367-3.patch1.35 KBsambonner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpv created an issue. See original summary.

helmo’s picture

A patch for _http_basic_auth_create_file would probably be the quickest workaround like you suggest.

For a proper patch we'd have to split the sync() method into something for config and something for site content ...

... or the sync() method in the Provision_Service_http_pack class could do a check on $path to see if it needs to go to the slaves.

sambonner’s picture

Status: Active » Needs review
FileSize
1.35 KB

Heh, this is the same issue from many years ago which I originally wrote a PR for on Github when it was just a standalone contrib module from computerminds - https://github.com/computerminds/aegir_http_basic/pull/7. Unfortunately I never got round to attempting to getting it merged into the new hosting tasks extra project. Will try to right this wrong 5 years on :P

Helmo, as you suggested I'm just syncing out the config within the _http_basic_auth_create_file() method. I'd be happy to do it elsewhere if there's a better approach but I don't have the context or understanding to make the changes further down the stack at this time. In addition we've been running the attached patch for the last 5 years on a large client's Aegir platform, so I'm pretty confident that it behaves as expected :) Attaching patch against 7.x-3.x-dev.

mpv’s picture

Thank you both! The patch in #3 works great.

helmo’s picture

Status: Needs review » Reviewed & tested by the community

Thanks

helmo’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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