Skip to content

Commit

Permalink
[FAB-3306] cryptogen - copy admin certs to node MSPs
Browse files Browse the repository at this point in the history
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 <gari.r.singh@gmail.com>
  • Loading branch information
mastersingh24 committed Apr 21, 2017
1 parent e4074ce commit 7187ca0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions common/tools/cryptogen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,17 @@ func generatePeerOrg(baseDir string, orgSpec OrgSpec) {
orgName, err)
os.Exit(1)
}

// copy the admin cert to each of the org's peer's MSP admincerts
for _, peerName := range peerNames {
err = copyAdminCert(usersDir, filepath.Join(peersDir, peerName,
"admincerts"), adminUserName)
if err != nil {
fmt.Printf("Error copying admin cert for org %s peer %s:\n%v\n",
orgName, peerName, err)
os.Exit(1)
}
}
}

func copyAdminCert(usersDir, adminCertsDir, adminUserName string) error {
Expand Down Expand Up @@ -431,6 +442,17 @@ func generateOrdererOrg(baseDir string, orgSpec OrgSpec) {
os.Exit(1)
}

// copy the admin cert to each of the org's orderers's MSP admincerts
for _, ordererName := range ordererNames {
err = copyAdminCert(usersDir, filepath.Join(orderersDir, ordererName,
"admincerts"), adminUserName)
if err != nil {
fmt.Printf("Error copying admin cert for org %s orderer %s:\n%v\n",
orgName, ordererName, err)
os.Exit(1)
}
}

}

func copyFile(src, dst string) error {
Expand Down

0 comments on commit 7187ca0

Please sign in to comment.