Skip to content

Commit 7187ca0

Browse files
committed
[FAB-3306] cryptogen - copy admin certs to node MSPs
With the added security features, peers and orderers need to have admin certs in their local MSPs. Cyrptogen generates certs for admin users but was not placing them in the MSP folder for each of the peer and orderer nodes Change-Id: I6151a2b5d103c4caf38fa636f596674af87ab49f Signed-off-by: Gari Singh <[email protected]>
1 parent e4074ce commit 7187ca0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

common/tools/cryptogen/main.go

+22
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,17 @@ func generatePeerOrg(baseDir string, orgSpec OrgSpec) {
348348
orgName, err)
349349
os.Exit(1)
350350
}
351+
352+
// copy the admin cert to each of the org's peer's MSP admincerts
353+
for _, peerName := range peerNames {
354+
err = copyAdminCert(usersDir, filepath.Join(peersDir, peerName,
355+
"admincerts"), adminUserName)
356+
if err != nil {
357+
fmt.Printf("Error copying admin cert for org %s peer %s:\n%v\n",
358+
orgName, peerName, err)
359+
os.Exit(1)
360+
}
361+
}
351362
}
352363

353364
func copyAdminCert(usersDir, adminCertsDir, adminUserName string) error {
@@ -431,6 +442,17 @@ func generateOrdererOrg(baseDir string, orgSpec OrgSpec) {
431442
os.Exit(1)
432443
}
433444

445+
// copy the admin cert to each of the org's orderers's MSP admincerts
446+
for _, ordererName := range ordererNames {
447+
err = copyAdminCert(usersDir, filepath.Join(orderersDir, ordererName,
448+
"admincerts"), adminUserName)
449+
if err != nil {
450+
fmt.Printf("Error copying admin cert for org %s orderer %s:\n%v\n",
451+
orgName, ordererName, err)
452+
os.Exit(1)
453+
}
454+
}
455+
434456
}
435457

436458
func copyFile(src, dst string) error {

0 commit comments

Comments
 (0)