超级账本结构:注册'orderer1-ord'在隶属关系验证中失败:无法获得隶属关系'ord。OU': :



我们已经定制了织物-CA样品,以删除 env.sh

export FABRIC_CA_CLIENT_ID_AFFILIATION=org1

并在所有对fabric-ca-client registerenroll的调用中添加--id.affiliation $ORG.OU。例:

scripts/env.sh:   fabric-ca-client enroll -d --enrollment.profile tls -u $ENROLLMENT_URL -M /tmp/tls --csr.hosts $HOST_NAME --csr.names O=$ORG --id.affiliation $ORG.OU
scripts/env.sh:      fabric-ca-client enroll -d -u https://$ADMIN_NAME:$ADMIN_PASS@$CA_HOST:7054 --csr.names O=$ORG --id.affiliation $ORG.OU
scripts/env.sh:      fabric-ca-client enroll -d -u https://$USER_NAME:$USER_PASS@$CA_HOST:7054 --csr.names O=$ORG --id.affiliation $ORG.OU
scripts/setup-fabric.sh:         fabric-ca-client register -d --id.name $ORDERER_NAME --id.secret $ORDERER_PASS --id.type orderer --id.affiliation $ORG.OU
scripts/setup-fabric.sh:      fabric-ca-client register -d --id.name $ADMIN_NAME --id.secret $ADMIN_PASS --id.attrs "admin=true:ecert" --id.affiliation $ORG.OU
scripts/setup-fabric.sh:         fabric-ca-client register -d --id.name $PEER_NAME --id.secret $PEER_PASS --id.type peer --id.affiliation $ORG.OU
scripts/setup-fabric.sh:      fabric-ca-client register -d --id.name $ADMIN_NAME --id.secret $ADMIN_PASS --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*,hf.Revoker=true,hf.GenCRL=true,admin=true:ecert" --id.affiliation $ORG.OU
scripts/setup-fabric.sh:      fabric-ca-client register -d --id.name $USER_NAME --id.secret $USER_PASS --id.affiliation $ORG.OU
scripts/setup-fabric.sh:      fabric-ca-client getcacert -d -u https://$CA_HOST:7054 -M $ORG_MSP_DIR --id.affiliation $ORG.OU
scripts/start-orderer.sh:fabric-ca-client enroll -d --enrollment.profile tls -u $ENROLLMENT_URL -M /tmp/tls --csr.hosts $ORDERER_HOST --csr.names O=$ORG --id.affiliation $ORG.OU
scripts/start-orderer.sh:fabric-ca-client enroll -d -u $ENROLLMENT_URL -M $ORDERER_GENERAL_LOCALMSPDIR --csr.names O=$ORG --id.affiliation $ORG.OU
scripts/start-peer.sh:fabric-ca-client enroll -d --enrollment.profile tls -u $ENROLLMENT_URL -M /tmp/tls --csr.hosts $PEER_HOST --csr.names O=$ORG --id.affiliation $ORG.OU
scripts/start-peer.sh:fabric-ca-client enroll -d -u $ENROLLMENT_URL -M $CORE_PEER_MSPCONFIGPATH --csr.names O=$ORG --id.affiliation $ORG.OU

当我们这样做时,我们在设置中看到此错误.log:

Error: Response from server: Error Code: 0 - Registration of 'orderer1-ord' failed in affiliation validation: Failed getting affiliation 'ord.OU': : scode: 404, code: 63, msg: Failed to get Affiliation: sql: no rows in result set

如果我们修改注册CAADmin以添加:

# https://stackoverflow.com/a/48840929/147530
fabric-ca-client affiliation add $1

我们现在看到此错误:

Error: Response from server: Error Code: 60 - Affiliation already exists

我们如何解决这个问题?

添加$ORG.OU的隶属关系失败,但添加$ORG作品的隶属关系。在 setup-fabric.sh 中,函数 registerPeerIdentityentities

fabric-ca-client register -d --id.name $ADMIN_NAME --id.secret $ADMIN_PASS --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*,hf.Revoker=true,hf.GenCRL=true,admin=true:ecert,abac.init=true:ecert" --id.affiliation=$ORG
log "Registering user identity with $CA_NAME"
fabric-ca-client register -d --id.name $USER_NAME --id.secret $USER_PASS --id.affiliation=$ORG

请注意rca-myorg1$FABRIC_CA_SERVER_HOME/fabric-ca-server-config.yaml中的以下部分

root@cad23a1fb013:/etc/hyperledger/fabric-ca# cat fabric-ca-server-config.yaml
affiliations:
ord: []
myorg1: []
myorg2: []
myorg3: []
org1:
- department1
- department2
org2:
- department1

从 https://hyperledger-fabric-ca.readthedocs.io/en/latest/users-guide.html#registering-a-new-identity

注册商的隶属关系必须等于或前缀 正在注册的身份的隶属关系。例如,一个 隶属于"A.B"的注册商可以注册身份 隶属于"A.B.C",但不得向 "AC"的隶属关系。如果身份需要根隶属关系, 那么隶属关系请求应该是一个点 (".") 和注册商 还必须具有根隶属关系。如果未在 注册请求,正在注册的身份将被赋予 注册商的隶属关系。

所以不确定为什么将隶属关系设置为$ORG有效,但$ORG.OU不起作用

最新更新