Skip to content

Commit

Permalink
Merge branch 'main' into CLOUD-808
Browse files Browse the repository at this point in the history
  • Loading branch information
ptankov authored Oct 17, 2023
2 parents 91eb427 + 2b38a1f commit b2bfe78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
17 changes: 11 additions & 6 deletions e2e-tests/functions
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,10 @@ function generate_vs_json() {
}

check_passwords_leak() {
local secrets
local passwords
local pods

secrets=$(kubectl_bin get secrets -o json | jq -r '.items[].data | to_entries | .[] | select(.key | (contains("_PASSWORD"))) | .value')
echo secrets=$secrets

Expand All @@ -1289,9 +1293,10 @@ check_passwords_leak() {
pods=$(kubectl_bin get pods -o name | awk -F "/" '{print $2}')
echo pods=$pods

TEMP_DIR=$(mktemp -d)

collect_logs() {
local containers
local count

NS=$1
for p in $pods; do
containers=$(kubectl_bin -n "$NS" get pod $p -o jsonpath='{.spec.containers[*].name}')
Expand All @@ -1300,12 +1305,12 @@ check_passwords_leak() {
if [[ ${c} =~ "pmm" ]]; then
continue
fi
kubectl_bin -n "$NS" logs $p -c $c >${TEMP_DIR}/logs_output-$p-$c.txt
echo logs saved in: ${TEMP_DIR}/logs_output-$p-$c.txt
kubectl_bin -n "$NS" logs $p -c $c >${tmp_dir}/logs_output-$p-$c.txt
echo logs saved in: ${tmp_dir}/logs_output-$p-$c.txt
for pass in $passwords; do
count=$(grep -c --fixed-strings -- "$pass" ${TEMP_DIR}/logs_output-$p-$c.txt || :)
count=$(grep -c --fixed-strings -- "$pass" ${tmp_dir}/logs_output-$p-$c.txt || :)
if [[ $count != 0 ]]; then
echo leaked passwords are found in log ${TEMP_DIR}/logs_output-$p-$c.txt
echo leaked passwords are found in log ${tmp_dir}/logs_output-$p-$c.txt
false
fi
done
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests/monitoring-2-0/run
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ desc 'install PMM Server'

deploy_pmm_server
sleep 20
SERVICE="postgres"
until kubectl_bin exec monitoring-0 -- bash -c "pgrep -x $SERVICE >/dev/null"; do
until kubectl_bin exec monitoring-0 -- bash -c "ls -l /proc/*/exe 2>/dev/null| grep postgres >/dev/null"; do
echo "Retry $retry"
sleep 5
let retry+=1
Expand Down

0 comments on commit b2bfe78

Please sign in to comment.