php - Simplesamlphp 落后于负载均衡器时失败

标签 php https load-balancing saml-2.0 simplesamlphp

我们使用simplesamlphp作为服务提供商。我们已经与许多 Idp 集成。一切正常。

现在我们想要将服务器架构更改为负载均衡器 -> Web 服务器 -> 数据库服务器。当我们将负载均衡器放在网络服务器前面时,问题就出现了。 IDP 收到错误。

负载均衡器终止了https,我认为这就是问题发生的地方。因此,当负载均衡器将请求发送到网络服务器时,它是一个常规的http请求。

当我记录最初发生的事情时,我得到

我将稍微简化 xml 并放置不同的部分

使用负载均衡器

Session: 'idp-name' not valid because we are not authenticated.
Saved state: '_somelongstringofnumbersandletters'
Sending SAML 2 AuthnRequest to '{{their info}}'
Sending message:
    <samlp:AuthnRequest ... AssertionConsumerServiceURL="http://{{our-info}}">
        <saml:Issuer>http://{{our-info}}</saml:Issuer>
        <samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" AllowCreate="true"/>
    </samlp:AuthnRequest>

因此,上面指向负载均衡器webserver之间唯一不同的部分是httphttps > 分别。

不确定是否有办法让 simplesamlphp 仅返回 https。或者它会始终检查请求的当前状态并假设 http

只是为了确保我提供了所有数据。该进程由SP初始化。所以他们只需访问像 https://oursite.com/idp-name 这样的网址。我们始终使用 https

如果我需要澄清一些事情,请告诉我。

更新

我们通过终止负载均衡器上的 HTTPS 请求并允许请求传递到服务器来解决该问题。因此,我们的 SSL 证书直接位于我们的 Web 服务器上,而不是负载均衡器上。

我无法得到有效的解决方案,但这可能只是我自己的错。我们需要一个快速的解决方案,而在负载均衡器上不解密 SSL 是最简单的方法。

最佳答案

詹姆斯!

我相信您正在使用负载均衡器作为反向代理,因此请确保在 phpsimplesaml 的 config/config.php 中设置了正确的变量,尤其要注意 baseurlpath

$config = array(

/**
 * Setup the following parameters to match the directory of your installation.
 * See the user manual for more details.
 *
 * Valid format for baseurlpath is:
 * [(http|https)://(hostname|fqdn)[:port]]/[path/to/simplesaml/]
 * (note that it must end with a '/')
 *
 * The full url format is useful if your simpleSAMLphp setup is hosted behind
 * a reverse proxy. In that case you can specify the external url here.
 *
 * Please note that simpleSAMLphp will then redirect all queries to the
 * external url, no matter where you come from (direct access or via the
 * reverse proxy).
 */
'baseurlpath' => 'https://sso.yourcompanyname.com/simplesaml/',
... 

...

还要确保返回 SP 的回复返回正确的协议(protocol) ( https )

事实上,如果我的假设正确,错误日志将不胜感激

关于php - Simplesamlphp 落后于负载均衡器时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34474957/

相关文章:

amazon-web-services - 使用 HTTPS 的 Elastic Beanstalk 应用程序上的 502 错误网关

sql - 分布式数据库解决方案?

kubernetes - 为什么我们需要一个负载均衡器来使用 ingress 暴露 kubernetes 服务?

Node.js 反向代理/负载均衡器

php - 从代码库中删除无用文件

php - date_default_timezone_set() 函数

apache - 如何为 Apache httpd 指定 "TLSv1.2 protocol or later"

python - Django 相对 url 和 https

php - 如何根据 MediaWiki 中的页面插入不同的样式表?

php - 如何在我的 Xcode 项目中显示和使用 php 文件?