简体   繁体   English

登录到对等网络-hyperledger结构(eca.user)有什么问题?

[英]What's wrong with logging into peer network -hyperledger fabric (eca.user)?

can anyone help me out with this? 有人可以帮我吗? I'm not sure what's wrong with the login of the peer network(hyperledger fabric). 我不确定对等网络(超级账本结构)的登录出了什么问题。

I followed their steps in http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/ , under the note on security functionality. http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/ ,我按照有关安全功能的说明进行了操作。 I tried as what's stated. 我尝试了所说的。 I did vagrant ssh, cd $GOPATH/src/github.com/hyperledger/fabric/peer and followed by 我做了流浪的ssh, cd $GOPATH/src/github.com/hyperledger/fabric/peer ,然后是

peer network login admin 

(a default file of membersrvc.yaml). (membersrvc.yaml的默认文件)。

I did try out other username and password, but none of it worked as it shown error. 我确实尝试了其他用户名和密码,但是由于显示错误,它们均无效。 To my understanding, when it shows errors, it would mean that the user and password are incorrect. 据我了解,当显示错误时,将意味着用户名和密码不正确。 However, i copied and pasted the user and password and it didnt work. 但是,我复制并粘贴了用户名和密码,但没有成功。 May i know what's wrong with the user and password for logging into peer network (hyperledger fabric- using of git bash)? 我能否知道登录对等网络(hyperledger fabric-使用git bash)的用户名和密码有什么问题?

The user and passwords(eca.user- showing the user and password) will be shown in the following (membersrvc.yaml) : 用户名和密码(eca.user-显示用户名和密码)将显示在下面(membersrvc.yaml):

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

tions, '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
                    testing: 1 test123 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 f3489fy98ghfAD

                    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

The following codes will be what i key into git bash to log into peer network(hyperledger fabric) : 以下代码将是我键入git bash以便登录对等网络(hyperledger架构)的代码:

vagrant@hyperledger-devenv:v0.0.11-c6e56d6:/opt/gopath/src/github.com/hyperledger/fabric/peer$ peer network login admin

Enter password for user 'admin': Xurw3yU9zI0l

The following will be the errors after i input the password: 输入密码后,将出现以下错误:

2016/09/14 07:05:33 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7051: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:7051" <nil>}
2016/09/14 07:05:35 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7051: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:7051" <nil>}
2016/09/14 07:05:35 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7051: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:7051" <nil>}
Error: Error trying to connect to local peer: grpc: timed out when dialing
Usage:
  peer network login <username> [flags]

Flags:
  -p, --password string   The password for user. You will be requested to enter the password if this flag is not specified.

Global Flags:
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
      --test.coverprofile string   Done (default "coverage.cov")
  -v, --version                    Display current version of fabric peer server

vagrant@hyperledger-devenv:v0.0.11-c6e56d6:/opt/gopath/src/github.com/hyperledger/fabric/peer$

Updated: Yes, i am able to achieve something similar like this 更新:是的,我能够实现类似的目标

06:04:34.617 [crypto] RegisterClient -> INFO 017 Registering client [admin] with                               name [admin]...
06:04:34.737 [crypto] Info -> INFO 018 [client.admin]  Register crypto engine...
06:04:34.738 [crypto] Info -> INFO 019 [client.admin]  Register crypto engine...                              done.
06:04:34.739 [crypto] RegisterClient -> INFO 01a Registering client [admin] with                               name [admin]...done!

But, may i know why can I only log in for just once? 但是,我可以知道为什么我只能登录一次吗? For instance, if i want to log into admin again, it won't prompt for password and it will have something like this 例如,如果我想再次登录admin,它不会提示您输入密码,并且会有类似这样的内容

vagrant@hyperledger-devenv:v0.0.11-087d2ea:/opt/gopath/src/github.com/hyperledger/fabric/peer$ peer network login admin
vagrant@hyperledger-devenv:v0.0.11-087d2ea:/opt/gopath/src/github.com/hyperledger/fabric/peer$

The reason for your error, 您出错的原因,

2016/09/14 07:05:33 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7051: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:7051" <nil>}

is that there is no peer running on 0.0.0.0:7051 . 是没有在0.0.0.0:7051运行的peer

here is what you should do, 这是你应该做的,

from your fabric directory run membersrvc first (read this on how to setup CA), then in a separate terminal, run the following command to initiate a peer process, 从织物目录运行membersrvc第一(读取 ,然后在一个单独终端,运行下面的命令以启动关于如何设置CA) peer的方法,

CORE_SECURITY_ENABLED=true CORE_SECURITY_PRIVACY=true peer node start --peer-chaincodedev

notice that I am running it in dev mode. 请注意,我正在dev模式下运行它。

open another terminal and run the following, 打开另一个终端并运行以下命令,

peer network login lukas

enter (or paste) password when prompted. 出现提示时输入(或粘贴)密码。

In the second window (where you have initiated the peer), you will see the following output, 在第二个窗口(已启动对等方)中,将看到以下输出,

08:48:18.978 [crypto] RegisterClient -> INFO 01b Registering client [lukas] with name [lukas]...
08:48:19.179 [crypto] Info -> INFO 01c [client.lukas]  Register crypto engine...
08:48:19.181 [crypto] Info -> INFO 01d [client.lukas]  Register crypto engine...done.
08:48:19.183 [crypto] RegisterClient -> INFO 01e Registering client [lukas] with name [lukas]...done!

Let me know if it helps. 让我知道是否有帮助。

An answer to the second part of question “why can I only log in for just once?” is following: 问题“为什么我只能登录一次?”第二部分的答案如下:

User can have only one Enrolment certificate. 用户只能拥有一张注册证书。 Membership service will generate unique Enrolment certificate at first user's login to the network. 会员服务将在第一个用户登录到网络时生成唯一的注册证书。 As soon as Enrolment certificate is issued, membership service will “disable” user's account by overriding Enrolment password. 签发注册证书后,会员服务将通过覆盖注册密码来“禁用”用户帐户。

In your example, when you send 'login' command to the same peer, this peer will check that user is registered and will not send any requests to Membership service. 在您的示例中,当您向同一对等方发送“ login”命令时,该对等方将检查用户是否已注册,并且不会向会员服务发送任何请求。

In configuration with multiple peers, user can login to one of them only. 在具有多个对等方的配置中,用户只能登录其中之一。 Second attempt to login via another peer will lead to: 第二次尝试通过另一个对等方登录将导致:

Error: Error on client login: roc error: code = 2 desc = Identity or token does not match.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM