2017-03-27 108 views
0

我有一个测试应用程序已完成并且在Hyperledger Fabric下工作。它运行在安全模式下,并使用admin/Xurw3yU9zI0l凭证......这些凭证似乎是默认的,并在某处进行了硬编码。一切正常。我使用fabric-peer和fabric-membersrvc docker(v.0.6)。Hyperledger Fabric:如何编辑成员服务(fabric-membersrvc)用户和密码

存储管理员用户名和密码的位置(这样我可以在将Fabric端口打开到世界之前更改它们并添加新用户)?我无法将其作为用于调出网络结构的任何docker-compose文件和基础子文件中的参数。任何文档解释这和成员(角色,权限)如何工作?感谢任何方向。

编辑:

让我在这里添加此作为参考。这是目前可用的v0.6 docker中示例membersrvc.yaml文件的内容。虽然不是一个完整的文档,它允许理解这些概念。如果我理解正确,则将这些数据复制到用户注册表中,然后根据注释中说明的规则进行编辑(添加用户,...)。有关这方面的更多信息肯定会有很大帮助! :-):

# Default users to be registered with the CA on first launch. The role is a binary OR 
# of the different roles a user can have: 
# 
# - simple client such as a wallet: CLIENT 
# - non-validating peer: PEER 
# - validating client: VALIDATOR 
# - auditing client: AUDITOR 
# 
eca: 
     # This hierarchy is used to create the Pre-key tree, affiliations is the top of this hierarchy, 'banks_and_institutions' is used to create the key associated to auditors of both banks and 
     # institutions, 'banks' is used to create a key associated to auditors of banks, 'bank_a' is used to create a key associated to auditors of bank_a, etc. 
     affiliations: 
      banks_and_institutions: 
       banks: 
        - bank_a 
        - bank_b 
        - bank_c 
       institutions: 
        - institution_a 
     users: 
       # 
       # The fields of each user are as follows: 
       # <EnrollmentID>: <system_role (1:client, 2: peer, 4: validator, 8: auditor)> <EnrollmentPWD> <Affiliation> <Affiliation_Role> <JSON_Metadata> 
       # 
       # The optional JSON_Metadata field is of the following format: 
       # { "registrar": { "roles": <array-of-role-names>, "delegateRoles": <array-of-role-names> } } 
       # The 'registrar' section is used to control access to registration of new users directly via the ECAA.RegisterUser GRPC call. 
       # (See the 'fabric/membersrvc/protos/ca.proto' file for the definition of ECAA.RegisterUser.) 
       # Note that this also controls who can register users via the client SDK. 
       # 
       # Only users with a 'registrar' section may be a registrar to register other users. In particular, 
       # 1) the "roles" field specifies which member roles may be registered by this user, and 
       # 2) the "delegateRoles" field specifies which member roles may become the "roles" field of registered users. 
       # The valid role names are "client", "peer", "validator", and "auditor". 
       # 
       # Example1: 
       # The 'admin' user below can register clients, peers, validators, or auditors; furthermore, the 'admin' user can register other 
       # users who can then register clients only. 
       # 
       # Example2: 
       # The 'WebAppAdmin' user below can register clients only, but none of the users registered by this user can register other users. 
       # 
       admin: 1 Xurw3yU9zI0l institution_a '{"registrar":{"roles":["client","peer","validator","auditor"],"delegateRoles":["client"]}}' 
       WebAppAdmin: 1 DJY27pEnl16d institution_a '{"registrar":{"roles":["client"]}}' 
       lukas: 1 NPKYL39uKbkj bank_a 
       system_chaincode_invoker: 1 DRJ20pEql15a institution_a 
       diego: 1 DRJ23pEQl16a institution_a 
       jim: 1 6avZQLwcUe9b bank_a 
       binhn: 1 7avZQLwcUe9q institution_a 

       # Users for asset transfer with roles test located at 
       # sdk/node/test/unit/asset-mgmt-with-roles.js 
       alice: 1 CMS10pEQlB16 bank_a 
       bob: 1 NOE63pEQbL25 bank_a 
       assigner: 1 Tc43PeqBl11 bank_a 

       vp: 4 f3489fy98ghf 

       test_vp0: 4 MwYpmSRjupbT 
       test_vp1: 4 5wgHK9qqYaPy 
       test_vp2: 4 vQelbRvja7cJ 
       test_vp3: 4 9LKqKH5peurL 
       test_vp4: 4 Pqh90CEW5juZ 
       test_vp5: 4 FfdvDkAdY81P 
       test_vp6: 4 QiXJgHyV4t7A 
       test_vp7: 4 twoKZouEyLyB 
       test_vp8: 4 BxP7QNh778gI 
       test_vp9: 4 wu3F1EwJWHvQ 

