Skip to content

Commit

Permalink
Use less strict permissions for channel genesis
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Dzikowski <jakub.t.dzikowski@gmail.com>
  • Loading branch information
dzikowski committed Dec 7, 2024
1 parent c430c74 commit 31f3529
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3181,11 +3181,14 @@ createChannelAndJoin() {
echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS"
echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH"
mkdir "$DIR_NAME" && cd "$DIR_NAME"
mkdir -p "$DIR_NAME" && cd "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb .
chmod a+rw "$CHANNEL_NAME".pb
osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}"
cd ..
rm -rf "$DIR_NAME"
}
Expand All @@ -3207,8 +3210,10 @@ createChannelAndJoinTls() {
echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH"
if [ ! -d "$DIR_NAME" ]; then
mkdir "$DIR_NAME"
mkdir -p "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME"
chmod a+rw "$DIR_NAME/$CHANNEL_NAME.pb"
fi
osnadmin channel join \\
Expand All @@ -3219,6 +3224,7 @@ createChannelAndJoinTls() {
--client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\
--ca-file "\${TLS_CA_CERT_PATH}"
cd ..
rm -rf "$DIR_NAME"
}
Expand All @@ -3239,11 +3245,14 @@ fetchChannelAndJoin() {
echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS"
echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH"
mkdir "$DIR_NAME" && cd "$DIR_NAME"
mkdir -p "$DIR_NAME" && cd "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}"
chmod a+rw "\${CHANNEL_NAME}"_newest.block
peer channel join -b "\${CHANNEL_NAME}"_newest.block
cd ..
rm -rf "$DIR_NAME"
}
Expand Down Expand Up @@ -3273,11 +3282,14 @@ fetchChannelAndJoinTls() {
echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE"
echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE"
mkdir "$DIR_NAME" && cd "$DIR_NAME"
mkdir -p "$DIR_NAME" && cd "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH"
chmod a+rw "\${CHANNEL_NAME}"_newest.block
peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH"
cd ..
rm -rf "$DIR_NAME"
}
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3206,11 +3206,14 @@ createChannelAndJoin() {
echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS"
echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH"
mkdir "$DIR_NAME" && cd "$DIR_NAME"
mkdir -p "$DIR_NAME" && cd "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb .
chmod a+rw "$CHANNEL_NAME".pb
osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}"
cd ..
rm -rf "$DIR_NAME"
}
Expand All @@ -3232,8 +3235,10 @@ createChannelAndJoinTls() {
echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH"
if [ ! -d "$DIR_NAME" ]; then
mkdir "$DIR_NAME"
mkdir -p "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME"
chmod a+rw "$DIR_NAME/$CHANNEL_NAME.pb"
fi
osnadmin channel join \\
Expand All @@ -3244,6 +3249,7 @@ createChannelAndJoinTls() {
--client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\
--ca-file "\${TLS_CA_CERT_PATH}"
cd ..
rm -rf "$DIR_NAME"
}
Expand All @@ -3264,11 +3270,14 @@ fetchChannelAndJoin() {
echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS"
echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH"
mkdir "$DIR_NAME" && cd "$DIR_NAME"
mkdir -p "$DIR_NAME" && cd "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}"
chmod a+rw "\${CHANNEL_NAME}"_newest.block
peer channel join -b "\${CHANNEL_NAME}"_newest.block
cd ..
rm -rf "$DIR_NAME"
}
Expand Down Expand Up @@ -3298,11 +3307,14 @@ fetchChannelAndJoinTls() {
echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE"
echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE"
mkdir "$DIR_NAME" && cd "$DIR_NAME"
mkdir -p "$DIR_NAME" && cd "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH"
chmod a+rw "\${CHANNEL_NAME}"_newest.block
peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH"
cd ..
rm -rf "$DIR_NAME"
}
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ createChannelAndJoin() {
echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS"
echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH"

mkdir "$DIR_NAME" && cd "$DIR_NAME"

mkdir -p "$DIR_NAME" && cd "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"

cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb .
chmod a+rw "$CHANNEL_NAME".pb

osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}"
cd ..
rm -rf "$DIR_NAME"
}

Expand All @@ -46,8 +48,10 @@ createChannelAndJoinTls() {
echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH"

if [ ! -d "$DIR_NAME" ]; then
mkdir "$DIR_NAME"
mkdir -p "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME"
chmod a+rw "$DIR_NAME/$CHANNEL_NAME.pb"
fi

osnadmin channel join \
Expand All @@ -58,6 +62,7 @@ createChannelAndJoinTls() {
--client-key "${ADMIN_TLS_PRIVATE_KEY}" \
--ca-file "${TLS_CA_CERT_PATH}"

cd ..
rm -rf "$DIR_NAME"
}

Expand All @@ -78,11 +83,14 @@ fetchChannelAndJoin() {
echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS"
echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH"

mkdir "$DIR_NAME" && cd "$DIR_NAME"
mkdir -p "$DIR_NAME" && cd "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"

peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}"
chmod a+rw "${CHANNEL_NAME}"_newest.block
peer channel join -b "${CHANNEL_NAME}"_newest.block

cd ..
rm -rf "$DIR_NAME"
}

Expand Down Expand Up @@ -112,10 +120,13 @@ fetchChannelAndJoinTls() {
echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE"
echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE"

mkdir "$DIR_NAME" && cd "$DIR_NAME"
mkdir -p "$DIR_NAME" && cd "$DIR_NAME"
chmod -R a+rw "$DIR_NAME"

peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH"
chmod a+rw "${CHANNEL_NAME}"_newest.block
peer channel join -b "${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH"

cd ..
rm -rf "$DIR_NAME"
}

0 comments on commit 31f3529

Please sign in to comment.