Skip to content

Commit be6dbe2

Browse files
committed
[FAB-7750] Documentation for FAB-5664
This change-set updates the documentation to describe the functionality introduced by FAB-5664 to tell apart fabric network nodes as clients and peers. Change-Id: Ifac62951c6c635c83ff5c88a4bb2e5c43bfdbd6f Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
1 parent ad5d0f7 commit be6dbe2

File tree

3 files changed

+96
-26
lines changed

3 files changed

+96
-26
lines changed

docs/source/endorsement-policies.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ boolean expressions over principals.
2525

2626
A principal is described in terms of the MSP that is tasked to validate
2727
the identity of the signer and of the role that the signer has within
28-
that MSP. Currently, two roles are supported: **member** and **admin**.
28+
that MSP. Four roles are supported: **member**, **admin**, **client**, and **peer**.
2929
Principals are described as ``MSP``.\ ``ROLE``, where ``MSP`` is the MSP
30-
ID that is required, and ``ROLE`` is either one of the two strings
31-
``member`` and ``admin``. Examples of valid principals are
30+
ID that is required, and ``ROLE`` is one of the four strings
31+
``member``, ``admin``, ``client`` and ``peer``. Examples of valid principals are
3232
``'Org0.admin'`` (any administrator of the ``Org0`` MSP) or
33-
``'Org1.member'`` (any member of the ``Org1`` MSP).
33+
``'Org1.member'`` (any member of the ``Org1`` MSP),
34+
``'Org1.client'`` (any client of the ``Org1`` MSP), and
35+
``'Org1.peer'`` (any peer of the ``Org1`` MSP).
3436

3537
The syntax of the language is:
3638

@@ -72,5 +74,14 @@ This command deploys chaincode ``mycc`` with the policy ``AND('Org1.member',
7274
'Org2.member')`` which would require that a member of both Org1 and Org2 sign
7375
the transaction.
7476

77+
Notice that, if the identity classification is enabled (see `MSP Documentation <http://hyperledger-fabric.readthedocs.io/en/latest/msp.html>`_),
78+
one can use the PEER role to restrict endorsement to only peers.
79+
80+
For example:
81+
82+
::
83+
84+
peer chaincode instantiate -C <channelid> -n mycc -P "AND('Org1.peer', 'Org2.peer')"
85+
7586
.. Licensed under Creative Commons Attribution 4.0 International License
7687
https://creativecommons.org/licenses/by/4.0/

docs/source/msp.rst

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,8 @@ and a file:
117117
CA's certificate
118118
3. (optional) a folder ``intermediatecerts`` to include PEM files each
119119
corresponding to an intermediate CA's certificate
120-
4. (optional) a file ``config.yaml`` to include information on the
121-
considered OUs; the latter are defined as pairs of
122-
``<Certificate, OrganizationalUnitIdentifier>`` entries of a yaml array
123-
called ``OrganizationalUnitIdentifiers``, where ``Certificate`` represents
124-
the relative path to the certificate of the certificate authority (root or
125-
intermediate) that should be considered for certifying members of this
126-
organizational unit (e.g. ./cacerts/cacert.pem), and
127-
``OrganizationalUnitIdentifier`` represents the actual string as
128-
expected to appear in X.509 certificate OU-field (e.g. "COP")
120+
4. (optional) a file ``config.yaml`` to configure the supported Organizational Units
121+
and identity classifications (see respective sections below).
129122
5. (optional) a folder ``crls`` to include the considered CRLs
130123
6. a folder ``keystore`` to include a PEM file with the node's signing key;
131124
we emphasise that currently RSA keys are not supported
@@ -154,6 +147,67 @@ the peer or orderer process is restarted. In subsequent releases we aim to
154147
offer online/dynamic reconfiguration (i.e. without requiring to stop the node
155148
by using a node managed system chaincode).
156149

