in setup/setup_fabric_environment.py [0:0]
def obtain_admin_cert():
print("Creating Admin Certificate")
print("--------------------------------------------------------")
print("Please enter your Admin password. Default password is 'Admin123'. :")
adminPass = input()
if len(adminPass) == 0:
adminPass = "Admin123"
binaryLocation="fabric-ca-client"
# Check if we can find the hardcoded path, if so, use it. Otherwise, let the os find it in $PATH
if os.path.exists("/home/ec2-user/go/src/github.com/hyperledger/fabric-ca/bin/fabric-ca-client") == True:
binaryLocation="/home/ec2-user/go/src/github.com/hyperledger/fabric-ca/bin/fabric-ca-client"
command = [binaryLocation, "enroll"
, "-u", "https://" + memberDetails['Member']['FrameworkAttributes']['Fabric']['AdminUsername'] + ":" + adminPass + "@" + memberDetails['Member']['FrameworkAttributes']['Fabric']['CaEndpoint']
, "--tls.certfiles", "/home/ec2-user/managedblockchain-tls-chain.pem"
, "-M", "/home/ec2-user/admin-msp"]
try:
print ("Executing: " + ' '.join(command))
subprocess.check_output(command, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
print ("Failed to generate Admin Certificate! Please check output.")
print (e)
sys.exit()
#Delete admin certs dir because we are going to create it.
shutil.rmtree(expanduser("~") + "/admin-msp/admincerts", ignore_errors=True)
#Now we have to fix up the certs a bit
shutil.copytree(expanduser("~") + "/admin-msp/signcerts", expanduser("~") + "/admin-msp/admincerts")
print("--------------------------------------------------------")
print("Completed generating Admin Certificate. This certificate is used for admin operations such as channel creation, or creation of other identity certificates.")
input("Press enter to continue.")