File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
solutions/standard-openshift/ansible
templates-ansible/deploy-openshift-cluster Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,16 @@ resource "terraform_data" "execute_playbooks" {
169169 ]
170170 }
171171
172+ # Again replace the API Key in any logs where it may have been included in plain text
173+ provisioner "remote-exec" {
174+ inline = [
175+ " APIKEY=\" ${ local . ibmcloud_api_key } \" " ,
176+ " grep -RIl -- \" $APIKEY\" \" /root\" | while IFS= read -r file; do" ,
177+ " sed -i 's/'\" $APIKEY\" '/***redacted***/g' \" $file\" " ,
178+ " done"
179+ ]
180+ }
181+
172182 # print output of openshift installation if applicable, else do nothing
173183 provisioner "remote-exec" {
174184 inline = [
@@ -273,6 +283,16 @@ resource "terraform_data" "execute_playbooks_with_vault" {
273283 ]
274284 }
275285
286+ # Again replace the API Key in any logs where it may have been included in plain text
287+ provisioner "remote-exec" {
288+ inline = [
289+ " APIKEY=\" ${ local . ibmcloud_api_key } \" " ,
290+ " grep -RIl -- \" $APIKEY\" \" /root\" | while IFS= read -r file; do" ,
291+ " sed -i 's/'\" $APIKEY\" '/***redacted***/g' \" $file\" " ,
292+ " done"
293+ ]
294+ }
295+
276296 # Again delete Ansible Vault password used to encrypt the var
277297 # files with sensitive information and private ssh key
278298 provisioner "remote-exec" {
Original file line number Diff line number Diff line change @@ -27,9 +27,17 @@ if [ $? -ne 0 ]; then
2727 if [ -f /root/.powervs/config.json ]; then ansible-vault encrypt /root/.powervs/config.json --vault-password-file password_file; fi
2828 rm -f password_file
2929 rm -rf $$ {ansible_private_key_file}
30+ # remove API Key from any logs where it may have been included in plain text
31+ grep -RIl -- " $IBMCLOUD_API_KEY " " /root" | while IFS= read -r file; do
32+ sed -i ' s/' " $IBMCLOUD_API_KEY " ' /***redacted***/g' " $file "
33+ done
3034 exit 1
3135fi
3236echo \" Playbook command successful\"
3337rm -rf $$ {ansible_private_key_file}
3438if [ -f /root/.powervs/config.json ]; then ansible-vault encrypt /root/.powervs/config.json --vault-password-file password_file; fi
3539rm -f password_file
40+ # remove API Key from any logs where it may have been included in plain text
41+ grep -RIl -- " $IBMCLOUD_API_KEY " " /root" | while IFS= read -r file; do
42+ sed -i ' s/' " $IBMCLOUD_API_KEY " ' /***redacted***/g' " $file "
43+ done
Original file line number Diff line number Diff line change @@ -27,9 +27,18 @@ if [ $? -ne 0 ]; then
2727 if [ -f /root/.powervs/config.json ]; then ansible-vault encrypt /root/.powervs/config.json --vault-password-file password_file; fi
2828 rm -f password_file
2929 rm -rf $$ {ansible_private_key_file}
30+ # remove API Key from any logs where it may have been included in plain text
31+ grep -RIl -- " $IBMCLOUD_API_KEY " " /root" | while IFS= read -r file; do
32+ sed -i ' s/' " $IBMCLOUD_API_KEY " ' /***redacted***/g' " $file "
33+ done
3034 exit 1
3135fi
3236echo \" Playbook command successful\"
3337rm -rf $$ {ansible_private_key_file}
3438if [ -f /root/.powervs/config.json ]; then ansible-vault encrypt /root/.powervs/config.json --vault-password-file password_file; fi
3539rm -f password_file
40+
41+ # remove API Key from any logs where it may have been included in plain text
42+ grep -RIl -- " $IBMCLOUD_API_KEY " " /root" | while IFS= read -r file; do
43+ sed -i ' s/' " $IBMCLOUD_API_KEY " ' /***redacted***/g' " $file "
44+ done
You can’t perform that action at this time.
0 commit comments