Hyperledger fabri c сталкивается с трудностями при настройке промежуточного центра сертификации - PullRequest
0 голосов
/ 28 мая 2020

Я пытаюсь создать промежуточный ЦС для своего проекта, у меня есть один root ЦС и один промежуточный ЦС с файлом конфигурации промежуточного ЦС, как показано ниже. У меня возникла проблема с созданием сертификатов keypairs / MSP и tls для промежуточного центра сертификации, и я не могу передать файл конфигурации промежуточному центру сертификации. Шаги, которые я выполнил

  1. Запуск контейнера Root CA с администратором начальной загрузки.

  2. Зарегистрируйте администратора, который генерирует MSP для администратора CA для org1

fabric-ca-client enroll -u https://admin:adminpw@localhost:7054 --caname ca-org1 --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem
Зарегистрируйте промежуточный CA в root CA, используя команду ниже
fabric-ca-client register --caname ca-org1 --id.name ica --id.attrs '"hf.Registrar.Roles=user,peer",hf.Revoker=true,hf.IntermediateCA=true' --id.secret icapw --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem

Запустите контейнер промежуточного ЦС, как показано ниже, с помощью приведенного ниже файла конфигурации.

Зарегистрируйте промежуточный ЦС

fabric-ca-client enroll -u https://icaadmin:icaadminpw@localhost:6054 --caname ica-org1 --tls.certfiles ${PWD}/organizations/fabric-ca/icaOrg1/tls-cert.pem

Root CA

version: "2"

networks:
  test:

services:
  ca_org1:
    image: hyperledger/fabric-ca:$IMAGE_TAG
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca-org1
      - FABRIC_CA_SERVER_TLS_ENABLED=true
      - FABRIC_CA_SERVER_PORT=7054
    ports:
      - "7054:7054"
    command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
    volumes:
      - ../organizations/fabric-ca/org1:/etc/hyperledger/fabric-ca-server
    container_name: ca_org1
    networks:
      - test

Промежуточный CA

version: "2"

networks:
  test:

services:
  ica-org1:
    image: hyperledger/fabric-ca
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ica-org1
      - FABRIC_CA_SERVER_TLS_ENABLED=true
      - FABRIC_LOGGING_SPEC=debug
      - FABRIC_CA_SERVER_PORT=6054
    ports:
      - "6054:6054"
    command: sh -c 'fabric-ca-server start  -b icaadmin:icaadminpw -u -d http://ica:icapw@ca-org1:7054'
    volumes:
      - ../organizations/fabric-ca/icaOrg1:/etc/hyperledger/fabric-ca-server
    container_name: ica-org1
    networks:
     - test

ICA Fabri c Файл конфигурации



# Version of config file
version: 1.2.0

# Server's listening port (default: 7054)
port: 7054

# Enables debug logging (default: false)
debug: false

# Size limit of an acceptable CRL in bytes (default: 512000)
crlsizelimit: 512000

tls:
  # Enable TLS (default: false)
  enabled: true
  # TLS for the server's listening port
  certfile:
  keyfile:
  clientauth:
    type: noclientcert
    certfiles:

ca:
  # Name of this CA
  name: ica.org1.example.com
  # Key file (is only used to import a private key into BCCSP)
  keyfile:
  # Certificate file (default: ca-cert.pem)
  certfile:
  # Chain file
  chainfile:

crl:
  # Specifies expiration for the generated CRL. The number of hours
  # specified by this property is added to the UTC time, the resulting time
  # is used to set the 'Next Update' date of the CRL.
  expiry: 24h


registry:
  # Maximum number of times a password/secret can be reused for enrollment
  # (default: -1, which means there is no limit)
  maxenrollments: -1

  # Contains identity information which is used when LDAP is disabled
  identities:
    - name: icaadmin
      pass: icaadminpw
      type: client
      affiliation: ""
      attrs:
        hf.Registrar.Roles: "client,peer,user,member"
        hf.Registrar.DelegateRoles: "client,peer,user,member"
        hf.Revoker: true
        hf.IntermediateCA: true
        hf.GenCRL: true
        hf.Registrar.Attributes: "*"
        hf.AffiliationMgr: true


db:
  type: sqlite3
  datasource: fabric-ca-server.db
  tls:
    enabled: false
    certfiles:
    client:
      certfile:
      keyfile:

ldap:
  # Enables or disables the LDAP client (default: false)
  # If this is set to true, the "registry" section is ignored.
  enabled: false
  # The URL of the LDAP server
  url: ldap://<adminDN>:<adminPassword>@<host>:<port>/<base>
  # TLS configuration for the client connection to the LDAP server
  tls:
    certfiles:
    client:
      certfile:
      keyfile:
  # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes
  attribute:

    names: ["uid", "member"]
    converters:
      - name:
        value:
    maps:
      groups:
        - name:
          value:

affiliations:
  org1:
    - department1
    - department2

signing:
  default:
    usage:
      - digital signature
    expiry: 8760h
  profiles:
    ca:
      usage:
        - cert sign
        - crl sign
      expiry: 43800h
      caconstraint:
        isca: true
        maxpathlen: 0
    tls:
      usage:
        - signing
        - key encipherment
        - server auth
        - client auth
        - key agreement
      expiry: 8760h

csr:
  cn: ica.org1.example.com
  names:
    - C: US
      ST: "North Carolina"
      L: "Durham"
      O: org1.example.com
      OU:
  hosts:
    - localhost
    - org1.example.com
  ca:
    expiry: 131400h
    pathlength: 1

#############################################################################
# BCCSP (BlockChain Crypto Service Provider) section is used to select which
# crypto library implementation to use
#############################################################################
bccsp:
  default: SW
  sw:
    hash: SHA2
    security: 256
    filekeystore:
      # The directory used for the software file-based keystore
      keystore: msp/keystore


cacount:
cafiles:

intermediate:
  parentserver:
    url: https://ca-org1:7054
    caname: ca.org1.example.com

  enrollment:
    hosts: localhost
    profile:
    label:

  tls:
    certfiles:
    client:
      certfile:
      keyfile:

1 Ответ

0 голосов
/ 28 мая 2020

Поскольку вы настроили свои центры сертификации как TLS включен, сертификат root TLS должен использоваться промежуточным центром сертификации. Проверьте соответствующий раздел вашего промежуточного файла CA.

Значение атрибута certfiles /tmp/root-ca-cert.pem тот же файл, что и root файл CA: /tmp/hyperledger/fabric-ca/crypto/ca-cert.pem

intermediate:   
  parentserver:
    url: https://admin:admin@root.ca.example.com:7054
    caname: root.ca.example.com

  enrollment:
    hosts:
      - ca1.example.com
    profile: ca
    label:

  tls:
    certfiles:
      - /tmp/root-ca-cert.pem
    client:
      certfile:
      keyfile:
...