File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -1278,6 +1278,10 @@ function generate_vs_json() {
1278
1278
}
1279
1279
1280
1280
check_passwords_leak () {
1281
+ local secrets
1282
+ local passwords
1283
+ local pods
1284
+
1281
1285
secrets=$( kubectl_bin get secrets -o json | jq -r ' .items[].data | to_entries | .[] | select(.key | (contains("_PASSWORD"))) | .value' )
1282
1286
echo secrets=$secrets
1283
1287
@@ -1290,8 +1294,6 @@ check_passwords_leak() {
1290
1294
pods=$( kubectl_bin get pods -o name | awk -F " /" ' {print $2}' )
1291
1295
echo pods=$pods
1292
1296
1293
- TEMP_DIR=$( mktemp -d)
1294
-
1295
1297
collect_logs () {
1296
1298
NS=$1
1297
1299
for p in $pods ; do
@@ -1301,12 +1303,12 @@ check_passwords_leak() {
1301
1303
if [[ ${c} =~ " pmm" ]]; then
1302
1304
continue
1303
1305
fi
1304
- kubectl_bin -n " $NS " logs $p -c $c > ${TEMP_DIR } /logs_output-$p -$c .txt
1305
- echo logs saved in: ${TEMP_DIR } /logs_output-$p -$c .txt
1306
+ kubectl_bin -n " $NS " logs $p -c $c > ${tmp_dir } /logs_output-$p -$c .txt
1307
+ echo logs saved in: ${tmp_dir } /logs_output-$p -$c .txt
1306
1308
for pass in $passwords ; do
1307
- count=$( grep -c --fixed-strings -- " $pass " ${TEMP_DIR } /logs_output-$p -$c .txt || :)
1309
+ count=$( grep -c --fixed-strings -- " $pass " ${tmp_dir } /logs_output-$p -$c .txt || :)
1308
1310
if [[ $count != 0 ]]; then
1309
- echo leaked passwords are found in log ${TEMP_DIR } /logs_output-$p -$c .txt
1311
+ echo leaked passwords are found in log ${tmp_dir } /logs_output-$p -$c .txt
1310
1312
false
1311
1313
fi
1312
1314
done
You can’t perform that action at this time.
0 commit comments