chore(security): remove hard-coded SSH password from repo
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
# PowerShell script to copy SSH public key to remote server
|
||||
# Requires: PowerShell 5.1+ and .NET Framework
|
||||
|
||||
$remoteHost = "23.226.133.121"
|
||||
$remotePort = "10022"
|
||||
$remoteUser = "root"
|
||||
$remotePassword = "xaj2h4v17CRYF52BUa"
|
||||
$publicKeyPath = "$env:USERPROFILE\.ssh\id_rsa.pub"
|
||||
|
||||
# Read public key
|
||||
$publicKey = Get-Content $publicKeyPath -Raw
|
||||
|
||||
# Use plink if available, otherwise provide manual instructions
|
||||
$plink = Get-Command plink -ErrorAction SilentlyContinue
|
||||
|
||||
if ($plink) {
|
||||
Write-Host "Using plink to copy public key..."
|
||||
$cmd = "echo '$publicKey' | plink -P $remotePort -pw $remotePassword $remoteUser@$remoteHost `"mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys`""
|
||||
Invoke-Expression $cmd
|
||||
} else {
|
||||
Write-Host "plink not found. Please manually add the public key to the remote server:"
|
||||
Write-Host ""
|
||||
Write-Host "1. Login to the remote server:"
|
||||
Write-Host " ssh -p $remotePort $remoteUser@$remoteHost"
|
||||
Write-Host " (Password: $remotePassword)"
|
||||
Write-Host ""
|
||||
Write-Host "2. Create .ssh directory if not exists:"
|
||||
Write-Host " mkdir -p ~/.ssh && chmod 700 ~/.ssh"
|
||||
Write-Host ""
|
||||
Write-Host "3. Add the following public key to ~/.ssh/authorized_keys:"
|
||||
Write-Host " (create the file if not exists, and chmod 600 ~/.ssh/authorized_keys)"
|
||||
Write-Host ""
|
||||
Write-Host "Public key content:"
|
||||
Write-Host "=========================================="
|
||||
Write-Host $publicKey
|
||||
Write-Host "=========================================="
|
||||
Write-Host ""
|
||||
Write-Host "4. After adding, test with:"
|
||||
Write-Host " ssh -p $remotePort $remoteUser@$remoteHost"
|
||||
}
|
||||
Reference in New Issue
Block a user