@@ -69,7 +69,7 @@ For the remainder of this server section, we assume that you have set the
69
69
70
70
#### Initializing the server
71
71
72
- Initialize the Fabric CA server as follows:
72
+ Initialize the Fabric CA server as follows:
73
73
74
74
```
75
75
# fabric-ca server init CSR-JSON-FILE
@@ -100,6 +100,10 @@ you will be running your fabric-ca server.
100
100
101
101
All of the fields above pertain to the X.509 certificate which is generated
102
102
by the ` fabric server init ` command as follows:
103
+
104
+ <a name =" csr-fields " />
105
+ ###### CSR fields
106
+
103
107
- ** CN** is the Common Name
104
108
- ** keys** specifies the algorithm and key size as described below
105
109
- ** O** is the organization name
@@ -121,7 +125,7 @@ Algorithm (ECDSA) with curve `prime256v1` and signature algorithm
121
125
` ecdsa-with-SHA256 ` :
122
126
```
123
127
"key": {
124
- "algo": "ecdsa"
128
+ "algo": "ecdsa"
125
129
"size": 256
126
130
}
127
131
```
@@ -292,13 +296,13 @@ of the following form to your fabric-ca server's configuration file:
292
296
}
293
297
```
294
298
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;
298
302
* ` 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;
302
306
* ` filter ` is a filter to use when searching to convert a login user name to
303
307
a distinquished name. For example, a value of ` (uid=%s) ` searches for LDAP
304
308
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
325
329
326
330
###### When LDAP is configured, attribute retrieval works as follows:
327
331
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.
329
333
* The fabric-ca server receives the tcert request and does as follows:
330
334
* extracts the enrollment ID from the token in the authorization header
331
335
(after validating the token);
@@ -362,7 +366,7 @@ listen http-in
362
366
server server3 hostname3:port
363
367
```
364
368
365
- <a name =" fabric-ca-client " ></ a >
369
+ <a name =" fabric-ca-client " / >
366
370
## Fabric CA Client
367
371
368
372
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
391
395
` $HOME/fabric-ca/server/server-cert.pem ` . The file name must
392
396
match the name in the * client-config.json* file.
393
397
398
+ <a name =" EnrollBootstrap " />
394
399
#### Enroll the bootstrap user
395
400
396
401
Unless the fabric-ca server is configured to use LDAP, it must
397
402
be configured with at least one pre-registered bootstrap user.
398
403
In the previous server-config.json in this document, that user
399
404
has an enrollment ID of * admin* with an enrollment secret of * adminpw* .
400
405
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
+
401
429
The following command enrolls the admin user and stores an enrollment certificate (ECert)
402
430
in the fabric-ca client's home directory.
403
431
404
432
```
405
433
# 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
407
435
```
408
436
409
437
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
428
456
that the registrar is allowed to register.
429
457
430
458
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.
432
460
433
461
```
434
462
"attrs": [{"name":"hf.Registrar.Roles", "value":"peer,app,user"}]
@@ -477,7 +505,11 @@ Now that you have successfully registered a peer identity,
477
505
you may now enroll the peer given the enrollment ID and secret
478
506
(i.e. the * password* from the previous section).
479
507
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
481
513
we also demonstrate how to use environment variables to place
482
514
the key and certificate files in a specific location.
483
515
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
486
518
directory of MSP in Hyperledger Fabric and the $MSP_DIR/signcerts
487
519
and $MSP_DIR/keystore directories must exist.
488
520
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
491
522
returned from the registration in the previous section.
492
523
493
524
```
494
525
# export FABRIC_CA_CERT_FILE=$MSP_DIR/signcerts/peer.pem
495
526
# 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
497
528
```
498
529
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.
500
532
501
533
#### Revoke a certificate or user
502
534
@@ -564,57 +596,59 @@ following Postgres documentation: https://www.postgresql.org/docs/9.4/static/lib
564
596
565
597
### MySQL SSL Configuration
566
598
** Basic instructions for configuring SSL on MySQL server:**
599
+
567
600
1 . Open or create my.cnf file for the server. Add or un-comment the lines below
568
601
in [ mysqld] section. These should point to the key and certificates for the
569
602
server, and the root CA cert.
570
603
571
- Instruction on creating server and client side certs:
604
+ Instruction on creating server and client side certs:
572
605
http://dev.mysql.com/doc/refman/5.7/en/creating-ssl-files-using-openssl.html
573
606
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
578
611
579
- Can run the following query to confirm SSL has been enabled.
612
+ Can run the following query to confirm SSL has been enabled.
580
613
581
- mysql> SHOW GLOBAL VARIABLES LIKE 'have_ %ssl';
614
+ mysql> SHOW GLOBAL VARIABLES LIKE 'have_ %ssl';
582
615
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
+ ```
592
626
593
627
2 . After the server-side SSL configuration is finished, the next step is to
594
628
create a user who has a privilege to access the MySQL server over SSL. For that,
595
629
log in to the MySQL server, and type:
596
630
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;
599
633
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.
602
636
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.
605
639
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.
610
644
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.
616
650
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