Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code changes to remove sensitive data from log & bootnode.. #232

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aws/db/db-create-iam-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ else
if [ $? -ne 0 ]; then
SCRIPT_STATUS=36
fi
log "aws/db/db-create-iam-user.sh: .......... AWS_ACCESS_KEY_ID:DEPLOY_REGION $AWS_ACCESS_KEY_ID : $DEPLOY_REGION"
log "aws/db/db-create-iam-user.sh: .......... AWS_ACCESS_KEY_ID:DEPLOY_REGION : $DEPLOY_REGION"
# on successful completion of db-create-iam-user.sh, create a file
echo "COMPLETE" > /tmp/iam-user-created
chmod a+rw /tmp/iam-user-created
Expand Down
18 changes: 14 additions & 4 deletions aws/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ if [[ -n "$MAS_LICENSE_URL" ]]; then
else
log " MAS LICENSE URL file is not available."
fi
log "deploy.sh AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID"
#log "deploy.sh AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID"
if [[ -f "/tmp/iam-user-created" ]]; then
log "deploy.sh /tmp/iam-user-created exists; iam user creation skipped AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID..."
log "deploy.sh /tmp/iam-user-created exists; iam user creation skipped..."
else
## IAM
# Create IAM policy
Expand All @@ -84,7 +84,7 @@ else
accessdetails=$(aws iam create-access-key --user-name ${IAM_USER_NAME})
export AWS_ACCESS_KEY_ID=$(echo $accessdetails | jq '.AccessKey.AccessKeyId' | tr -d "\"")
export AWS_SECRET_ACCESS_KEY=$(echo $accessdetails | jq '.AccessKey.SecretAccessKey' | tr -d "\"")
log " AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID"
#log " AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID"
# on successful user and policy creation, create a file /tmp/iam-user-created
echo "COMPLETE" > /tmp/iam-user-created
chmod a+rw /tmp/iam-user-created
Expand Down Expand Up @@ -202,6 +202,16 @@ EOT
cd /tmp
zip -r $BACKUP_FILE_NAME mas-multicloud/*
set +e

# Remove sensitive data from mas-provisioning.log file before uploading it to s3 bucket.
cd /tmp/mas-multicloud
sed -i -e "/"kubeadmin"/d" mas-provisioning.log
sed -i -e "/pullSecret:/d" mas-provisioning.log
sed -i -e "/sshKey:/d" mas-provisioning.log

# Remove the license file, pull-secret file, & database certificate file
rm -rf db.crt entitlement.lic pull-secret.json

aws s3 cp $BACKUP_FILE_NAME $DEPLOYMENT_CONTEXT_UPLOAD_PATH --region $DEPLOY_REGION
retcode=$?
if [[ $retcode -ne 0 ]]; then
Expand Down Expand Up @@ -432,7 +442,7 @@ if [[ (-z $SLS_URL) || (-z $SLS_REGISTRATION_KEY) || (-z $SLS_PUB_CERT_URL) ]];
accessdetails=$(aws iam create-access-key --user-name ${IAM_USER_NAME_ROSA})
AWS_ACCESS_KEY_ID_ROSA=$(echo $accessdetails | jq '.AccessKey.AccessKeyId' | tr -d "\"")
AWS_SECRET_ACCESS_KEY_ROSA=$(echo $accessdetails | jq '.AccessKey.SecretAccessKey' | tr -d "\"")
log " AWS_ACCESS_KEY_ID_ROSA: $AWS_ACCESS_KEY_ID_ROSA"
#log " AWS_ACCESS_KEY_ID_ROSA: $AWS_ACCESS_KEY_ID_ROSA"
# Put some delay for IAM permissions to be applied in the backend
sleep 60
oc create secret generic "$SLS_INSTANCE_NAME"-aws-access --from-literal=aws_access_key_id="$AWS_ACCESS_KEY_ID_ROSA" --from-literal=aws_secret_access_key="$AWS_SECRET_ACCESS_KEY_ROSA" -n "$SLS_NAMESPACE"
Expand Down
9 changes: 9 additions & 0 deletions init.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can u please store kubeadmin in secretmanager .. this deletion is good

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will approve this ... but Kubeadmin need to be stored in secret manager

Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,15 @@ fi
# Delete temporary password files
rm -rf /tmp/*password*

# Remove sensitive data from mas-provisioning.log file before uploading it to s3 bucket.
cd $GIT_REPO_HOME
sed -i -e "/"kubeadmin"/d" mas-provisioning.log
sed -i -e "/pullSecret:/d" mas-provisioning.log
sed -i -e "/sshKey:/d" mas-provisioning.log

# Remove the license file, pull-secret file, & database certificate file
rm -rf db.crt entitlement.lic pull-secret.json

# Upload log file to object store
if [[ $CLUSTER_TYPE == "aws" ]]; then
# Upload the log file to s3
Expand Down
2 changes: 1 addition & 1 deletion mongo/docdb/docdb-create-iam-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ else
if [ $? -ne 0 ]; then
SCRIPT_STATUS=36
fi
log "mongo/docdb/docdb-create-iam-user.sh: .......... AWS_ACCESS_KEY_ID:DEPLOY_REGION $AWS_ACCESS_KEY_ID : $DEPLOY_REGION"
log "mongo/docdb/docdb-create-iam-user.sh: .......... AWS_ACCESS_KEY_ID:DEPLOY_REGION : $DEPLOY_REGION"
# on successful completion of docdb-create-iam-user.sh, create a file
echo "COMPLETE" > /tmp/iam-user-created
chmod a+rw /tmp/iam-user-created
Expand Down