【问题标题】:TLS handshake failed with error remote error: tls: bad certificate server=OrdererTLS 握手失败并出现错误远程错误:tls: bad certificate server=Orderer
【发布时间】:2019-04-23 01:34:05
【问题描述】:

我正在尝试在虚拟机上手动设置超级账本结构。我已经生成了所有工件并配置了orderer.yamlcore.yaml。我在端口127.0.0.1:7050 上运行排序程序。当我尝试使用 peer cli channel create 命令创建频道时,我在对等终端上收到 context deadline exceeded 消息。

./bin/peer channel create -o 127.0.0.1:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

错误:无法创建交付客户端:订购者客户端无法连接到 127.0.0.1:7050:无法创建新连接:超出上下文期限

在订购者终端上,我收到以下错误:

2019-04-23 09:22:03.707 EDT [core.comm] ServerHandshake -> ERRO 01b TLS 握手失败,出现错误远程错误:tls: bad certificate server=Orderer remoteaddress=127.0.0.1:38618

2019-04-23 09:22:04.699 EDT [core.comm] ServerHandshake -> ERRO 01c TLS 握手失败,出现错误远程错误:tls: bad certificate server=Orderer remoteaddress=127.0.0.1:38620

2019-04-23 09:22:06.187 EDT [core.comm] ServerHandshake -> ERRO 01d TLS 握手失败,出现错误远程错误:tls: bad certificate server=Orderer remoteaddress=127.0.0.1:38622

我已经完成了几次配置,我不确定我是否遗漏了什么。以下是我的orderer.yaml

General:
  LedgerType: file
  ListenAddress: 127.0.0.1
  ListenPort: 7050

  TLS:
    Enabled: true
    PrivateKey: /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key
    Certificate: /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
    RootCAs:
      - /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt
    ClientAuthRequired: true

  Keepalive:
    ServerMinInterval: 60s
    ServerInterval: 7200s
    ServerTimeout: 20s

  GenesisMethod: file

  GenesisProfile: OneOrgOrdererGenesis

  GenesisFile: channel-artifacts/genesis.block

  LocalMSPDIR: /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp

  LocalMSPID: OrdererMSP

  Authentication:
    TimeWindow: 15m

FileLedger:
  Location: /var/hyperledger/production/orderer
  Prefix: hyperledger-fabric-ordererledger

【问题讨论】:

    标签: hyperledger-fabric


    【解决方案1】:

    问题是订购者使用的 TLS 服务器证书没有匹配“127.0.0.1”的 SAN。在使用 cryptogen 生成工件时,您可以使用自定义 crypto-config.yaml 将“localhost”和/或“127.0.0.1”添加到您的 TLS 证书:

    # ---------------------------------------------------------------------------
    # "OrdererOrgs" - Definition of organizations managing orderer nodes
    # ---------------------------------------------------------------------------
    OrdererOrgs:
      # ---------------------------------------------------------------------------
      # Orderer
      # ---------------------------------------------------------------------------
      - Name: Orderer
        Domain: example.com
        EnableNodeOUs: false
    
        # ---------------------------------------------------------------------------
        # "Specs" - See PeerOrgs below for complete description
        # ---------------------------------------------------------------------------
        Specs:
          - Hostname: orderer
            SANS:
              - "localhost"
              - "127.0.0.1"
    
    # ---------------------------------------------------------------------------
    # "PeerOrgs" - Definition of organizations managing peer nodes
    # ---------------------------------------------------------------------------
    PeerOrgs:
      # ---------------------------------------------------------------------------
      # Org1
      # ---------------------------------------------------------------------------
      - Name: org1
        Domain: org1.example.com
        EnableNodeOUs: true
        Template:
          Count: 2
          SANS:
             - "localhost"
             - "127.0.0.1"
        Users:
          Count: 1
    
      - Name: org2
        Domain: org2.example.com
        EnableNodeOUs: false
        Template:
          Count: 2
          SANS:
             - "localhost"
             - "127.0.0.1"
        Users:
          Count: 1
    

    【讨论】:

    • 太棒了 - 很高兴听到它
    • 即使根据答案更改了配置,我仍然面临同样的错误
    • @GariSingh 我在订购者中收到相同的错误日志...我正在使用 fabric-ca 生成证书。网络对于非 TLS 网络运行良好。你能帮忙吗?
    • 最好创建一个新帖子,详细说明您的设置和错误
    【解决方案2】:

    我也遇到了同样的问题,就我而言,问题是我对本地目录文件进行了一些更改,显然这些更改在将这些文件挂载回 docker 容器时没有成功反映。为我解决问题的是

    docker volume rm $(docker volume ls)

    我再次重新启动网络,并没有看到更多的证书错误。值得一试。

    【讨论】:

      【解决方案3】:

      当orderer和orderer之间出现TLS握手失败的问题时,很可能是生成TLS文件时配置参数有错误。

      如果你是通过fabric-ca注册TLS的,那么你需要检查两个ord​​erer的TLS文件中的CSR属性是否相同。您可以使用以下命令“openssl x509 -in certificate.crt -text -noout”。

      以下需要检查orderer注册的--cer.names、-m等参数是否重复或不正确。

      在TLS文件内容一致且指定HostName的情况下,握手失败的情况很少见

      【讨论】:

        猜你喜欢
        • 2020-07-03
        • 2021-05-20
        • 1970-01-01
        • 2021-06-06
        • 1970-01-01
        • 1970-01-01
        • 2021-11-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多