# Probe DB privileges without SSH to data host $ErrorActionPreference = "Continue" $mysql = "C:\yutongda\tools\mysql-8.0.39-winx64\bin\mysql.exe" $psql = "C:\yutongda\tools\pgsql\bin\psql.exe" $rcli = "C:\yutongda\tools\redis-5.0.14.1\redis-cli.exe" $dbCred = Get-Content "C:\yutongda\secure\application-database-credentials.json" -Raw | ConvertFrom-Json $redisCred = Get-Content "C:\yutongda\secure\redis-credentials.json" -Raw | ConvertFrom-Json Write-Output "=== mysql grants/databases ===" & $mysql -h $dbCred.mysql_host -P $dbCred.mysql_port -u $dbCred.mysql_username "-p$($dbCred.mysql_password)" --connect-timeout=10 -e "SHOW GRANTS FOR CURRENT_USER(); SHOW DATABASES;" 2>&1 | Where-Object { $_ -notmatch 'Using a password' } | ForEach-Object { "$_" } Write-Output "=== pg roles/dbs ===" $env:PGPASSWORD = $dbCred.postgres_password $env:PGCONNECT_TIMEOUT = "10" & $psql -h $dbCred.postgres_host -p $dbCred.postgres_port -U $dbCred.postgres_username -d $dbCred.postgres_database -c "SELECT current_user, rolsuper, rolcreatedb FROM pg_roles WHERE rolname = current_user;" -c "SELECT datname FROM pg_database WHERE datname NOT LIKE 'template%' ORDER BY 1;" 2>&1 | ForEach-Object { "$_" } Write-Output "=== redis db1 ===" $out = & $rcli -h $redisCred.host -p $redisCred.port --user $redisCred.application_username -a $redisCred.application_password -n 1 --no-auth-warning PING 2>&1 "redis=$out" $out2 = & $rcli -h $redisCred.host -p $redisCred.port --user $redisCred.application_username -a $redisCred.application_password -n 1 --no-auth-warning SET "inquiry_robot:healthcheck" "ok" EX 60 2>&1 "redis_set=$out2" $out3 = & $rcli -h $redisCred.host -p $redisCred.port --user $redisCred.application_username -a $redisCred.application_password -n 1 --no-auth-warning GET "inquiry_robot:healthcheck" 2>&1 "redis_get=$out3" Write-Output "=== minio tools ===" Get-ChildItem "C:\yutongda\tools" -ErrorAction SilentlyContinue | Where-Object { $_.Name -match 'minio|mc|aws' } | Select-Object Name where.exe curl python --version 2>&1 & "C:\yutongda\tools\Python312\python.exe" --version 2>&1 Write-Output "PROBE2_DONE"