【问题标题】:Failed to initialize TLS context无法初始化 TLS 上下文
【发布时间】:2017-11-14 09:54:49
【问题描述】:

我在 linux 服务器上安装了 stunnel 版本 stunnel-5.43.tar.gz。分配证书路径和stunnel.conf 文件后,由于 tlsversion ,我的 stunnel 无法启动。 看看这是我的 stunnel.conf:

[abc] 
client = yes cert = /usr/local/etc/stunnel/cert.pem key = /usr/local/etc/stunnel/key.pem CAfile = /usr/local/etc/stunnel/Cert.pem sslVersion = TLSv1.2 accept = 127.0.0.1:5001 connect = x.x.x.x:port

我在启动 stunnel 时收到此错误:

[root@test stunnel]# stunnel #Certification loaded here  >Loading certificate from file: /usr/local/etc/stunnel/cert.pem >Certificate loaded from file: /usr/local/etc/stunnel/cert.pem >Loading private key from file: /usr/local/etc/stunnel/key.pem >Insecure file permissions on /usr/local/etc/stunnel/key.pem >#Getting here >SSL_CTX_use_PrivateKey_file: B080074: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch >Service [abc]: Failed to initialize TLS context 

服务 [abc]: 初始化 TLS 上下文失败

【问题讨论】:

  • >[root@test stunnel]# stunnel #Certification loaded here >从文件加载证书:/usr/local/etc/stunnel/cert.pem >从文件加载证书:/usr/local/ etc/stunnel/cert.pem >从文件加载私钥:/usr/local/etc/stunnel/key.pem >/usr/local/etc/stunnel/key.pem 上的文件权限不安全 >#Getting here >SSL_CTX_use_PrivateKey_file: B080074:错误:0B080074:x509 证书例程:X509_check_private_key:键值不匹配>服务 [abc]:无法初始化 TLS 上下文
  • 由于 tls 版本,Stunnel 进程未启动
  • 您必须在问题中添加详细信息,而不是在此处粘贴。:)
  • 在分配证书路径和 stunnel.conf 文件后,我在 linux 服务器上安装了 stunnel 版本 stunnel-5.43.tar.gz 我的 stunnel 无法启动,因为 tlsversion 看到这是我的 stunnel.conf [ abc] 客户端 = 是 证书 = /usr/local/etc/stunnel/cert.pem 密钥 = /usr/local/etc/stunnel/key.pem CAfile = /usr/local/etc/stunnel/Cert.pem sslVersion = TLSv1 .2 接受 = 127.0.0.1:5001 连接 = x.x.x.x:port
  • Stack Overflow 是一个编程和开发问题的网站。这个问题似乎离题了,因为它与编程或开发无关。请参阅帮助中心的What topics can I ask about here。也许Super UserUnix & Linux Stack Exchange 会是一个更好的提问地点。

标签: openssl tls1.2 bloomberg fix-protocol stunnel


【解决方案1】:

确保您的私钥文件 (/usr/local/etc/stunnel/key.pem) 的权限设置为 600:

chmod 600 /usr/local/etc/stunnel/key.pem

来自隧道手册:

stunnel.pem 文件包含您的密钥(私有数据)和证书(公共数据)。为了使 stunnel 无需密码即可自动启动,无需密码即可创建密钥。这意味着任何可以读取此文件的人都可能危及您的 SSL 安全性。 此文件必须只能由 root 或运行 stunnel 的用户读取

【讨论】:

    【解决方案2】:

    您也可以使用:https://github.com/square/ghostunnel

    bin/ghostunnel client  --listen localhost:8443 --target fixbeta-rhub.bloomberg.com:8228 --keystore keys/fixbeta-rhub.bloomberg.com.p12     --cacert keys/CACerts.pem   --override-server-name=fixbeta.bloomberg.com
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-10
      • 2014-09-15
      • 1970-01-01
      • 2019-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多