2016-05-12 95 views
3

三天来,我一直在拉我的头发,试图围绕Okta & SAML包扎我的头。“SignatureError:无法验证签名” - Okta,pySAML2

在我的本地机器(OSX小牛队),我能够成功请按下列步骤操作:http://developer.okta.com/docs/guides/pysaml2

工作的事情。

但是将所有内容移动到我们的生产服务器(这是一个CentOS盒子)运行几乎相同的代码时,我遇到了这个“SignatureError:无法验证签名”错误。

Traceback (most recent call last): auth_response = saml_client.parse_authn_request_response(SAMLResponse, entity.BINDING_HTTP_POST) File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/client_base.py\", line 599, in parse_authn_request_response binding, **kwargs)

response = response.loads(xmlstr, False, origxml=origxml) File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/response.py\", line 510, in loads self._loads(xmldata, decode, origxml)

File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/response.py\", line 335, in _loads **args) File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/sigver.py\", line 1756, in correctly_signed_response class_name(response), origdoc)

File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/sigver.py\", line 1571, in _check_signature raise SignatureError(\"Failed to verify signature\") SignatureError: Failed to verify signature

我已经在互联网上寻找解决这个错误的方法。我是SAML和Okta的新手。

我的假设是,这与xmlsec1在我们的生产机器上的行为不同有关。但版本是相同的。有很多依赖关系,所以我不确定问题可能在哪里。

有没有人遇到这个错误?有关我可能会尝试的任何想法?

回答

0

处理xmlsec1会非常令人沮丧!

,我建议做的主要事情是enabling debugging in PySAML2,和/或setting the PYSAML2_KEEP_XMLSEC_TMP environment variable,和/或manually enable this code path in sigver.py - 一般的想法是让一看xmlsec1命令PySAML2呼吁,并已PySAML2周围留下的临时文件,这样你可以自己测试命令。

我记得,过去遇到的大多数问题都涉及到PySAML2找不到xmlsec1二进制文件。 The get_xmlsec_binary() function in sigver.py负责找到xmlsec1二进制文件。我建议你看看get_xmlsec_binary()中的代码,并确保它在你系统的正确位置。

2

我知道这是有点晚了,但万一别人运行到这一点:

pysaml2使用python内置的日志,我定义了一个saml2.sigver处理,这给了很多提供了大量的日志记录的信息。在那些日志中,我发现这个:

Error: unable to load xmlsec-openssl library. Make sure that you have 
this it installed, check shared libraries path (LD_LIBRARY_PATH) 
envornment variable or use "--crypto" option to specify different 
crypto engine. 

原来我需要安装xmlsec1-openssl。 希望这可以帮助未来的人。