# Uncomment this section to activate devnet setup as specficied in 
# devnet-setup.md 
# 
#    vp0: 4 vp0_secret 
#    vp1: 4 vp1_secret 

       test_user0: 1 MS9qrN8hFjlE bank_a 
       test_user1: 1 jGlNl6ImkuDo institution_a 
       test_user2: 1 zMflqOKezFiA bank_c 
       test_user3: 1 vWdLCE00vJy0 bank_a 
       test_user4: 1 4nXSrfoYGFCP institution_a 
       test_user5: 1 yg5DVhm0er1z bank_b 
       test_user6: 1 b7pmSxzKNFiw bank_a 
       test_user7: 1 YsWZD4qQmYxo institution_a 
       test_user8: 1 W8G0usrU7jRk bank_a 
       test_user9: 1 H80SiB5ODKKQ institution_a 

       test_nvp0: 2 iywrPBDEPl0K bank_a 
       test_nvp1: 2 DcYXuRSocuqd institution_a 
       test_nvp2: 2 flpChShlY7xt bank_c 
       test_nvp3: 2 jeruawMomclo bank_a 
       test_nvp4: 2 RMYVxSZCk370 institution_a 
       test_nvp5: 2 XHYVCIJGZGK7 bank_b 
       test_nvp6: 2 4cIn63j8ahYp bank_a 
       test_nvp7: 2 E7FAJUtWVn2h institution_a 
       test_nvp8: 2 LJu8DkUilBEH bank_a 
       test_nvp9: 2 VlEsBsiyXSjw institution_a 
+0

我会首先检查这个位置'的https:// github.com/hyperledger/fabric/blob/v0.6/membersrvc/membersrvc.yaml'如果不存在,我会尝试在您的文件系统上使用'find'命令。 – gvlax

+0

谢谢。我使用泊坞窗图像,所以本地不能grep为此......我已经看到,码头里面的文件在/opt/gopath/src/github.com/hyperledger/fabric/membersrvc/membersrvc.yaml,似乎在评论中自我解释。 – icordoba

+0

也许你在'membersrvc.yaml'看到的只是你用于管理员用户的密码(_Xurw3yU9zI0l_)的哈希值。只是猜测.. – gvlax

回答

3

要将其他用户添加或更改管理员密码,您可以创建自己的membersrvc.yml并使用它,当你使用泊坞窗开始membersrvc。

您可以编辑撰写文件映射本地membersrv.file,如:

membersrvc: 
    # try 'docker ps' to see the container status after starting this compose 
    container_name: membersrvc 
    image: hyperledger/fabric-membersrvc 
    command: membersrvc 
    expose: 
    - "7054" 
    ports: 
    - "7054:7054" 
    environment: 
    - MEMBERSRVC_CA_ACA_ENABLED=true 
    - MEMBERSRVC_CA_TCA_ATTRIBUTE-ENCRYPTION_ENABLED=true 
    volumes: 
    - /[path to your membersrvc.yml file]/membersrvc.yaml:/opt/gopath/src/github.com/hyperledger/fabric/membersrvc/membersrvc.yaml 

这里是CA上的文档:http://hyperledger-fabric.readthedocs.io/en/stable/Setup/ca-setup/

+0

谢谢。这将有所帮助。我已经在readthedocs中看到了ca-setup页面,但它没有解释太多。我发现的大部分信息都在我的docker镜像的examplesrvc.yaml文件中,我发现这种格式是:任何可以更详细地解释这些关系,角色......的链接?谢谢。 – icordoba

+0

我添加了示例配置的内容......但是例如,没有任何示例具有“Affiliation_Role”来查看具体内容。如果我错了,有人纠正我。 – icordoba

+0

我也没有找到任何文档。你也许可以试着在超级结构聊天上提出这个问题:[https://chat.hyperledger.org/channel/fabric-ca](https://chat.hyperledger.org/channel/fabric-ca)。祝你好运,你可能有你的答案 – ecn

相关问题