Ubuntu Server 22.04 VM中Viewpoint连接EWS失败问题排查
EWS认证Redmine插件在Ubuntu Server 22.04下连接失败问题解决
问题现象
正在迁移一款通过EWS实现用户认证功能的Redmine插件,该插件此前在运行于Ubuntu Desktop虚拟机的Redmine v4.x环境下测试通过,可正确校验传入凭据的有效性。
插件核心验证代码如下:
require 'viewpoint' include Viewpoint::EWS defaultServer = 'https://company.mail.server/ews/exchange.asmx' defaultEmailDomain = '@domain.com' emailAddress = "username" + defaultEmailDomain password = "password" client = Viewpoint::EWSClient.new(defaultServer, emailAddress, password) result = client begin client.folders rescue result = 'nope' end puts result
上述代码在原有Ubuntu Desktop虚拟机及Windows主机上均可正常运行,但在全新部署的Ubuntu Server 22.04虚拟机中执行时返回nope,连接失败。
使用Python的exchangelib库编写同功能验证脚本,在该Ubuntu Server虚拟机上可正常运行,排除Ubuntu Server网络访问限制导致问题的可能。
问题定位
最初的异常捕获块未指定错误类型、未留存报错信息,调整捕获逻辑指定捕获EwsError类型错误后,得到核心报错:
OpenSSL::Digest::DigestError: Digest initialization failed: initialization error
完整报错栈显示错误触发于rubyntlm gem计算NTLMv2哈希的流程中,调用OpenSSL摘要算法接口时初始化失败。
环境对比信息:可正常运行认证功能的Windows测试机安装的gem版本与故障Ubuntu环境完全一致,仅Ruby版本存在差异:Ubuntu环境为Ruby 3.0.2p107,Windows环境为Ruby 3.1.2p20。
解决方法
修改系统openssl.cnf配置文件,启用OpenSSL的legacy遗留提供者加载,配置生效后插件即可恢复正常运行。
内容的提问来源于stack exchange,提问作者Denes Cselovszki
相关产品推荐
相关产品推荐

