事象
SAML認証が急に400エラーが発生する様になった。
400 Bad Request Your browser sent a request that this server colud not understand.
証明書の期限切れを疑ったが、どちら(※1)もOKであった。
※1 以下2つのどちらかの期限切れを当初疑っていた
※2 便宜上Apache HTTP ServerをApacheと以後も記載
SAMLのレスポンスを確認したところ、以下の様に問題なかった。
そのため、Idp側までは正しく認証が行えていると判断し調査を進めた。
(中略) <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
原因
サーバーの時刻がずれていただけであった。。。(※3)
該当サーバはApache + mod_auth_mellonにてSAML認証を実現している。
Apacheのログを確認すると、以下の様なログが出力されていた。
auth_mellon:error NotBefore in Condition was in the future
当エラーログに関しては、mod_auth_mellonのマニュアルに言及があった。
mod_auth_mellon User Guide
10.9. Time Sync
SAML, like many authentication protocols (e.g. Kerberos), relies on timestamps to validate messages. If you see one of these errors in the httpd logs:[auth_mellon:error] [pid xxx] [client xxx] NotBefore in Condition was in the future.
[auth_mellon:error] [pid xxx] [client xxx] NotOnOrAfter in Condition was in the past.
※3 約8分ほどずれていた