150+
Organizational Units
151+
--------------------
152+
153+
In order to configure the list of Organizational Units that valid members of this MSP should
154+
include in their X.509 certificate, the ``config.yaml`` file
155+
needs to specify the organizational unit identifiers. Here is an example:
156+
157+
::
158+
159+
OrganizationalUnitIdentifiers:
160+
- Certificate: "cacerts/cacert1.pem"
161+
OrganizationalUnitIdentifier: "commercial"
162+
- Certificate: "cacerts/cacert2.pem"
163+
OrganizationalUnitIdentifier: "administrators"
164+
165+
The above example declares two organizational unit identifiers: **commercial** and **administrators**.
166+
An MSP identity is valid if it carries at least one of these organizational unit identifiers.
167+
The ``Certificate`` field refers to the CA or intermediate CA certificate path
168+
under which identities, having that specific OU, should be validated.
169+
The path is relative to the MSP root folder and cannot be empty.
170+
171+
Identity Classification
172+
-----------------------
173+
174+
The default MSP implementation allows to further classify identities into clients and peers, based on the OUs
175+
of their x509 certificates.
176+
An identity should be classified as a **client** if it submits transactions, queries peers, etc.
177+
An identity should be classified as a **peer** if it endorses or commits transactions.
178+
In order to define clients and peers of a given MSP, the ``config.yaml`` file
179+
needs to be set appropriately. Here is an example:
180+
181+
::
182+
183+
NodeOUs:
184+
Enable: true
185+
ClientOUIdentifier:
186+
Certificate: "cacerts/cacert.pem"
187+
OrganizationalUnitIdentifier: "client"
188+
PeerOUIdentifier:
189+
Certificate: "cacerts/cacert.pem"
190+
OrganizationalUnitIdentifier: "peer"
191+
192+
As shown above, the ``NodeOUs.Enable`` is set to ``true``, this enables the identify classification.
193+
Then, client (peer) identifiers are defined by setting the following properties
194+
for the ``NodeOUs.ClientOUIdentifier`` (``NodeOUs.PeerOUIdentifier``) key:
195+
a. ``OrganizationalUnitIdentifier``: Set this to the value that matches the OU that
196+
the x509 certificate of a client (peer) should contain.
197+
b. ``Certificate``: Set this to the CA or intermediate CA under which client (peer) identities
198+
should be validated. The field is relative to the MSP root folder. It can be empty, meaning
199+
that the identity's x509 certificate can be validated under any CA defined in the MSP configuration.
200+
201+
When the classification is enabled, MSP administrators need
202+
to be clients of that MSP, meaning that their x509 certificates need to carry
203+
the OU that identifies the clients.
204+
Notice also that, an identity can be either a client or a peer.
205+
The two classifications are mutually exclusive. If an identity is neither a client nor a peer,
206+
the validation will fail.
207+
208+
Finally, notice that for upgraded environments the 1.1 channel capability
209+
needs to be enabled before identify classification can be used.
210+
157211
Channel MSP setup
158212
-----------------
159213

docs/source/policies.rst

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -299,23 +299,28 @@ message defined as follows:
299299

300300
::
301301

302-
message MSPRole {
303-
string msp_identifier = 1;
302+
message MSPRole {
303+
string msp_identifier = 1;
304304

305-
enum MSPRoleType {
306-
MEMBER = 0; // Represents an MSP Member
307-
ADMIN = 1; // Represents an MSP Admin
308-
}
305+
enum MSPRoleType {
306+
MEMBER = 0; // Represents an MSP Member
307+
ADMIN = 1; // Represents an MSP Admin
308+
CLIENT = 2; // Represents an MSP Client
309+
PEER = 3; // Represents an MSP Peer
310+
}
309311

310-
MSPRoleType Role = 2;
311-
}
312+
MSPRoleType role = 2;
313+
}
312314

313315
The ``msp_identifier`` is set to the ID of the MSP (as defined by the
314-
MSPConfig proto in the channel configuration for an org) which will
315-
evaluate the signature, and the ``Role`` is set to either ``MEMBER`` or
316-
``ADMIN``. The ``MEMBER`` role will match any certificate issued by the
317-
MSP, while the ``ADMIN`` role will match only certificates which are
318-
enumerated as admin certificates in the MSP definition.
316+
``MSPConfig`` proto in the channel configuration for an org) which will
317+
evaluate the signature, and the ``Role`` is set to either ``MEMBER``,
318+
``ADMIN``, ``CLIENT`` or ``PEER``. In particular
319+
320+
1. ``MEMBER`` matches any certificate issued by the MSP.
321+
2. ``ADMIN`` matches certificates enumerated as admin in the MSP definition.
322+
3. ``CLIENT`` (``PEER``) matches certificates that carry the client (peer) Organizational unit
323+
(see `MSP Documentation <http://hyperledger-fabric.readthedocs.io/en/latest/msp.html>`_)
319324

320325
Constructing an ImplicitMetaPolicy
321326
----------------------------------

0 commit comments

Comments
 (0)