forked from hyperledgendary/fabric-kube-test-network
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enroll.sh
executable file
·53 lines (46 loc) · 1.8 KB
/
enroll.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
#
# Copyright contributors to the Hyperledgendary Kubernetes Test Network project
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -euo pipefail
. scripts/utils.sh
#
# Bind all org1 services to the "org1" namespace
#
export NAMESPACE=org1
#
# Save all of the organization enrollments in a local folder.
#
ENROLLMENTS_DIR=${PWD}/organizations/org1/enrollments
#
# Before we can work with the CA, extract the CA's TLS certificate and
# store in .pem format for access with client utilities.
#
write_pem ca .tls.cert $ENROLLMENTS_DIR/ca-tls-cert.pem
# Enroll the org1 admin user. Registration is performed by the operator according
# to entries in the org2-ca CRD.
enroll org1 org1admin org1adminpw
# create an msp config.yaml to indicate the user is an admin for the org
CA_CERT_NAME=org1-ca-ca-org1-localho-st-ca.pem
write_msp_config ca $CA_CERT_NAME $ENROLLMENTS_DIR/org1admin/msp
# Enroll the root CA administrator such that users can later be registered and enrolled for
# identities of transactions submitted to the ledger.
enroll org1 rcaadmin rcaadminpw
# Enroll a client user for submitting transactions through a gateway
# cliant application. This user has been registered at the CA in the
# bootstrap registrations by the operator.
enroll org1 org1user org1userpw