"Received an assertion that is valid in the future. Check clock synchronization on IdP and SP"

"Received an assertion that is valid in the future. Check clock synchronization on IdP and SP"

我在我的应用程序中使用 https://simplesamlphp.org/。大多数时候都很好,没有问题。其他时候我得到这个:

SimpleSAML_Error_Error: UNHANDLEDEXCEPTION
Backtrace:
0 ssoclient/www/module.php:180 (N/A)
Caused by: SimpleSAML_Error_Exception: Received an assertion that is valid in the future. Check clock synchronization on IdP and SP. 
Backtrace:
3 ssoclient/modules/saml/lib/Message.php:565 (sspmod_saml_Message::processAssertion)
2 ssoclient/modules/saml/lib/Message.php:523 (sspmod_saml_Message::processResponse)
1 ssoclient/modules/saml/www/sp/saml2-acs.php:75 (require)
0 ssoclient/www/module.php:135 (N/A)

为什么会发生这种情况,我该如何解决?我需要更改我的系统时间吗? (我在 Debian 上)。

对我来说这似乎是一个时间问题,可能是没有正确同步。

有一个工具(也是一个守护程序)可以为您监控时间,ntp,因此您可以始终保持同步。安装它并配置守护进程,我想这可以解决你的问题。

"problem" 已知 - 请参阅 here - 归结为服务提供商和身份提供商之间的错误时钟同步。

可能,它们现在处于 60 秒的时间限制附近,因此 "every now and then" 它们超出了同步边界。

您可以通过以下方式补救:

  • (最佳)通过 ntpd 将两个 系统同步到相同的已知时基。
  • 将两个系统之一的时钟从属到另一个。

还有更多的创意可能,例如:

这两个"solutions"容易出现错误和"time skipping"问题(即时钟不是轻轻地从WRONG_TIME漂移到CORRECT_TIME,直接设置为"correct" 值)。这可能还有 other nasty effects 取决于其他 conditions/software.

最后你可以修改 modules/saml/lib/Message.php 并增加时间增量,即使这是 "papering over the problem",假设有一些过程 保持 两个系统最多 60" 不同步(有 一些创造性的时间设置方案,不是基于 ntpd,可以这样做)。