You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Amazon Linux 2023中使用mongosh遭遇OpenSSL配置错误求助

解决mongosh在Amazon Linux 2023上的OpenSSL配置错误

问题详情

使用mongosh时触发OpenSSL配置错误,具体错误信息:

mongosh: OpenSSL configuration error:
00B927B69E7F0000:error:030000A9:digital envelope routines:alg_module_init:unknown option:../deps/openssl/openssl/crypto/evp/evp_cnf.c:61:name=rh-allow-sha1-signatures, value=yes

环境:Amazon Linux 2023,OpenSSL 3.0.8,曾尝试设置OPENSSL_VERSION环境变量但无效。

解决方案

方法1:修改系统OpenSSL配置文件

  1. 定位系统OpenSSL配置文件,执行命令:

    find /etc -name openssl.cnf
    

    通常路径为/etc/pki/tls/openssl.cnf或/etc/ssl/openssl.cnf。

  2. 编辑配置文件(以/etc/pki/tls/openssl.cnf为例):

    sudo vi /etc/pki/tls/openssl.cnf
    
  3. 搜索并注释掉包含rh-allow-sha1-signatures的行,修改后该行变为:

    # rh-allow-sha1-signatures = yes
    
  4. 保存退出配置文件,重新启动mongosh验证。

方法2:临时绕过系统配置(无需修改文件)

启动mongosh时指定空的OpenSSL配置文件:

OPENSSL_CONF=/dev/null mongosh

如果需要永久生效,可将环境变量添加到shell配置文件:

  1. 编辑~/.bashrc或~/.zshrc:
    vi ~/.bashrc
    
  2. 添加以下内容:
    export OPENSSL_CONF=/dev/null
    
  3. 使配置生效:
    source ~/.bashrc
    

原因说明

rh-allow-sha1-signatures是Red Hat系旧版OpenSSL的专属配置选项,OpenSSL 3.0.x已移除该选项。Amazon Linux 2023的系统OpenSSL配置文件中保留了该选项,导致mongosh调用OpenSSL初始化时触发错误。

内容的提问来源于stack exchange,提问作者changembidar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 00:22:08