Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3255: On Acquia Cloud, acquia_config.php should better handle multisite #3492

Merged
merged 1 commit into from
Mar 28, 2019

Conversation

anavarre
Copy link
Contributor

Fixes #3255

Changes proposed

  • Place the multisite-friendly code right where it belongs, under elseif (getenv('AH_SITE_ENVIRONMENT'))

Steps to replicate the issue

  1. It's not easy to replicate the issue. In multisite envs, there are instances where port 443 will be missing from the constructed URL and give a permission denied without any easy way to get to the bottom of the issue. When this happens you need to know about and leverage the SAML Chrome Panel extension to find out port 443 isn't being passed, thus causing the issue.

Previous behavior (before applying PR)

Port 443 could be missing from the constructed URL.

Expected behavior (after applying PR)

Port 443 is always being passed in the constructed URL.

Additional details

Please review carefully before merging. There might be a need to simply duplicate the baseurlpath config override in and out of the AH_SITE_ENVIRONMENT if statement to account for non-Acquia hosted users.

@anavarre anavarre force-pushed the improve-multisite-saml branch from 6c886b7 to 21b3b85 Compare March 22, 2019 16:43
Copy link
Contributor

@danepowell danepowell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lcatlett or @shanefjordan can you please review? Would you consider this best practice for multisites using SAML?

* to customize the default Acquia configuration.
*/
$config['baseurlpath'] = $protocol . $_SERVER['HTTP_HOST'] . $port . '/simplesaml/';
// Set ACE and ACSF sites based on hosting database and site name.
$config['certdir'] = "/mnt/www/html/{$_ENV['AH_SITE_GROUP']}.{$_ENV['AH_SITE_ENVIRONMENT']}/simplesamlphp/cert/";
$config['metadatadir'] = "/mnt/www/html/{$_ENV['AH_SITE_GROUP']}.{$_ENV['AH_SITE_ENVIRONMENT']}/simplesamlphp/metadata";
$config['baseurlpath'] = 'simplesaml/';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be removed or it will clobber what you've defined above, right?

Copy link
Contributor Author

@anavarre anavarre Mar 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what you mean. I've just moved around the $config['baseurlpath'] = $protocol . $_SERVER['HTTP_HOST'] . $port . '/simplesaml/'; line which fixed the missing port 443 in the URL for a multisite we have.

I'm not saying this is best practice or the right fix for BLT, but it's what worked for us. It was really not obvious to understand it had to be within the elseif (getenv('AH_SITE_ENVIRONMENT')) block thus why putting it here - assuming it's where it should belong by default - looked best to prevent others from running into the issue in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm talking about this line, three lines below the code that you inserted: $config['baseurlpath'] = 'simplesaml/';

That will clobber the value of baseurlpath that you just assigned.

@lcatlett
Copy link
Contributor

Port 443 should only be explicitly required in this config when deliberately manipulating server variables for HTTPS and SERVER_PORT when SSL is terminated at the ELB/balancer - this should already be done in BLT https://github.com/acquia/blt/blob/10.x/settings/simplesamlphp.settings.php#L15-L17 so it seems that something else is off with this config.

I think it is more likely that host forwarding is misconfigured in the BLT config which is causing issues on both multisite and single site implementations, it may just be more obvious on multisite since the uri of an individual multisite is usually different than the absolute url of the saml SP. This should likely be tested/validated in the BLT Travis build, as it currently only tests that the saml config files were copied to the correct place rather than if the saml settings being used in BLT actually work... @danepowell do you agree?

* Overide $config['baseurlpath'] = "https://{yourdomain}/simplesaml/"
* to customize the default Acquia configuration.
*/
$config['baseurlpath'] = $protocol . $_SERVER['HTTP_HOST'] . $port . '/simplesaml/';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting here that $protocol and $port are not defined unless the code block above is uncommented. This was also true of the code prior to this PR.

@danepowell
Copy link
Contributor

As far as I can tell this will have no functional change because $config['baseurlpath'] gets overwritten to be /simplesaml regardless. So if people find that this is somehow more helpful I guess I'm fine with that.

@danepowell danepowell merged commit 37ebff2 into acquia:10.x Mar 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants