티스토리 뷰

반응형

해당 글은 Hyperledger Fabric 페이지의 게시글을 번역 및 정리한 자료입니다.

원본 사이트 : http://hyperledger-fabric-ca.readthedocs.io/en/latest/

 Fabric CA User’s Guide(Fabric CA 사용자 안내서)

Hyperledger 패브릭 CA는 Hyperledger 패브릭의 CA (Certificate Authority)입니다.

이것은 아래와 같은 기능을 제공합니다 :

  • ID 등록 또는 LDAP에 사용자 레지스트리로 연결
  • 등록 인증서 발급 (ECERT)
  • Hyperledger Fabric 블록 체인에서 트랜잭션 할 때 익명 성 및 링크 해제 기능을 제공하는 트랜잭션 인증서 (TCert) 발급
  • 인증서 갱신 및 취소

Hyperledger 패브릭 CA는이 문서의 뒷부분에서 설명하는 서버 및 클라이언트 구성 요소로 구성됩니다.

Hyperledger Fabric CA에 참여하고 싶은 개발자는 Fabric CA 저장소에서 자세한 내용을 확인하십시오.


Table of Contents(목차)

  1. Overview(개요)
  2. Getting Started(시작하기)
    1. Prerequisites(선결요건)
    2. Install(설치)
    3. Explore the Fabric CA CLI(패브릭 CA CLI 살펴보기)
  3. File Formats(파일 형식)
    1. Fabric CA server’s configuration file format(패브릭 CA 서버의 구성 파일 형식)
    2. Fabric CA client’s configuration file format(패브릭 CA 클라이언트의 구성 파일 형식)
  4. Configuration Settings Precedence(구성 설정 우선 순위)
  5. Fabric CA Server(패브릭 CA 서버)
    1. Initializing the server(서버 초기화)
    2. Starting the server(서버 시작)
    3. Configuring the database(데이터베이스 구성)
    4. Configuring LDAP(LDAP 구성)
    5. Setting up a cluster(클러스터 설정)
    6. Setting up multiple CAs(여러 CA 설정)
    7. Enrolling an intermediate CA(중간 CA 설정)
  6. Fabric CA Client(패브릭 CA 클라이언트)
    1. Enrolling the bootstrap identity(부트 스트랩 ID 등록)
    2. Registering a new identity(새 ID 등록)
    3. Enrolling a peer identity(피어 신원 등록)
    4. Reenrolling an identity(신원 재등록)
    5. Revoking a certificate or identity(인증서 또는 ID 해지)
    6. Enabling TLS(TLS 활성화)
    7. Contact specific CA instance(특정 CA 인스턴스에 문의)
  7. Appendix(부록)

Overview(개요)

아래 다이어그램은 Hyperledger Fabric CA 서버가 전체 Hyperledger 패브릭 아키텍처에 어떻게 적용되는지 보여줍니다.

Hyperledger Fabric CA 서버와 상호 작용하는 방법에는 Hyperledger Fabric CA 클라이언트를 사용하는 방법과 Fabric SDK를 사용하는 두 가지 방법이 있습니다. Hyperledger 패브릭 CA 서버에 대한 모든 통신은 REST API를 통해 이루어집니다. 이러한 REST API에 대한 자세한 내용은 fabric-ca / swagger / swagger-fabric-ca.json을 참조하십시오.

Hyperledger 패브릭 CA 클라이언트 또는 SDK는 Hyperledger 패브릭 CA 서버의 클러스터에있는 서버에 연결할 수 있습니다. 이것은 다이어그램의 오른쪽 상단에 설명되어 있습니다. 클라이언트는 HA 프록시 엔드 포인트로 라우팅하여 트래픽을 fabric-ca-server 클러스터 구성원 중 하나에 로드 밸런싱합니다.

클러스터의 모든 Hyperledger 패브릭 CA 서버는 ID 및 인증서를 추적하기 위해 동일한 데이터베이스를 공유합니다. LDAP가 구성된 경우 ID 정보는 데이터베이스가 아닌 LDAP에 보관됩니다.

서버에는 여러 CA가 포함될 수 있습니다. 각 CA는 루트 CA 또는 중간 CA 중 하나입니다. 각 중간 CA에는 루트 CA 또는 다른 중간 CA 인 상위 CA가 있습니다.


Getting Started(시작하기)

Prerequisites(선결요건)

  • Go언어 1.7.x 설치
  • GOPATH 환경 변수 설정
  • libtool 및 libtdhl-dev 패키지가 설치됩니다.

다음은 우분투에 libtool 디펜던시를 설치합니다 :

sudo apt install libtool libltdl-dev

다음은 MacOSX에서 libtool 디펜던시를 설치합니다 :

brew install libtool

노트 - Homebrew를 통해 libtool을 설치 한 경우 MacOSX에서 libtldl-dev가 필요하지 않습니다.

libtool에 대한 자세한 내용은 https://www.gnu.org/software/libtool을 참조하십시오.

libltdl-dev에 대한 자세한 내용은 https://www.gnu.org/software/libtool/manual/html_node/Using-libltdl.html을 참조하십시오.


Install(설치)

다음은 fabric-ca-server 및 fabric-ca-client 명령을 모두 설치합니다.

go get -u github.com/hyperledger/fabric-ca/cmd/...
#로컬 테스트#
go get github.com/hyperledger/fabric-ca/cmd/fabric-ca-server

위의 명령이 정상적으로 진행되었으면 $GOPATH/bin 에 fabric-ca-server 실행파일이 생성됩니다.

위의 명령이 정상적으로 진행되었으면 $GOPATH/bin 에 fabric-ca-server 실행파일이 생성됩니다.

실행명령을 통해 fabric ca를 실행하기 전에 다음의 명령어들을 통해서 fabric ca server의 설정파일들이 생성될 위치를 지정합니다.

#로컬 테스트#
mkdir $HOME/fabric-ca
export FABRIC_CA_SERVER_HOME=$HOME/fabric-ca


Start Server Natively

다음은 기본 설정으로 fabric-ca-server를 시작합니다.

fabric-ca-server start -b admin:adminpw
#로컬 테스트#
#다음으로 fabric-ca-server를 실행합니다. 실행을 할 때 주의할 점은 관리자의 아이디/패스워드 정보를 명령어의 파라미터로 입력합니다.
fabric-ca-server -b hyper:hyper
#위의 명령을 실행하면 앞서 설정한 $FABRIC_CA_SERVER_HOME/server 디렉토리에 “fabric-ca-server-config.yaml” 파일이 생성됩니다.

-b 옵션은 부트 스트랩 관리자의 등록 ID와 암호를 제공합니다. LDAP가 "ldap.enabled"설정으로 활성화되지 않은 경우이 작업이 필요합니다.

fabric-ca-server-config.yaml이라는 기본 구성 파일은 사용자 정의 할 수있는 로컬 디렉토리에 작성됩니다.

유저 정보를 Mysql에 저장하기 위해서 설정파일을 열어서 Datasource 설정을 합니다.

datasource: :@tcp(:)/?parseTime=true


Start Server via Docker

다음과 같이 도커 작성을 통해 서버를 빌드하고 시작할 수 있습니다.

cd $GOPATH/src/github.com/hyperledger/fabric-ca
make docker
cd docker/server
docker-compose up -d

hyperledger / fabric-ca 도커 이미지에는 fabric-ca-server와 fabric-ca-client가 모두 포함되어 있습니다.

