Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit ad47e6a

Browse files
committed
Updates to mask passwords
1 parent 332a3b9 commit ad47e6a

File tree

5 files changed

+19
-26
lines changed

5 files changed

+19
-26
lines changed

plugin_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ pluginType: STAGED
77
entryPoint: plugin_runner:plugin
88
srcDir: src
99
schemaFile: schema.json
10-
buildNumber: 1.69.7
10+
buildNumber: 1.69.8

src/resources/restore.sh

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,35 +57,30 @@ then
5757
BKUP_FILE="/tmp/dump_${SOURCEPORT}.sql"
5858
if [[ -f "${BKUP_FILE}" ]]
5959
then
60-
mv ${BKUP_FILE} ${BKUP_FILE}_${DT}
60+
#mv ${BKUP_FILE} ${BKUP_FILE}_${DT}
61+
rm ${BKUP_FILE}
6162
fi
6263

6364
#
6465
# Source Connection for Backup ...
6566
#
66-
log "Source Connection: ${SOURCECONN}"
67+
masklog "Source Connection: ${SOURCECONN}"
6768
RESULTS=$( buildConnectionString "${SOURCECONN}" "${SOURCEPASS}" "${SOURCEPORT}" "${SOURCEIP}" )
68-
log "${RESULTS}" | $DLPX_BIN_JQ --raw-output ".string"
69+
#log "${RESULTS}" | $DLPX_BIN_JQ --raw-output ".string"
6970
SOURCE_CONN=`echo "${RESULTS}" | $DLPX_BIN_JQ --raw-output ".string"`
70-
log "New Conn: ${SOURCE_CONN}"
71-
71+
masklog "New Conn: ${SOURCE_CONN}"
7272
log "Source Backup Host: ${SOURCEIP}"
7373

7474
###########################################################
7575
## On Source Server ...
76-
77-
#
7876
# Backup ...
79-
#
80-
log "Starting Backup ..."
77+
log "Starting Backup"
8178

8279
if [[ "1" == "0" ]]
8380
then
84-
8581
#
8682
# No Replication Backup ...
8783
#
88-
8984
SQL="SELECT schema_name FROM information_schema.schemata WHERE schema_name NOT IN"
9085
SQL="${SQL} ('mysql','information_schema','performance_schema')"
9186

@@ -102,27 +97,24 @@ then
10297
log "${INSTALL_BIN}/mysqldump ***** ${MYSQLDUMP_OPTIONS} --databases ${DBLIST}"
10398
${INSTALL_BIN}/mysqldump ${SOURCE_CONN} ${MYSQLDUMP_OPTIONS} --databases ${DBLIST} > ${BKUP_FILE}
10499

105-
else
106-
100+
else
107101
#
108102
# Create Backup File for Replication ...
109103
#
110-
111104
log "LogSync Enabled: ${LOGSYNC}"
112105
if [[ "${LOGSYNC}" == "true" ]]
113106
then
114-
log "Backup CMD: ${INSTALL_BIN}/mysqldump ${SOURCE_CONN} --all-databases --skip-lock-tables --single-transaction --flush-logs --hex-blob --master-data=2 -A"
107+
masklog "Backup CMD: ${INSTALL_BIN}/mysqldump ${SOURCE_CONN} --all-databases --skip-lock-tables --single-transaction --flush-logs --hex-blob --master-data=2 -A"
115108
##log "Backup CMD: ${INSTALL_BIN}/mysqldump ******** --all-databases --skip-lock-tables --single-transaction --flush-logs --hex-blob --master-data=2 -A > ${BKUP_FILE}"
116109
${INSTALL_BIN}/mysqldump ${SOURCE_CONN} --all-databases --skip-lock-tables --single-transaction --flush-logs --hex-blob --master-data=2 -A > ${BKUP_FILE}
117110
else
118-
log "Backup CMD: ${INSTALL_BIN}/mysqldump ${SOURCE_CONN} --all-databases --skip-lock-tables --single-transaction --flush-logs --hex-blob"
111+
masklog "Backup CMD: ${INSTALL_BIN}/mysqldump ${SOURCE_CONN} --all-databases --skip-lock-tables --single-transaction --flush-logs --hex-blob"
119112
##log "Backup CMD: ${INSTALL_BIN}/mysqldump ******** --all-databases --skip-lock-tables --single-transaction --flush-logs --hex-blob > ${BKUP_FILE}"
120113
${INSTALL_BIN}/mysqldump ${SOURCE_CONN} --all-databases --skip-lock-tables --single-transaction --flush-logs --hex-blob > ${BKUP_FILE}
121114
fi
122115

