Files
inquiry_robot/deploy/_remote_try_data_ssh.ps1
T

16 lines
1003 B
PowerShell

$ErrorActionPreference = "Continue"
Write-Output "=== ssh data host with key ==="
$key = "$env:USERPROFILE\.ssh\id_ed25519_ytd"
if (-not (Test-Path $key)) { $key = "C:\Users\ytd_extdev_0903\.ssh\id_ed25519_ytd" }
"key=$key exists=$(Test-Path $key)"
ssh -i $key -o BatchMode=yes -o ConnectTimeout=8 -o StrictHostKeyChecking=accept-new ytd_extdev_0903@10.206.0.14 "whoami & hostname" 2>&1 | ForEach-Object { "$_" }
Write-Output "=== search root password keys in yml/env (names only) ==="
Get-ChildItem "C:\yutongda" -Recurse -Include *.yml,*.yaml,*.env,*.properties,*.json -ErrorAction SilentlyContinue -Depth 5 |
Select-String -Pattern "mysql.*root|spring.datasource.username:\s*root|MYSQL_ROOT|postgres.*super|CREATE DATABASE" -ErrorAction SilentlyContinue |
Select-Object -First 25 @{n='F';e={$_.Path}}, LineNumber, @{n='L';e={
$t=$_.Line.Trim(); if ($t -match 'password|passwd|secret') { 'REDACTED' } else { $t.Substring(0,[Math]::Min(100,$t.Length)) }
}}
Write-Output "ADMIN_SEARCH_DONE"