노트 - 경고 : 일부 플랫폼에서는 기본 라이브러리 (libc)의 버그로 인해 fabric-ca-server가 패닉 상태에있는 것으로 알려져 있습니다. 한 가지 알려진 경우는 fabric-ca-server가 TLS를 사용하여 PostgreSQL 데이터베이스로 구성된 경우이지만 다른 경우도있을 수 있습니다. 해결 방법은 다음과 같이 "make docker"명령을 실행하기 전에 FABRIC_CA_DYNAMIC_LINK 환경 변수를 true 값으로 설정할 수 있습니다. 이로 인해 실행 파일이 정적으로 링크되는 것이 아니라 동적으로 링크되어 원시 라이브러리 코드의 버그를 방지합니다. 이 문제에 대한 완벽한 정보는 JIRA FAB-2919에서 찾을 수 있습니다.

cd $GOPATH/src/github.com/hyperledger/fabric-ca
FABRIC_CA_DYNAMIC_LINK=true make docker
cd docker/server
docker-compose up -d


Explore the Fabric CA CLI(패브릭 CA CLI 살펴보기)

이 섹션에서는 편의상 Fabric CA 서버 및 클라이언트에 대한 사용법 메시지를 제공합니다. 추가 사용 정보는 다음 절에서 제공됩니다.

다음은 패브릭 CA 서버 사용 메시지를 보여줍니다.

 fabric-ca-server --help
  Hyperledger Fabric Certificate Authority Server

  Usage:
    fabric-ca-server [command]

  Available Commands:
    init        Initialize the Fabric CA server
    start       Start the Fabric CA server

  Flags:
    --address string                            Listening address of fabric-ca-server (default "0.0.0.0")
-b, --boot string                               The user:pass for bootstrap admin which is required to build default config file
    --ca.certfile string                        PEM-encoded CA certificate file (default "ca-cert.pem")
    --ca.chainfile string                       PEM-encoded CA chain file (default "ca-chain.pem")
    --ca.keyfile string                         PEM-encoded CA key file (default "ca-key.pem")
-n, --ca.name string                            Certificate Authority name
    --cacount int                               Number of non-default CA instances
    --cafiles stringSlice                       A list of comma-separated CA configuration files
-c, --config string                             Configuration file (default "fabric-ca-server-config.yaml")
    --csr.cn string                             The common name field of the certificate signing request to a parent fabric-ca-server
    --csr.hosts stringSlice                     A list of comma-separated host names in a certificate signing request to a parent fabric-ca-server
    --db.datasource string                      Data source which is database specific (default "fabric-ca-server.db")
    --db.tls.certfiles stringSlice              A list of comma-separated PEM-encoded trusted certificate files (e.g. root1.pem,root2.pem)
    --db.tls.client.certfile string             PEM-encoded certificate file when mutual authenticate is enabled
    --db.tls.client.keyfile string              PEM-encoded key file when mutual authentication is enabled
    --db.type string                            Type of database; one of: sqlite3, postgres, mysql (default "sqlite3")
-d, --debug                                     Enable debug level logging
    --intermediate.enrollment.label string      Label to use in HSM operations
    --intermediate.enrollment.profile string    Name of the signing profile to use in issuing the certificate
    --intermediate.parentserver.caname string   Name of the CA to connect to on fabric-ca-serve
-u, --intermediate.parentserver.url string      URL of the parent fabric-ca-server (e.g. http://<username>:<password>@<address>:<port)
    --intermediate.tls.certfiles stringSlice    A list of comma-separated PEM-encoded trusted certificate files (e.g. root1.pem,root2.pem)
    --intermediate.tls.client.certfile string   PEM-encoded certificate file when mutual authenticate is enabled
    --intermediate.tls.client.keyfile string    PEM-encoded key file when mutual authentication is enabled
    --ldap.enabled                              Enable the LDAP client for authentication and attributes
    --ldap.groupfilter string                   The LDAP group filter for a single affiliation group (default "(memberUid=%s)")
    --ldap.tls.certfiles stringSlice            A list of comma-separated PEM-encoded trusted certificate files (e.g. root1.pem,root2.pem)
    --ldap.tls.client.certfile string           PEM-encoded certificate file when mutual authenticate is enabled
    --ldap.tls.client.keyfile string            PEM-encoded key file when mutual authentication is enabled
    --ldap.url string                           LDAP client URL of form ldap://adminDN:adminPassword@host[:port]/base
    --ldap.userfilter string                    The LDAP user filter to use when searching for users (default "(uid=%s)")
-p, --port int                                  Listening port of fabric-ca-server (default 7054)
    --registry.maxenrollments int               Maximum number of enrollments; valid if LDAP not enabled
    --tls.certfile string                       PEM-encoded TLS certificate file for server's listening port (default "ca-cert.pem")
    --tls.clientauth.certfiles stringSlice      A list of comma-separated PEM-encoded trusted certificate files (e.g. root1.pem,root2.pem)
    --tls.clientauth.type string                Policy the server will follow for TLS Client Authentication. (default "noclientcert")
    --tls.enabled                               Enable TLS on the listening port
    --tls.keyfile string                        PEM-encoded TLS key for server's listening port (default "ca-key.pem")

  Use "fabric-ca-server [command] --help" for more information about a command.

Fabric CA 클라이언트 사용 메시지는 다음과 같습니다.

 fabric-ca-client --help
  Hyperledger Fabric Certificate Authority Client

  Usage:
    fabric-ca-client [command]

  Available Commands:
    enroll      Enroll an identity
    getcacert   Get CA certificate chain
    reenroll    Reenroll an identity
    register    Register an identity
    revoke      Revoke an identity

  Flags:
    --caname string                Name of CA
-c, --config string                Configuration file (default "/Users/saadkarim/.fabric-ca-client/fabric-ca-client-config.yaml")
    --csr.hosts stringSlice        A list of comma-separated host names in a certificate signing request
    --csr.serialnumber string      The serial number in a certificate signing request, which becomes part of the DN (Distinquished Name)
-d, --debug                        Enable debug level logging
    --enrollment.label string      Label to use in HSM operations
    --enrollment.profile string    Name of the signing profile to use in issuing the certificate
    --id.affiliation string        The identity's affiliation
    --id.attrs stringSlice         A list of comma-separated attributes of the form <name>=<value> (e.g. foo=foo1,bar=bar1)
    --id.maxenrollments int        The maximum number of times the secret can be reused to enroll.
    --id.name string               Unique name of the identity
    --id.secret string             The enrollment secret for the identity being registered
    --id.type string               Type of identity being registered (e.g. 'peer, app, user')
-M, --mspdir string                Membership Service Provider directory (default "msp")
-m, --myhost string                Hostname to include in the certificate signing request during enrollment (default "saads-mbp.raleigh.ibm.com")
-a, --revoke.aki string            AKI (Authority Key Identifier) of the certificate to be revoked
-e, --revoke.name string           Identity whose certificates should be revoked
-r, --revoke.reason string         Reason for revocation
-s, --revoke.serial string         Serial number of the certificate to be revoked
    --tls.certfiles stringSlice    A list of comma-separated PEM-encoded trusted certificate files (e.g. root1.pem,root2.pem)
    --tls.client.certfile string   PEM-encoded certificate file when mutual authenticate is enabled
    --tls.client.keyfile string    PEM-encoded key file when mutual authentication is enabled
-u, --url string                   URL of fabric-ca-server (default "http://localhost:7054")

  Use "fabric-ca-client [command] --help" for more information about a command.

※ 문자열 슬라이스 (목록) 인 명령 행 옵션은 쉼표로 구분 된 목록 요소로 옵션을 지정하거나 목록을 구성하는 문자열 값이있는 옵션을 여러 번 지정하여 지정할 수 있습니다. 예를 들어  csr.hostshost1과 host2를 지정하려면 --csr.hosts 'host1,host2' 또는 --csr.hosts host1 --csr.hosts host2를 전달할 수 있습니다. 이전 형식을 사용할 때는 쉼표 앞뒤에 공백이 없어야합니다.


Configuration Settings Precedence(구성 설정 우선 순위)

Fabric CA는 Fabric CA 서버 및 클라이언트의 설정을 구성하는 3 가지 방법을 제공합니다. 우선 순위는 다음과 같습니다.

  1. CLI 플래그
  2. 환경 변수
  3. 구성 파일

이 문서의 나머지 부분에서는 구성 파일을 변경하는 방법에 대해 설명합니다. 그러나 환경 변수 또는 CLI 플래그를 통해 구성 파일 변경 사항을 겹쳐 쓸 수 있습니다.

예를 들어 클라이언트 구성 파일에 다음과 같은 내용이있는 경우 :

tls:
  # Enable TLS (default: false)
  enabled: false

  # TLS for the client's listenting port (default: false)
  certfiles:
  client:
    certfile: cert.pem
    keyfile:

다음 환경 변수를 사용하여 구성 파일의 cert.pem 설정을 무시할 수 있습니다.

export FABRIC_CA_CLIENT_TLS_CLIENT_CERTFILE=cert2.pem

환경 변수와 구성 파일을 모두 무시하려면 명령 행 플래그를 사용할 수 있습니다.

fabric-ca-client enroll --tls.client.certfile cert3.pem

The same approach applies to fabric-ca-server, except instead of using FABIRC_CA_CLIENT as the prefix to environment variables, FABRIC_CA_SERVER is used.

ABIRC_CA_CLIENT를 환경 변수의 접두사로 사용하는 대신 FABRIC_CA_SERVER가 사용되는 것을 제외하고는 fabric-ca-server에도 동일한 접근 방식이 적용됩니다.

A word on file paths

파일 이름을 지정하는 Fabric CA 서버 및 클라이언트 구성 파일의 모든 등록 정보는 상대 경로와 절대 경로를 모두 지원합니다. 상대 경로는 구성 파일이있는 config 디렉토리에 상대적입니다. 예를 들어, config 디렉토리가 ~/config 이고 tls 섹션이 아래에 표시된 것과 같으면 Fabric CA 서버 또는 클라이언트는 ~/config  디렉토리의 root.pem 파일, ~/config 의 cert.pem 파일을 찾습니다 / certs 디렉토리와 key.pem 파일은 /abs/path 디렉토리에 있습니다.

tls:
  enabled: true
  certfiles:
    - root.pem
  client:
    certfile: certs/cert.pem
    keyfile: /abs/path/key.pem


Fabric CA Server(패브릭 CA 서버)

이 절에서는 패브릭 CA 서버에 대해 설명합니다.

패브릭 CA 서버를 시작하기 전에 초기화 할 수 있습니다. 이렇게하면 기본 구성 파일을 생성 할 수 있지만 시작하기 전에 설정을 검토하고 사용자 정의 할 수 있습니다.

Fabric CA 서버의 홈 디렉토리는 다음과 같이 결정됩니다.

  • 환경 변수 FABRIC_CA_SERVER_HOME이 설정되어 있으면 해당 값을 사용하십시오.
  • 그렇지 않으면, FABRIC_CA_HOME 환경 변수가 설정되면 해당 값을 사용하십시오.
  • 그렇지 않으면, CA_CFG_PATH 환경 변수가 설정되면 해당 값을 사용하십시오.
  • 그렇지 않으면, 현재 작업 디렉토리를 사용하십시오.

이 서버 섹션의 나머지 부분에서는 FABRIC_CA_HOME 환경 변수를 $HOME/fabric-ca/server로 설정했다고 가정합니다.

아래의 지시 사항은 서버 구성 파일이 서버의 홈 디렉토리에 있다고 가정합니다.


Initializing the server(서버 초기화)

패브릭 CA 서버를 다음과 같이 초기화하십시오.

fabric-ca-server init -b admin:adminpw

-b (부트 스트랩 ID) 옵션은 LDAP가 사용 불가능할 때 초기화에 필요합니다. Fabric CA 서버를 시작하려면 하나 이상의 부트 스트랩 ID가 필요합니다. 이 ID는 서버 관리자입니다.

서버 구성 파일에는 구성 할 수있는 CSR (Certificate Signing Request) 섹션이 들어 있습니다. 다음은 CSR 샘플입니다.

cn: fabric-ca-server
names:
   - C: US
     ST: "North Carolina"
     L:
     O: Hyperledger
     OU: Fabric
hosts:
  - host1.example.com
  - localhost
ca:
   expiry: 131400h
   pathlength: 1

위의 모든 필드는 fabric-ca-server init에 의해 생성 된 X.509 서명 키와 인증서와 관련이 있습니다. 이는 서버의 구성 파일에있는 ca.certfile 및 ca.keyfile 파일에 해당합니다. 필드는 다음과 같습니다.

  • cn은 일반 이름입니다.
  • O는 조직 이름입니다.
  • OU는 조직 단위입니다.
  • L은 위치 또는 도시입니다.
  • ST는 상태입니다.
  • C가 나라 입니다.

CSR의 사용자 정의 값이 필요한 경우 구성 파일을 사용자 정의하고 ca.certfile 및 ca-keyfile 구성 항목에 지정된 파일을 삭제 한 다음 fabric-ca-server init -b admin:adminpw 명령을 다시 실행하십시오.

fabric-ca-server init 명령은 -u <parent-fabric-ca-server-URL>  옵션을 지정하지 않으면 자체 서명 CA 인증서를 생성합니다. -u가 지정되면 서버의 CA 인증서는 상위 Fabric CA 서버에 의해 서명됩니다. 상위 Fabric CA 서버에 대해 인증하려면 URL이 <scheme>://<enrollmentID>:<secret>@<host>:<port> 형식이어야하며 <enrollmentID> 및 <secret>는 값이 'true'인 'hf.IntermediateCA'속성을 가진 ID. fabric-ca-server init 명령은 또한 서버의 홈 디렉토리에 fabric-ca-server-config.yaml이라는 기본 구성 파일을 생성합니다.

If you want the Fabric CA server to use a CA signing certificate and key file which you provide, you must place your files in the location referenced by ca.certfile and ca.keyfilerespectively. Both files must be PEM-encoded and must not be encrypted. More specifically, the contents of the CA certificate file must begin with -----BEGIN CERTIFICATE----- and the contents of the key file must begin with -----BEGIN PRIVATE KEY----- and not-----BEGIN ENCRYPTED PRIVATE KEY-----.

패브릭 CA 서버에서 제공하는 CA 서명 인증서와 키 파일을 사용하려면 ca.certfile 및 ca.keyfile이 각각 참조하는 위치에 파일을 배치해야합니다. 두 파일 모두 PEM으로 인코딩해야하며 암호화하면 안됩니다. 보다 구체적으로, CA 인증서 파일의 내용은 -----BEGIN CERTIFICATE----- 로 시작해야하며 키 파일의 내용은 -----BEGIN PRIVATE KEY-----로 시작해야하며 -----BEGIN ENCRYPTED PRIVATE KEY-----로 시작하면 안됩니다.

알고리즘 및 키 크기

CSR은 RSA와 ECDSA (Elliptic Curve)를 모두 지원하는 X.509 인증서와 키를 생성하도록 사용자 정의 할 수 있습니다. 다음 설정은 곡선 prime256v1 및 서명 알고리즘 ecdsa-with-SHA256이있는 ECDSA (Elliptic Curve Digital Signature Algorithm)의 구현 예입니다.

key:
   algo: ecdsa
   size: 256

알고리즘 및 키 크기의 선택은 보안 요구 사항을 기반으로합니다.

타원 곡선 (ECDSA)은 다음과 같은 주요 크기 옵션을 제공합니다.

size ASN1 OID Signature Algorithm
256 prime256v1 ecdsa-with-SHA256
384 secp384r1 ecdsa-with-SHA384
521 secp521r1 ecdsa-with-SHA512


RSA는 다음 키 크기 옵션을 제공합니다.

size Modulus (bits) Signature Algorithm
2048 2048 sha256WithRSAEncryption
4096 4096 sha512WithRSAEncryption


Starting the server(서버 시작)

다음과 같이 패브릭 CA 서버를 시작합니다.

fabric-ca-server start -b <admin>:<adminpw>

서버가 이전에 초기화되지 않은 경우 처음 시작할 때 서버가 초기화됩니다. 이 초기화 중에 서버는 ca-cert.pem 및 ca-key.pem 파일이 아직 없으면 생성하고 존재하지 않으면 기본 구성 파일도 생성합니다. 패브릭 CA 서버 초기화 절을 참조하십시오.

패브릭 CA 서버가 LDAP를 사용하도록 구성되어 있지 않으면 다른 ID를 등록하고 등록 할 수 있도록 미리 등록 된 하나 이상의 부트 스트랩 ID로 구성해야합니다. -b옵션은 부트 스트랩 ID의 이름과 암호를 지정합니다.

다음과 같이 -c 옵션을 사용하여 다른 구성 파일을 지정할 수 있습니다.

fabric-ca-server start -c <path-to-config-file> -b <admin>:<adminpw>

Fabric CA 서버가 http가 아닌 https에서 수신하도록하려면 tls.enabledtrue로 설정하십시오.

등록 할 때 동일한 비밀번호 (또는 암호)를 사용할 수있는 횟수를 제한하려면 구성 파일의registry.maxenrollments를 적절한 값으로 설정하십시오. 이 값을 1로 설정하면 Fabric CA 서버는 암호를 특정 등록 ID에만 한 번만 사용할 수 있습니다. 값을 -1로 설정하면 Fabric CA 서버는 등록을 위해 비밀을 재사용 할 수있는 횟수에 제한을 두지 않습니다. 기본값은 -1입니다. 값을 0으로 설정하면 Fabric CA 서버가 모든 ID에 대한 등록을 비활성화하고 ID 등록을 허용하지 않습니다.

패브릭 CA 서버는 이제 포트 7054에서 청취해야합니다.

패브릭 CA 서버가 클러스터에서 실행되도록 구성하거나 LDAP를 사용하지 않으려면 패브릭 CA 클라이언트 섹션으로 건너 뛸 수 있습니다.


Configuring the database(데이터베이스 구성)

이 절에서는 PostgreSQL 또는 MySQL 데이터베이스에 연결하도록 Fabric CA 서버를 구성하는 방법에 대해 설명합니다. 기본 데이터베이스는 SQLite이고 기본 데이터베이스 파일은 Fabric CA 서버의 홈 디렉토리에있는 fabric-ca-server.db입니다.

클러스터에서 Fabric CA 서버 실행에 신경 쓰지 않으면이 절을 건너 뛸 수 있습니다. 그렇지 않으면 아래에 설명 된대로 PostgreSQL 또는 MySQL을 구성해야합니다.

PostgreSQL

다음 샘플은 PostgreSQL 데이터베이스에 연결하기 위해 서버의 구성 파일에 추가 될 수 있습니다. 다양한 값을 적절하게 사용자 정의해야합니다.

db:
  type: postgres
  datasource: host=localhost port=5432 user=Username password=Password dbname=fabric-ca-server sslmode=verify-full

sslmode를 지정하면 SSL 인증 유형이 구성됩니다. sslmode의 유효한 값은 다음과 같습니다.

Mode Description
disable SSL 없음
require 항상 SSL 필요 (확인 건너 뛰기)
verify-ca 항상 SSL (서버가 제공 한 인증서가 신뢰할 수있는 CA에 의해 서명되었는지 확인)
verify-full verify-ca와 동일하며 서버가 제공 한 인증서가 신뢰할 수있는 CA에 의해 서명되었고 서버 호스트 이름이 인증서의 인증서와 일치하는지 확인합니다.

TLS를 사용하려면 Fabric CA 서버 구성 파일의 db.tls 섹션을 지정해야합니다. PostgreSQL 서버에서 SSL 클라이언트 인증을 사용하는 경우 클라이언트 인증서와 키 파일도 db.tls.client 섹션에 지정해야합니다. 다음은 db.tls 섹션의 예제입니다.

db:
  ...
  tls:
      enabled: true
      certfiles:
        - db-server-cert.pem
      client:
            certfile: db-client-cert.pem
            keyfile: db-client-key.pem

MySQL

다음 샘플은 Fabric CA 서버 구성 파일에 추가되어 MySQL 데이터베이스에 연결될 수 있습니다. 다양한 값을 적절하게 사용자 정의해야합니다.

MySQL 5.7.X에서 특정 모드는 서버가 '0000-00-00'을 유효한 날짜로 허용하는지 여부에 영향을 미칩니다. MySQL 서버가 사용하는 모드를 완화해야 할 수도 있습니다. 우리는 서버가 0의 날짜 값을 허용 할 수있게하려고합니다.

my.cnf에서 sql_mode 구성 옵션을 찾아 NO_ZERO_DATE를 제거하십시오. 이 변경 후 MySQL 서버를 다시 시작하십시오.

사용 가능한 다른 모드에 대한 다음 MySQL 설명서를 참조하고 사용중인 특정 버전의 MySQL에 대한 적절한 설정을 선택하십시오.

https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html

db:
  type: mysql
  datasource: root:rootpw@tcp(localhost:3306)/fabric-ca?parseTime=true&tls=custom

TLS를 통해 MySQL 서버에 연결하는 경우 위의 PostgreSQL 절에서 설명한대로 db.tls.client 섹션도 필요합니다.


Configuring LDAP(LDAP 구성)

패브릭 CA 서버는 LDAP 서버에서 읽을 수 있도록 구성 할 수 있습니다.

특히 패브릭 CA 서버는 LDAP 서버에 연결하여 다음 작업을 수행 할 수 있습니다.

  • 등록하기 전에 신원을 인증한다.
  • 권한 부여에 사용되는 ID의 속성 값을 검색합니다.

패브릭 CA 서버 구성 파일의 LDAP 섹션을 수정하여 서버가 LDAP 서버에 연결되도록 구성하십시오.

ldap:
   # Enables or disables the LDAP client (default: false)
   enabled: false
   # The URL of the LDAP server
   url: <scheme>://<adminDN>:<adminPassword>@<host>:<port>/<base>
   userfilter: filter

Where:

  • scheme은 ldap 또는 ldaps 중 하나입니다.
  • adminDN 은 관리 사용자의 고유 이름입니다.
  • pass 는 관리자 사용자의 암호입니다.
  • host 는 LDAP 서버의 호스트 이름 또는 IP 주소입니다.
  • port 는 선택적 포트 번호입니다. 기본값은 ldap의 경우 389이고 ldap의 경우 636입니다.
  • base 는 검색에 사용할 LDAP 트리의 선택적 루트입니다.
  • filter는 로그인 사용자 이름을 고유 이름으로 변환하기 위해 검색 할 때 사용하는 필터입니다. 예를 들어, (uid=%s) 값은 값이 로그인 사용자 이름 인 uid 속성 값을 사용하여 LDAP 항목을 검색합니다. 마찬가지로 (email=%s)는 이메일 주소로 로그인하는 데 사용될 수 있습니다.

다음은 docker 이미지가 https://github.com/osixia/docker-openldap에있는 OpenLDAP 서버의 기본 설정에 대한 샘플 구성 섹션입니다. 

ldap:
   enabled: true
   url: ldap://cn=admin,dc=example,dc=org:admin@localhost:10389/dc=example,dc=org
   userfilter: (uid=%s)

OpenLDAP 도커 이미지를 시작하고 구성하고, FABRIC_CA / cli / server / ldap / ldap_test.go에서 LDAP 테스트를 실행하고 OpenLDAP 서버를 중지하는 스크립트에 대해서는 FABRIC_CA / scripts / run-ldap-tests를 참조하십시오.

LDAP가 구성되면 등록은 다음과 같이 작동합니다.

  • 패브릭 CA 클라이언트 또는 클라이언트 SDK는 기본 인증 헤더와 함께 등록 요청을 전송합니다.
  • 패브릭 CA 서버는 등록 요청을 수신하고 인증 헤더에서 ID 이름과 암호를 해독하고 구성 파일에서 "userfilter"를 사용하여 ID 이름과 관련된 DN (Distinquished Name)을 조회 한 다음 LDAP 바인딩을 시도합니다 신원의 패스워드. LDAP Y 인드가 성공하면 등록 처리가 승인되고 계속 진행할 수 있습니다.

LDAP가 구성되면 속성 검색은 다음과 같이 작동합니다.

  • 클라이언트 SDK는 하나 이상의 속성이있는 tcerts 묶음에 대한 요청을 Fabric CA 서버에 보냅니다.
  • 패브릭 CA 서버는 tcert 요청을 수신하고 다음과 같이 수행합니다.
    • 인증 헤더의 토큰에서 등록 ID를 추출합니다 (토큰의 유효성을 검증 한 후).
    • LDAP 검색 / 쿼리를 LDAP 서버에 보내고, tcert 요청에서 수신 된 모든 속성 이름을 요청합니다.
    • 속성 값은 정상적으로 tcert에 배치됩니다.

Setting up a cluster(클러스터 설정)

IP sprayer를 사용하여 Fabric CA 서버 클러스터에로드 균형을 조정할 수 있습니다. 이 절에서는 패브릭 CA 서버 클러스터로 라우팅하도록 Haproxy를 설정하는 방법에 대한 예제를 제공합니다. 패브릭 CA 서버의 설정을 반영하도록 호스트 이름과 포트를 변경하십시오.

haproxy.conf

global
      maxconn 4096
      daemon

defaults
      mode http
      maxconn 2000
      timeout connect 5000
      timeout client 50000
      timeout server 50000

listen http-in
      bind *:7054
      balance roundrobin
      server server1 hostname1:port
      server server2 hostname2:port
      server server3 hostname3:port

참고 : TLS를 사용하는 경우 mode tcp를 사용해야합니다.


Setting up multiple CAs(여러 CA 설정)

fabric-ca 서버는 기본적으로 단일 기본 CA로 구성됩니다. 그러나 추가 CA는 구성 옵션을 사용하여 단일 서버에 추가 할 수 있습니다. 각각의 추가 CA에는 자체 홈 디렉토리가 있습니다.

cacount:

계정 수는 X 개의 기본 추가 CA를 빠르게 시작할 수있는 방법을 제공합니다. 홈 디렉토리는 서버 디렉토리에 상대적입니다. 이 옵션을 사용하면 디렉토리 구조가 다음과 같이됩니다.

--<Server Home>
  |--ca
    |--ca1
    |--ca2

각각의 추가 CA는 홈 디렉토리에 생성 된 기본 구성 파일을 가져옵니다. 구성 파일에는 고유 한 CA 이름이 포함됩니다.

예를 들어, 다음 명령은 2 개의 기본 CA 인스턴스를 시작합니다.

fabric-ca-server start -b admin:adminpw --cacount 2
cafiles:

cafiles 구성 옵션을 사용할 때 절대 경로가 제공되지 않으면 CA 홈 디렉토리는 서버 디렉토리에 상대적입니다.

이 옵션을 사용하려면 시작될 각 CA에 대해 CA 구성 파일이 이미 생성되고 구성되어 있어야합니다. 각 구성 파일에는 고유 한 CA 이름과 일반 이름 (CN)이 있어야합니다. 그렇지 않으면이 이름이 고유해야하므로 서버가 시작되지 않습니다. CA 구성 파일은 기본 CA 구성을 무시하며 CA 구성 파일의 누락 된 옵션은 기본 CA의 값으로 대체됩니다.

우선 순위는 다음과 같습니다.

  1. CA Configuration file(CA 구성 파일)
  2. Default CA CLI flags(기본 CA CLI 플래그)
  3. Default CA Environment variables(기본 CA 환경 변수)
  4. Default CA Configuration file(기본 CA 구성 파일)

CA 구성 파일에는 최소한 다음 내용이 포함되어야합니다.

ca:
# Name of this CA
name: <CANAME>

csr:
  cn: <COMMONNAME>

다음과 같이 디렉토리 구조를 구성 할 수 있습니다.

--<Server Home>
  |--ca
    |--ca1
      |-- fabric-ca-config.yaml
    |--ca2
      |-- fabric-ca-config.yaml

예를 들어, 다음 명령은 사용자 정의 된 두 CA 인스턴스를 시작합니다.

fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-config.yaml
--cafiles ca/ca2/fabric-ca-config.yaml


Enrolling an intermediate CA(중간 CA 설정)

중간 CA에 대한 CA 서명 인증서를 만들려면 중간 CA는 패브릭 ca 클라이언트가 CA에 등록하는 것과 같은 방법으로 상위 CA에 등록해야합니다. 이 작업은 -u 옵션을 사용하여 아래 그림과 같이 부모 CA의 URL과 등록 ID 및 암호를 지정하여 수행됩니다. 이 등록 ID와 연관된 ID에는 이름이 "hf.IntermediateCA"이고 값이 "true"인 속성이 있어야합니다. 발급 된 인증서의 CN (또는 Common Name)은 등록 ID로 설정됩니다. 중간 CA가 명시 적으로 CN 값을 지정하려고하면 오류가 발생합니다.

fabric-ca-server start -b admin:adminpw -u http://<enrollmentID>:<secret>@<parentserver>:<parentport>

다른 중간 CA 플래그의 경우 Fabric CA 서버의 구성 파일 형식 섹션을 참조하십시오.


Fabric CA Client(패브릭 CA 클라이언트)

이 절에서는 fabric-ca-client 명령을 사용하는 방법에 대해 설명합니다.

Fabric CA 클라이언트의 홈 디렉토리는 다음과 같이 결정됩니다.

  • 환경 변수 FABRIC_CA_CLIENT_HOME 이 설정되어 있으면 해당 값을 사용하십시오
  • 그렇지 않으면 FABRIC_CA_HOME 환경 변수가 설정되면 해당 값을 사용하십시오
  • 그렇지 않으면 CA_CFG_PATH 환경 변수가 설정되면 해당 값을 사용하십시오
  • 그렇지 않으면 $HOME/.fabric-ca-client를 사용하십시오.

아래 지침에서는 클라이언트 구성 파일이 클라이언트의 홈 디렉토리에 있다고 가정합니다.


Enrolling the bootstrap identity(부트 스트랩 ID 등록)

먼저, 필요한 경우 클라이언트 구성 파일에서 CSR (Certificate Signing Request) 섹션을 사용자 정의하십시오. csr.cn 필드는 부트 스트랩 ID의 ID로 설정되어야합니다. 기본 CSR 값은 다음과 같습니다.

csr:
  cn: <<enrollment ID>>
  key:
    algo: ecdsa
    size: 256
  names:
    - C: US
      ST: North Carolina
      L:
      O: Hyperledger Fabric
      OU: Fabric CA
  hosts:
   - <<hostname of the fabric-ca-client>>
  ca:
    pathlen:
    pathlenzero:
    expiry:

필드에 대한 설명은 CSR 필드를 참조하십시오.

그런 다음 fabric-ca-client enroll 명령을 실행하여 ID를 등록하십시오. 예를 들어, 다음 명령은 7054 포트에서 로컬로 실행되는 Fabric CA 서버를 호출하여 ID가 admin이고 암호가 adminpw 인 ID를 등록합니다.

export FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/admin
fabric-ca-client enroll -u http://admin:adminpw@localhost:7054

enroll 명령은 Enrollment Certificate (ECert), 해당 개인 키 및 CA 인증서 체인 PEM 파일을 Fabric CA 클라이언트의 msp 디렉토리의 하위 디렉토리에 저장합니다. PEM 파일의 저장 위치를 나타내는 메시지가 표시됩니다.


Registering a new identity(새 ID 등록)

등록 요청을 수행하는 ID는 현재 등록되어 있어야하며 등록중인 ID 유형을 등록 할 수있는 적절한 권한이 있어야합니다.

특히 다음과 같이 등록하는 동안 Fabric CA 서버에서 두 가지 권한 검사가 수행됩니다.

  1. 호출자의 ID에는 쉼표로 구분 된 값 목록이있는 "hf.Registrar.Roles"속성이 있어야합니다. 여기서 값 중 하나는 등록되는 ID 유형과 같습니다. 예를 들어, 호출자의 ID에 "peer, app, user"값이있는 "hf.Registrar.Roles"속성이있는 경우 호출자는 피어, 응용 프로그램 및 사용자 유형의 ID를 등록 할 수 있지만 순서는 지정할 수 없습니다.
  2. 호출자의 신분의 소속은 등록 된 신원의 소속과 동일하거나 접두어 여야합니다. 예를 들어, "a.b"의 제휴사는 "a.b.c"의 소속을 가진 신원을 등록 할 수 있지만 "a.c"의 소속을 가진 신원을 등록 할 수는 없습니다.

다음 명령은 admin 아이디의 자격 증명을 사용하여 등록 아이디가 "admin2"이고 "user"유형이 "org1.department1"이고 "hf.Revoker"라는 값이있는 속성으로 새 아이디를 등록합니다 "true"및 "bar"값을 갖는 "foo"라는 속성이 있습니다.

export FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/admin
fabric-ca-client register --id.name admin2 --id.type user --id.affiliation org1.department1 --id.attrs 'hf.Revoker=true,foo=bar'

등록 암호라고도하는 암호가 인쇄됩니다. 이 암호는 ID를 등록하는 데 필요합니다. 이를 통해 관리자는 신원을 등록하고 신원을 등록하기 위해 등록 ID와 암호를 다른 사람에게 제공 할 수 있습니다.

여러 속성을 -id.attrs 플래그의 일부로 지정할 수 있으며, 각 속성은 쉼표로 구분되어야합니다. 쉼표가 들어있는 속성 값의 경우 속성을 큰 따옴표로 묶어야합니다. 아래 예를 참조하십시오.

fabric-ca-client register -d --id.name admin2 --id.type user --id.affiliation org1.department1 --id.attrs '"hf.Registrar.Roles=peer,user",hf.Revoker=true'

또는

fabric-ca-client register -d --id.name admin2 --id.type user --id.affiliation org1.department1 --id.attrs '"hf.Registrar.Roles=peer,user"' --id.attrs hf.Revoker=true

클라이언트의 구성 파일을 편집하여 register 명령에 사용 된 모든 필드의 기본값을 설정할 수 있습니다. 예를 들어 구성 파일에 다음이 포함되어 있다고 가정합니다.

id:
  name:
  type: user
  affiliation: org1.department1
  maxenrollments: -1
  attributes:
    - name: hf.Revoker
      value: true
    - name: anotherAttrName
      value: anotherAttrValue

다음 명령은 명령 줄에서 가져 오는 등록 ID가 "admin3"인 새 ID를 등록하고 나머지는 ID 유형을 포함하는 구성 파일에서 가져옵니다. "user", 제휴 : "org1.department1" , 두 개의 속성 ( "hf.Revoker"및 "anotherAttrName")이 있습니다.

export FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/admin
fabric-ca-client register --id.name admin3

여러 속성으로 ID를 등록하려면 위와 같이 구성 파일에 모든 속성 이름과 값을 지정해야합니다.

maxenrollments를 0으로 설정하거나 구성에서 제외하면 ID가 등록되어 CA의 최대 등록 값을 사용하게됩니다. 또한 등록되는 ID의 최대 등록 값은 CA의 최대 등록 값을 초과 할 수 없습니다. 예를 들어 CA의 최대 등록 값이 5 인 경우 새 ID는 5보다 작거나 같은 값을 가져야하며 -1로 설정하면 안됩니다 (무한 등록).

다음 섹션에서 피어를 등록하는 데 사용할 피어 ID를 등록 해 봅시다. 다음 명령은 peer1 ID를 등록합니다. 우리는 서버가 우리를 위해 암호를 생성하는 대신 자신의 암호 (또는 비밀)를 지정하기로 결정했습니다.

export FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/admin
fabric-ca-client register --id.name peer1 --id.type peer --id.affiliation org1.department1 --id.secret peer1pw


Enrolling a peer identity(피어 신원 등록)

피어 ID를 성공적으로 등록 했으므로 이제 등록 ID와 비밀번호 (즉, 이전 섹션의 비밀번호)를 사용하여 피어를 등록 할 수 있습니다. 이는 "-M"옵션을 사용하여 Hyperledger Fabric MSP (Membership Service Provider) 디렉토리 구조를 채우는 방법을 시연하는 것을 제외하고는 부트 스트랩 ID를 등록하는 것과 비슷합니다.

다음 명령은 peer1을 등록합니다. "-M"옵션의 값을 동료의 core.yaml 파일에있는 'mspConfigPath'설정 인 동료의 MSP 디렉토리 경로로 바꾸십시오. FABRIC_CA_CLIENT_HOME을 동료의 홈 디렉토리로 설정할 수도 있습니다.

export FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/peer1
fabric-ca-client enroll -u http://peer1:peer1pw@localhost:7054 -M $FABRIC_CA_CLIENT_HOME/msp

MSP 디렉토리에 대한 경로가 주문자의 orderer.yaml 파일에있는 'LocalMSPDir'설정을 제외하고는 순서 지정자를 등록하는 것은 동일합니다.


Getting a CA certificate chain from another Fabric CA server

일반적으로 MSP 디렉토리의 cacerts 디렉토리에는 피어에 대한 모든 신뢰 루트를 나타내는 다른 인증 기관의 인증 기관 체인이 있어야합니다.

fabric-ca-client getcacerts 명령은 다른 Fabric CA 서버 인스턴스에서 이러한 인증서 체인을 검색하는 데 사용됩니다.

예를 들어 다음은 "CA2"라는 이름으로 포트 7055에서 수신 대기중인 localhost에서 두 번째 패브릭 CA 서버를 시작합니다. 이는 완전히 다른 신뢰의 루트를 나타내며 블록 체인의 다른 구성원에 의해 관리됩니다.

export FABRIC_CA_SERVER_HOME=$HOME/ca2
fabric-ca-server start -b admin:ca2pw -p 7055 -n CA2

다음 명령은 CA2의 인증서 체인을 peer1의 MSP 디렉토리에 설치합니다.

export FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/peer1
fabric-ca-client getcacert -u http://localhost:7055 -M $FABRIC_CA_CLIENT_HOME/msp


Reenrolling an identity(신원 재등록)

등록 인증서가 만료 되려고하거나 손상되었을 경우, 재 등록 명령을 실행하여 다음과 같이 등록 인증서를 갱신할 수 있습니다.

export FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/peer1
fabric-ca-client reenroll


Revoking a certificate or identity(인증서 또는 ID 해지)

신원 또는 인증서를 취소 할 수 있습니다. 신원을 취소하면 신원이 소유 한 모든 인증서가 취소되고 신원이 새 인증서를 얻지 못하게됩니다. 인증서를 해지하면 단일 인증서가 무효화됩니다.

인증서 또는 ID를 해지하려면 호출 ID에 hf.Revoker 특성이 있어야합니다. 해지 신원은 해지 신원의 소속과 동등하거나 접두사가있는 인증서 또는 신원만을 취소할 수 있습니다.

예를 들어, 제휴 orgs.org1을 가진 취소 자 (recoker)는 orgs.org1 또는 orgs.org1.department1과 제휴 된 신원을 취소 할 수 있지만 orgs.org2와 제휴 된 신원을 취소 할 수는 없습니다.

다음 명령은 ID를 사용 불가능하게하고 ID와 연관된 모든 인증서를 취소합니다. Fabric CA 서버가이 ID로 수신 한 모든 향후 요청이 거부됩니다.

fabric-ca-client revoke -e <enrollment_id> -r <reason>

The following are the supported reasons that can be specified using flag:

-r 플래그를 사용하여 지정할 수 있습니다 지원되는 이유는 다음과 같습니다 :

  1. unspecified
  2. keycompromise
  3. cacompromise
  4. affiliationchange
  5. superseded
  6. cessationofoperation
  7. certificatehold
  8. removefromcrl
  9. privilegewithdrawn
  10. aacompromise

예를 들어, 제휴 트리의 루트와 연결된 부트 스트랩 관리자는 다음과 같이 peer1의 신원을 취소 할 수 있습니다.

export FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/admin
fabric-ca-client revoke -e peer1

ID에 속하는 등록 인증서는 다음과 같이 AKI (Authority Key Identifier) 및 일련 번호를 지정하여 해지 할 수 있습니다.

fabric-ca-client revoke -a xxx -s yyy -r <reason>

예를 들어 openssl 명령을 사용하여 인증서의 AKI 및 일련 번호를 가져 와서 revoke 명령에 전달하여 다음과 같이 해당 인증서를 해지 할 수 있습니다.

serial=$(openssl x509 -in userecert.pem -serial -noout | cut -d "=" -f 2)
aki=$(openssl x509 -in userecert.pem -text | awk '/keyid/ {gsub(/ *keyid:|:/,"",$1);print tolower($0)}')
fabric-ca-client revoke -s $serial -a $aki -r affiliationchange


Enabling TLS(TLS 활성화)

이 절에서는 패브릭 CA 클라이언트에 대해 TLS를 구성하는 방법에 대해 자세히 설명합니다.

다음 섹션은 fabric-ca-client-config.yaml에서 구성 할 수 있습니다.


Contact specific CA instance(특정 CA 인스턴스에 문의)

서버에서 여러 CA 인스턴스를 실행하는 경우 특정 CA로 요청을 보낼 수 있습니다. 기본적으로 클라이언트 요청에 CA 이름이 지정되지 않은 경우 요청은 fabric-ca 서버의 기본 CA로 전달됩니다. CA 이름은 클라이언트 명령의 명령 행에서 다음과 같이 지정할 수 있습니다.

fabric-ca-client enroll -u http://admin:adminpw@localhost:7054 --caname <caname>


File Formats(파일 형식)

Fabric CA server’s configuration file format(패브릭 CA 서버의 구성 파일 형식)

구성 파일은 -c 또는 --config 옵션을 사용하여 서버에 제공 될 수 있습니다. --config 옵션을 사용하고 지정된 파일이 존재하지 않으면 기본 구성 파일 (아래 표시된 것과 같습니다)이 지정된 위치에 작성됩니다. 그러나 구성 옵션을 사용하지 않으면 서버의 홈 디렉토리에 작성됩니다 (Fabric CA Server 섹션 자세한 정보 참조).

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

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

#############################################################################
#  TLS section for the server's listening port
#
#  The following types are supported for client authentication: NoClientCert,
#  RequestClientCert, RequireAnyClientCert, VerfiyClientCertIfGiven,
#  and RequireAndVerifyClientCert.
#
#  Certfiles is a list of root certificate authorities that the server uses
#  when verifying client certificates.
#############################################################################
tls:
  # Enable TLS (default: false)
  enabled: false
  # TLS for the server's listening port
  certfile: ca-cert.pem
  keyfile: ca-key.pem
  clientauth:
    type: noclientcert
    certfiles:

#############################################################################
#  The CA section contains information related to the Certificate Authority
#  including the name of the CA, which should be unique for all members
#  of a blockchain network.  It also includes the key and certificate files
#  used when issuing enrollment certificates (ECerts) and transaction
#  certificates (TCerts).
#  The chainfile (if it exists) contains the certificate chain which
#  should be trusted for this CA, where the 1st in the chain is always the
#  root CA certificate.
#############################################################################
ca:
  # Name of this CA
  name:
  # Key file (default: ca-key.pem)
  keyfile: ca-key.pem
  # Certificate file (default: ca-cert.pem)
  certfile: ca-cert.pem
  # Chain file (default: chain-cert.pem)
  chainfile: ca-chain.pem

#############################################################################
#  The registry section controls how the fabric-ca-server does two things:
#  1) authenticates enrollment requests which contain a username and password
#     (also known as an enrollment ID and secret).
#  2) once authenticated, retrieves the identity's attribute names and
#     values which the fabric-ca-server optionally puts into TCerts
#     which it issues for transacting on the Hyperledger Fabric blockchain.
#     These attributes are useful for making access control decisions in
#     chaincode.
#  There are two main configuration options:
#  1) The fabric-ca-server is the registry
#  2) An LDAP server is the registry, in which case the fabric-ca-server
#     calls the LDAP server to perform these tasks.
#############################################################################
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: <<<ADMIN>>>
       pass: <<<ADMINPW>>>
       type: client
       affiliation: ""
       maxenrollments: -1
       attrs:
          hf.Registrar.Roles: "client,user,peer,validator,auditor"
          hf.Registrar.DelegateRoles: "client,user,validator,auditor"
          hf.Revoker: true
          hf.IntermediateCA: true

#############################################################################
#  Database section
#  Supported types are: "sqlite3", "postgres", and "mysql".
#  The datasource value depends on the type.
#  If the type is "sqlite3", the datasource value is a file name to use
#  as the database store.  Since "sqlite3" is an embedded database, it
#  may not be used if you want to run the fabric-ca-server in a cluster.
#  To run the fabric-ca-server in a cluster, you must choose "postgres"
#  or "mysql".
#############################################################################
db:
  type: sqlite3
  datasource: fabric-ca-server.db
  tls:
      enabled: false
      certfiles:
        - db-server-cert.pem
      client:
        certfile: db-client-cert.pem
        keyfile: db-client-key.pem

#############################################################################
#  LDAP section
#  If LDAP is enabled, the fabric-ca-server calls LDAP to:
#  1) authenticate enrollment ID and secret (i.e. username and password)
#     for enrollment requests;
#  2) To retrieve identity attributes
#############################################################################
ldap:
   # Enables or disables the LDAP client (default: false)
   enabled: false
   # The URL of the LDAP server
   url: ldap://<adminDN>:<adminPassword>@<host>:<port>/<base>
   tls:
      certfiles:
        - ldap-server-cert.pem
      client:
         certfile: ldap-client-cert.pem
         keyfile: ldap-client-key.pem

#############################################################################
#  Affiliation section
#############################################################################
affiliations:
   org1:
      - department1
      - department2
   org2:
      - department1

#############################################################################
#  Signing section
#
#  The "default" subsection is used to sign enrollment certificates;
#  the default expiration ("expiry" field) is "8760h", which is 1 year in hours.
#
#  The "ca" profile subsection is used to sign intermediate CA certificates;
#  the default expiration ("expiry" field) is "43800h" which is 5 years in hours.
#  Note that "isca" is true, meaning that it issues a CA certificate.
#  A maxpathlen of 0 means that the intermediate CA cannot issue other
#  intermediate CA certificates, though it can still issue end entity certificates.
#  (See RFC 5280, section 4.2.1.9)
#############################################################################
signing:
    default:
      usage:
        - cert sign
      expiry: 8760h
    profiles:
      ca:
         usage:
           - cert sign
         expiry: 43800h
         caconstraint:
           isca: true
           maxpathlen: 0

###########################################################################
#  Certificate Signing Request (CSR) section.
#  This controls the creation of the root CA certificate.
#  The expiration for the root CA certificate is configured with the
#  "ca.expiry" field below, whose default value is "131400h" which is
#  15 years in hours.
#  The pathlength field is used to limit CA certificate hierarchy as described
#  in section 4.2.1.9 of RFC 5280.
#  Examples:
#  1) No pathlength value means no limit is requested.
#  2) pathlength == 1 means a limit of 1 is requested which is the default for
#     a root CA.  This means the root CA can issue intermediate CA certificates,
#     but these intermediate CAs may not in turn issue other CA certificates
#     though they can still issue end entity certificates.
#  3) pathlength == 0 means a limit of 0 is requested;
#     this is the default for an intermediate CA, which means it can not issue
#     CA certificates though it can still issue end entity certificates.
###########################################################################
csr:
   cn: <<<COMMONNAME>>>
   names:
      - C: US
        ST: "North Carolina"
        L:
        O: Hyperledger
        OU: Fabric
   hosts:
     - <<<MYHOST>>>
     - localhost
   ca:
      expiry: 131400h
      pathlength: <<<PATHLENGTH>>>

#############################################################################
# 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

#############################################################################
# Multi CA section
#
# Each Fabric CA server contains one CA by default.  This section is used
# to configure multiple CAs in a single server.
#
# 1) --cacount <number-of-CAs>
# Automatically generate <number-of-CAs> non-default CAs.  The names of these
# additional CAs are "ca1", "ca2", ... "caN", where "N" is <number-of-CAs>
# This is particularly useful in a development environment to quickly set up
# multiple CAs.
#
# 2) --cafiles <CA-config-files>
# For each CA config file in the list, generate a separate signing CA.  Each CA
# config file in this list MAY contain all of the same elements as are found in
# the server config file except port, debug, and tls sections.
#
# Examples:
# fabric-ca-server start -b admin:adminpw --cacount 2
#
# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml
# --cafiles ca/ca2/fabric-ca-server-config.yaml
#
#############################################################################

cacount:

cafiles:

#############################################################################
# Intermediate CA section
#
# The relationship between servers and CAs is as follows:
#   1) A single server process may contain or function as one or more CAs.
#      This is configured by the "Multi CA section" above.
#   2) Each CA is either a root CA or an intermediate CA.
#   3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA.
#
# This section pertains to configuration of #2 and #3.
# If the "intermediate.parentserver.url" property is set,
# then this is an intermediate CA with the specified parent
# CA.
#
# parentserver section
#    url - The URL of the parent server
#    caname - Name of the CA to enroll within the server
#
# enrollment section used to enroll intermediate CA with parent CA
#    profile - Name of the signing profile to use in issuing the certificate
#    label - Label to use in HSM operations
#
# tls section for secure socket connection
#   certfiles - PEM-encoded list of trusted root certificate files
#   client:
#     certfile - PEM-encoded certificate file for when client authentication
#     is enabled on server
#     keyfile - PEM-encoded key file for when client authentication
#     is enabled on server
#############################################################################
intermediate:
  parentserver:
    url:
    caname:

  enrollment:
    hosts:
    profile:
    label:

  tls:
    certfiles:
    client:
      certfile:
      keyfile:


Fabric CA server’s configuration file format(패브릭 CA 서버의 구성 파일 형식)

A configuration file can be provided to the client using the -c or --config option. If the config option is used and the specified file doesn’t exist, a default configuration file (like the one shown below) will be created in the specified location. However, if no config option was used, it will be created in the client’s home directory (see Fabric CA Client section more info).

구성 파일은 -c 또는 --config  옵션을 사용하여 클라이언트에 제공 될 수 있습니다. config 옵션이 사용되고 지정된 파일이 존재하지 않으면 기본 구성 파일 (아래 표시된 것과 같습니다)이 지정된 위치에 작성됩니다. 그러나 구성 옵션을 사용하지 않으면 클라이언트의 홈 디렉토리에 생성됩니다 (Fabric CA 클라이언트 섹션 자세한 정보 참조).

#############################################################################
# Client Configuration
#############################################################################

# URL of the Fabric CA server (default: http://localhost:7054)
URL: http://localhost:7054

# Membership Service Provider (MSP) directory
# When the client is used to enroll a peer or an orderer, this field must be
# set to the MSP directory of the peer/orderer
MSPDir:

#############################################################################
#    TLS section for secure socket connection
#############################################################################
tls:
  # Enable TLS (default: false)
  enabled: false
  certfiles:
  client:
    certfile:
    keyfile:

#############################################################################
#  Certificate Signing Request section for generating the CSR for
#  an enrollment certificate (ECert)
#############################################################################
csr:
  cn: <<<ENROLLMENT_ID>>>
  names:
    - C: US
      ST: North Carolina
      L:
      O: Hyperledger
      OU: Fabric
  hosts:
   - <<<MYHOST>>>
  ca:
    pathlen:
    pathlenzero:
    expiry:

#############################################################################
#  Registration section used to register a new identity with Fabric CA server
#############################################################################
id:
  name:
  type:
  affiliation:
  attributes:
    - name:
      value:

#############################################################################
#  Enrollment section used to enroll an identity with Fabric CA server
#############################################################################
enrollment:
  profile:
  label:

# Name of the CA to connect to within the fabric-ca server
caname:


Appendix(부록)

참조사항: https://developer.ibm.com/kr/tag/%ED%95%98%EC%9D%B4%ED%8D%BC%EB%A0%88%EC%A0%80/

반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함