[Core/Infra] Provisionamiento SSH en pc-dasu0 y unificación Nginx tailscale
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
function Log($msg) {
|
||||
Write-Host $msg -ForegroundColor Cyan
|
||||
if ($WZ_HOST) {
|
||||
try {
|
||||
Invoke-RestMethod -Uri "http://${WZ_HOST}/log" -Method Post -Body @{msg=$msg} -UseBasicParsing -ErrorAction SilentlyContinue | Out-Null
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
Log "=========================================="
|
||||
Log " REPARANDO PERMISOS E INICIANDO SSHD "
|
||||
Log "=========================================="
|
||||
|
||||
Log "1) Bypass ExecutionPolicy para FixHostFilePermissions..."
|
||||
try {
|
||||
# Cambiamos la politica solo para este proceso
|
||||
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
|
||||
$out = & "C:\OpenSSH-Win64\FixHostFilePermissions.ps1" -Confirm:$false 2>&1
|
||||
foreach ($line in $out) { Log " -> $line" }
|
||||
Log "Script de permisos finalizado."
|
||||
} catch {
|
||||
Log "Error ejecutando script de permisos: $_"
|
||||
}
|
||||
|
||||
Log "2) Iniciando servicio sshd..."
|
||||
try {
|
||||
Start-Service sshd -ErrorAction Stop
|
||||
$svc = Get-Service sshd
|
||||
Log "Servicio sshd. Estado actual: $($svc.Status) !!"
|
||||
} catch {
|
||||
Log "Fallo al iniciar el servicio: $_"
|
||||
Log "Ejecutando sshd.exe -t para ver el error real de config:"
|
||||
$test = & "C:\OpenSSH-Win64\sshd.exe" -t 2>&1
|
||||
foreach ($line in $test) { Log " sshd -t: $line" }
|
||||
}
|
||||
|
||||
Log "=========================================="
|
||||
Log " FIN REPARACION "
|
||||
Log "=========================================="
|
||||
return
|
||||
Reference in New Issue
Block a user