Skip to content

Commit 55feba1

Browse files
author
Keith Smith
committed
Update readthedocs to require csr.json on enroll
See https://jira.hyperledger.org/browse/FAB-1942 This updates the 2 enroll commands per description in fab-1942 and also fixes some formatting issues in appendix. Change-Id: I8cc80b99cb5534f660e9d6286b9926cbfa98e6b8 Signed-off-by: Keith Smith <[email protected]>
1 parent b10d4fd commit 55feba1

File tree

1 file changed

+86
-52
lines changed

1 file changed

+86
-52
lines changed

docs/Setup/ca-setup.md

+86-52
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ For the remainder of this server section, we assume that you have set the
6969

7070
#### Initializing the server
7171

72-
Initialize the Fabric CA server as follows:
72+
Initialize the Fabric CA server as follows:
7373

7474
```
7575
# fabric-ca server init CSR-JSON-FILE
@@ -100,6 +100,10 @@ you will be running your fabric-ca server.
100100

101101
All of the fields above pertain to the X.509 certificate which is generated
102102
by the `fabric server init` command as follows:
103+
104+
<a name="csr-fields"/>
105+
###### CSR fields
106+
103107
- **CN** is the Common Name
104108
- **keys** specifies the algorithm and key size as described below
105109
- **O** is the organization name
@@ -121,7 +125,7 @@ Algorithm (ECDSA) with curve `prime256v1` and signature algorithm
121125
`ecdsa-with-SHA256`:
122126
```
123127
"key": {
124-
"algo": "ecdsa"
128+
"algo": "ecdsa"
125129
"size": 256
126130
}
127131
```
@@ -292,13 +296,13 @@ of the following form to your fabric-ca server's configuration file:
292296
}
293297
```
294298

295-
where:
296-
* `scheme` is one of *ldap* or *ldaps*;
297-
* `adminDN` is the distinquished name of the admin user;
299+
where:
300+
* `scheme` is one of *ldap* or *ldaps*;
301+
* `adminDN` is the distinquished name of the admin user;
298302
* `pass` is the password of the admin user;
299-
* `host` is the hostname or IP address of the LDAP server;
300-
* `port` is the optional port number, where default 389 for *ldap* and 636 for *ldaps*;
301-
* `base` is the optional root of the LDAP tree to use for searches;
303+
* `host` is the hostname or IP address of the LDAP server;
304+
* `port` is the optional port number, where default 389 for *ldap* and 636 for *ldaps*;
305+
* `base` is the optional root of the LDAP tree to use for searches;
302306
* `filter` is a filter to use when searching to convert a login user name to
303307
a distinquished name. For example, a value of `(uid=%s)` searches for LDAP
304308
entries with the value of a `uid` attribute whose value is the login user name.
@@ -325,7 +329,7 @@ runs the LDAP tests in FABRIC_CA/cli/server/ldap/ldap_test.go, and stops the Ope
325329

326330
###### When LDAP is configured, attribute retrieval works as follows:
327331

328-
* A client SDK sends a request for a batch of tcerts **with one or more attributes** to the fabric-ca server.
332+
* A client SDK sends a request for a batch of tcerts **with one or more attributes** to the fabric-ca server.
329333
* The fabric-ca server receives the tcert request and does as follows:
330334
* extracts the enrollment ID from the token in the authorization header
331335
(after validating the token);
@@ -362,7 +366,7 @@ listen http-in
362366
server server3 hostname3:port
363367
```
364368

365-
<a name="fabric-ca-client"></a>
369+
<a name="fabric-ca-client"/>
366370
## Fabric CA Client
367371

368372
This section describes how to use the fabric-ca client.
@@ -391,19 +395,43 @@ In the examples in this document, the server's certificate is at
391395
`$HOME/fabric-ca/server/server-cert.pem`. The file name must
392396
match the name in the *client-config.json* file.
393397

398+
<a name="EnrollBootstrap"/>
394399
#### Enroll the bootstrap user
395400

396401
Unless the fabric-ca server is configured to use LDAP, it must
397402
be configured with at least one pre-registered bootstrap user.
398403
In the previous server-config.json in this document, that user
399404
has an enrollment ID of *admin* with an enrollment secret of *adminpw*.
400405

406+
<a name="csr-admin"/>
407+
First, create a CSR (Certificate Signing Request) JSON file similar to
408+
the following. Customize it as desired.
409+
410+
```
411+
{
412+
"key": { "algo": "ecdsa", "size": 256 },
413+
"names": [
414+
{
415+
"O": "Hyperledger Fabric",
416+
"OU": "Fabric CA",
417+
"L": "Raleigh",
418+
"ST": "North Carolina",
419+
"C": "US"
420+
}
421+
]
422+
}
423+
```
424+
425+
See [CSR fields](#csr-fields) for a description of the fields in this file.
426+
When enrolling, the CN (Common Name) field is automatically set to the enrollment ID
427+
which is *admin* in this example, so it can be omitted from the csr.json file.
428+
401429
The following command enrolls the admin user and stores an enrollment certificate (ECert)
402430
in the fabric-ca client's home directory.
403431

404432
```
405433
# export FABRIC_CA_HOME=$HOME/fabric-ca/clients/admin
406-
# fabric-ca client enroll -config client-config.json admin adminpw http://localhost:7054
434+
# fabric-ca client enroll -config client-config.json admin adminpw http://localhost:7054 csr.json
407435
```
408436

409437
You should see a message similar to `[INFO] enrollment information was successfully stored in`
@@ -428,7 +456,7 @@ In particular, the invoker's identity must have been registered with the attribu
428456
that the registrar is allowed to register.
429457

430458
For example, the attributes for a registrar might be as follows, indicating
431-
that this registrar identity can register peer, application, and user identities.
459+
that this registrar identity can register peer, application, and user identities.
432460

433461
```
434462
"attrs": [{"name":"hf.Registrar.Roles", "value":"peer,app,user"}]
@@ -477,7 +505,11 @@ Now that you have successfully registered a peer identity,
477505
you may now enroll the peer given the enrollment ID and secret
478506
(i.e. the *password* from the previous section).
479507

