Move 150+ scripts from root and scripts/ into client/project directories: - clients/dataforth/scripts/ (110 files: AD2, sync, SSH, DB, DOS scripts) - clients/bg-builders/scripts/ (14 files: Lesley mgmt, Exchange, termination) - clients/internal-infrastructure/scripts/ (10 files: GDAP, Gitea, backups) - projects/msp-tools/scripts/ (9 files: CIPP, MSP onboarding, Datto) - projects/gururmm-agent/scripts/ (3 files: API test, JWT, record counts) - clients/glaztech/scripts/ (1 file: CentraStage removal) Also reorganized: - VPN scripts → infrastructure/vpn-configs/ - Retrieved API/JS files → api/ - Forum posts → projects/community-forum/forum-posts/ - SSH docs → clients/internal-infrastructure/docs/ - NWTOC/CTONW docs → projects/wrightstown-smarthome/docs/ - ACG website files → projects/internal/acg-website-2025/ - Dataforth docs → clients/dataforth/docs/ - schema-retrieved.sql → docs/database/ Deleted 24 tmp_*.ps1 one-off debug scripts (preserved in git history). Root reduced from 220+ files to 62 items (docs + directories only). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
105 lines
4.1 KiB
PowerShell
105 lines
4.1 KiB
PowerShell
# Reset Gitea password for mike@azcomputerguru.com via SSH
|
|
# Runs on Jupiter server (172.16.3.20)
|
|
|
|
$JupiterHost = "172.16.3.20"
|
|
$JupiterUser = "root"
|
|
$JupiterPassword = "Th1nk3r^99##"
|
|
|
|
Write-Host "=== Gitea Password Reset ===" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Prompt for new password
|
|
$NewPassword = Read-Host "Enter new Gitea password" -AsSecureString
|
|
$ConfirmPassword = Read-Host "Confirm password" -AsSecureString
|
|
|
|
# Convert to plain text for comparison
|
|
$NewPasswordPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
|
|
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($NewPassword))
|
|
$ConfirmPasswordPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
|
|
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($ConfirmPassword))
|
|
|
|
if ($NewPasswordPlain -ne $ConfirmPasswordPlain) {
|
|
Write-Host "[ERROR] Passwords do not match" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
if ([string]::IsNullOrWhiteSpace($NewPasswordPlain)) {
|
|
Write-Host "[ERROR] Password cannot be empty" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "[1] Connecting to Jupiter server..." -ForegroundColor Yellow
|
|
|
|
# Build SSH command to reset Gitea password in Docker container
|
|
$GiteaCommand = @"
|
|
# Find Gitea Docker container
|
|
echo '[1] Finding Gitea container...'
|
|
CONTAINER=`$(docker ps --filter 'name=gitea' --format '{{.Names}}' | head -n 1)
|
|
|
|
if [ -z "`$CONTAINER" ]; then
|
|
echo '[ERROR] Cannot find Gitea container'
|
|
echo 'Available containers:'
|
|
docker ps --format '{{.Names}}'
|
|
exit 1
|
|
fi
|
|
|
|
echo '[OK] Found container: '`$CONTAINER
|
|
echo ''
|
|
echo '[2] Resetting password for mike@azcomputerguru.com...'
|
|
|
|
# Execute gitea admin command inside container
|
|
# Try username 'mike' first, then email
|
|
docker exec `$CONTAINER gitea admin user change-password --username mike --password '$NewPasswordPlain' 2>&1 || \
|
|
docker exec `$CONTAINER gitea admin user change-password --username mike@azcomputerguru.com --password '$NewPasswordPlain' 2>&1
|
|
|
|
if [ `$? -eq 0 ]; then
|
|
echo ''
|
|
echo '[SUCCESS] Password changed successfully!'
|
|
exit 0
|
|
else
|
|
echo ''
|
|
echo '[ERROR] Failed to change password'
|
|
exit 1
|
|
fi
|
|
"@
|
|
|
|
# Execute via SSH using plink (or ssh if available)
|
|
try {
|
|
if (Get-Command plink -ErrorAction SilentlyContinue) {
|
|
# Use PuTTY's plink
|
|
$result = echo y | plink -ssh -batch -pw $JupiterPassword "$JupiterUser@$JupiterHost" $GiteaCommand 2>&1
|
|
} elseif (Get-Command ssh -ErrorAction SilentlyContinue) {
|
|
# Use OpenSSH
|
|
# Note: This will prompt for password interactively
|
|
Write-Host "[INFO] Using OpenSSH - you'll need to enter root password: $JupiterPassword" -ForegroundColor Yellow
|
|
$result = ssh "$JupiterUser@$JupiterHost" $GiteaCommand 2>&1
|
|
} else {
|
|
Write-Host "[ERROR] No SSH client found (plink or ssh)" -ForegroundColor Red
|
|
Write-Host ""
|
|
Write-Host "Manual steps:" -ForegroundColor Yellow
|
|
Write-Host "1. SSH to Jupiter: ssh root@172.16.3.20" -ForegroundColor Gray
|
|
Write-Host "2. Find container: docker ps | grep gitea" -ForegroundColor Gray
|
|
Write-Host "3. Reset password: docker exec <container_name> gitea admin user change-password --username mike --password 'YOUR_PASSWORD'" -ForegroundColor Gray
|
|
exit 1
|
|
}
|
|
|
|
Write-Host $result
|
|
|
|
Write-Host ""
|
|
Write-Host "=== Password Reset Complete ===" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "Login at: https://git.azcomputerguru.com/" -ForegroundColor Green
|
|
Write-Host "Username: mike@azcomputerguru.com (or just 'mike')" -ForegroundColor Green
|
|
Write-Host "Password: (the one you just set)" -ForegroundColor Green
|
|
|
|
} catch {
|
|
Write-Host ""
|
|
Write-Host "[ERROR] Failed to connect: $($_.Exception.Message)" -ForegroundColor Red
|
|
Write-Host ""
|
|
Write-Host "Manual alternative:" -ForegroundColor Yellow
|
|
Write-Host "1. SSH to Jupiter: ssh root@172.16.3.20 (password: $JupiterPassword)" -ForegroundColor Gray
|
|
Write-Host "2. Find Gitea container: docker ps | grep gitea" -ForegroundColor Gray
|
|
Write-Host "3. Reset password: docker exec <container_name> gitea admin user change-password --username mike --password 'YOUR_PASSWORD'" -ForegroundColor Gray
|
|
}
|