123116
fi
124117

125-
#
126118
# Verify Backup File Exists ...
127119
#
128120
FS=`du -s ${BKUP_FILE} 2>/dev/null`
@@ -138,8 +130,6 @@ then
138130
echo "Delphix Backup File: ${STAT}"
139131

140132
else # else if ${BACKUP_PATH} ...
141-
142-
143133
#
144134
# Customer Provided Backup File ...
145135
#
@@ -165,6 +155,7 @@ log "Environment: "
165155
export DLPX_LIBRARY_SOURCE=""
166156
export REPLICATION_PASS=""
167157
export STAGINGPASS=""
158+
export SOURCEPASS=""
168159
env | sort >>$DEBUG_LOG
169160
log "-- End --"
170161
exit 0

src/resources/restore_stage.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,15 @@ fi
358358
# Change Password for Staging Conn ...
359359
#
360360
CMD="${INSTALL_BIN}/mysql ${STAGING_CONN} --connect-expired-password -se \"ALTER USER 'root'@'localhost' IDENTIFIED BY ${STAGINGPASS};UPDATE mysql.user SET authentication_string=PASSWORD(${STAGINGPASS}) where USER='root';FLUSH PRIVILEGES;\""
361-
masklog "Final Command to Change Password is : ${CMD}"
361+
CMDFORLOG="${INSTALL_BIN}/mysql ${STAGING_CONN} --connect-expired-password -se \"ALTER USER 'root'@'localhost' IDENTIFIED BY '********';UPDATE mysql.user SET authentication_string=PASSWORD('********') where USER='root';FLUSH PRIVILEGES;\""
362+
masklog "Final Command to Change Password is : ${CMDFORLOG}"
362363

363364
eval ${CMD} 1>>${DEBUG_LOG} 2>&1
364365

365366
#
366367
# Update Staging Connection with supplied password ...
367368
#
368-
log "Staging Connection Prior to updaging password : ${STAGINGCONN}"
369+
masklog "Staging Connection Prior to updaging password : ${STAGINGCONN}"
369370
RESULTS=$( buildConnectionString "${STAGINGCONN}" "${STAGINGPASS}" "${STAGINGPORT}" "${STAGINGHOSTIP}" )
370371
echo "${RESULTS}" | $DLPX_BIN_JQ --raw-output ".string"
371372
STAGING_CONN=`echo "${RESULTS}" | $DLPX_BIN_JQ --raw-output ".string"`
@@ -546,6 +547,7 @@ log "Environment: "
546547
export DLPX_LIBRARY_SOURCE=""
547548
export REPLICATION_PASS=""
548549
export STAGINGPASS=""
550+
export SOURCEPASS=""
549551
env | sort >>$DEBUG_LOG
550552
log " <<<End"
551553
exit 0

src/resources/startStagedDB.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ printParams
2222

2323
# These passwords contain special characters so need to wrap in single / literal quotes ...
2424
STAGINGPASS=`echo "'"${STAGINGPASS}"'"`
25-
log "Staging Connection: ${STAGINGCONN}"
25+
masklog "Staging Connection: ${STAGINGCONN}"
2626
RESULTS=$( buildConnectionString "${STAGINGCONN}" "${STAGINGPASS}" "${STAGINGPORT}" )
2727
#log "${RESULTS}"
2828
STAGING_CONN=`echo "${RESULTS}" | $DLPX_BIN_JQ --raw-output ".string"`
29-
log "Staging Connection: ${STAGING_CONN}"
29+
masklog "Staging Connection: ${STAGING_CONN}"
3030

3131
#
3232
# Process Status ...

src/resources/stopStagedDB.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ fi
2424

2525
# These passwords contain special characters so need to wrap in single / literal quotes ...
2626
STAGINGPASS=`echo "'"${STAGINGPASS}"'"`
27-
log "Staging Connection: ${STAGINGCONN}"
27+
masklog "Staging Connection: ${STAGINGCONN}"
2828
RESULTS=$( buildConnectionString "${STAGINGCONN}" "${STAGINGPASS}" "${STAGINGPORT}" )
2929
#log "${RESULTS}"
3030
STAGING_CONN=`echo "${RESULTS}" | $DLPX_BIN_JQ --raw-output ".string"`
31-
log "Staging Connection: ${STAGING_CONN}"
31+
masklog "Staging Connection: ${STAGING_CONN}"
3232

3333
#
3434
# Get Process ...

0 commit comments

Comments
 (0)