480-
This is similar to enrolling the bootstrap user previously except that
508+
First, create a CSR (Certificate Signing Request) JSON file similar to
509+
the one described in the [Enrolling the bootstrap user](#EnrollBootstrap) section.
510+
Name the file *csr.json* for the following example.
511+
512+
This is similar to enrolling the bootstrap user except that
481513
we also demonstrate how to use environment variables to place
482514
the key and certificate files in a specific location.
483515
The following example shows how to place them into a Hyperledger Fabric
@@ -486,17 +518,17 @@ The *MSP_DIR* environment variable refers to the root
486518
directory of MSP in Hyperledger Fabric and the $MSP_DIR/signcerts
487519
and $MSP_DIR/keystore directories must exist.
488520

489-
490-
Also note that you must replace *gHIexUckKpHz* with the secret which was
521+
Also note that you must replace *\<secret>* with the secret which was
491522
returned from the registration in the previous section.
492523

493524
```
494525
# export FABRIC_CA_CERT_FILE=$MSP_DIR/signcerts/peer.pem
495526
# export FABRIC_CA_KEY_FILE=$MSP_DIR/keystore/key.pem
496-
# fabric-ca client enroll -config client-config.json peer1 gHIexUckKpHz https://localhost:7054
527+
# fabric-ca client enroll -config client-config.json peer1 <secret> https://localhost:7054 csr.json
497528
```
498529

499-
The peer.pem and key.pem files should now exist at the specified locations.
530+
The peer.pem and key.pem files should now exist at the locations specified
531+
by the environment variables.
500532

501533
#### Revoke a certificate or user
502534

@@ -564,57 +596,59 @@ following Postgres documentation: https://www.postgresql.org/docs/9.4/static/lib
564596

565597
### MySQL SSL Configuration
566598
**Basic instructions for configuring SSL on MySQL server:**
599+
567600
1. Open or create my.cnf file for the server. Add or un-comment the lines below
568601
in [mysqld] section. These should point to the key and certificates for the
569602
server, and the root CA cert.
570603

571-
Instruction on creating server and client side certs:
604+
Instruction on creating server and client side certs:
572605
http://dev.mysql.com/doc/refman/5.7/en/creating-ssl-files-using-openssl.html
573606

574-
[mysqld]
575-
ssl-ca=ca-cert.pem
576-
ssl-cert=server-cert.pem
577-
ssl-key=server-key.pem
607+
[mysqld]
608+
ssl-ca=ca-cert.pem
609+
ssl-cert=server-cert.pem
610+
ssl-key=server-key.pem
578611

579-
Can run the following query to confirm SSL has been enabled.
612+
Can run the following query to confirm SSL has been enabled.
580613

581-
mysql> SHOW GLOBAL VARIABLES LIKE 'have_%ssl';
614+
mysql> SHOW GLOBAL VARIABLES LIKE 'have_%ssl';
582615

583-
Should see:
584-
```
585-
+---------------+-------+
586-
| Variable_name | Value |
587-
+---------------+-------+
588-
| have_openssl | YES |
589-
| have_ssl | YES |
590-
+---------------+-------+
591-
```
616+
Should see:
617+
618+
```
619+
+---------------+-------+
620+
| Variable_name | Value |
621+
+---------------+-------+
622+
| have_openssl | YES |
623+
| have_ssl | YES |
624+
+---------------+-------+
625+
```
592626

593627
2. After the server-side SSL configuration is finished, the next step is to
594628
create a user who has a privilege to access the MySQL server over SSL. For that,
595629
log in to the MySQL server, and type:
596630

597-
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ssluser'@'%' IDENTIFIED BY 'password' REQUIRE SSL;
598-
mysql> FLUSH PRIVILEGES;
631+
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ssluser'@'%' IDENTIFIED BY 'password' REQUIRE SSL;
632+
mysql> FLUSH PRIVILEGES;
599633

600-
If you want to give a specific ip address from which the user will access the
601-
server change the '%' to the specific ip address.
634+
If you want to give a specific ip address from which the user will access the
635+
server change the '%' to the specific ip address.
602636

603-
**MySQL Server - Require Client Certificates**
604-
Options for secure connections are similar to those used on the server side.
637+
**MySQL Server - Require Client Certificates**
638+
Options for secure connections are similar to those used on the server side.
605639

606-
- ssl-ca identifies the Certificate Authority (CA) certificate. This option,
607-
if used, must specify the same certificate used by the server.
608-
- ssl-cert identifies the client public key certificate.
609-
- ssl-key identifies the client private key.
640+
- ssl-ca identifies the Certificate Authority (CA) certificate. This option,
641+
if used, must specify the same certificate used by the server.
642+
- ssl-cert identifies the client public key certificate.
643+
- ssl-key identifies the client private key.
610644

611-
Suppose that you want to connect using an account that has no special encryption
612-
requirements or was created using a GRANT statement that includes the REQUIRE SSL
613-
option. As a recommended set of secure-connection options, start the MySQL
614-
server with at least --ssl-cert and --ssl-key, and invoke the fabric-ca server with
615-
**ca_certfiles** option set in the fabric-ca server file.
645+
Suppose that you want to connect using an account that has no special encryption
646+
requirements or was created using a GRANT statement that includes the REQUIRE SSL
647+
option. As a recommended set of secure-connection options, start the MySQL
648+
server with at least --ssl-cert and --ssl-key, and invoke the fabric-ca server with
649+
**ca_certfiles** option set in the fabric-ca server file.
616650

617-
To require that a client certificate also be specified, create the account using
618-
the REQUIRE X509 option. Then the client must also specify the proper client key
619-
and certificate files or the MySQL server will reject the connection. CA cert,
620-
client cert, and client key are all required for the fabric-ca server.
651+
To require that a client certificate also be specified, create the account using
652+
the REQUIRE X509 option. Then the client must also specify the proper client key
653+
and certificate files or the MySQL server will reject the connection. CA cert,
654+
client cert, and client key are all required for the fabric-ca server.

0 commit comments

Comments
 (0)