Infraestructura y Red:
- Tailscale v1.94.2 instalado en srv-dasu (IP: 100.116.210.36)
- Configurado como subnet router para 10.0.100.0/24
- Fix: Repositorios enterprise de Proxmox deshabilitados (.sources → .bak)
Despliegue del Sistema (pcv-dasu0):
- Transferencia SCP de runSysDasuten.zip via SSH puerto 7022
- Extracción en C:\Dasuten\runSysDasuten- Kermet.ini configurado: SERVER=sql-dasuten
- InstaladorComponentesKermet.exe (silent install)
- Fuentes TrueType registradas en Windows (Code39, I2OF5)
- Firewall TCP 1433 abierto en sql-dasuten
- Test-NetConnection: TcpTestSucceeded=True
- Login exitoso con usuario aalmiron ✅
ADN y Contexto:
- 05_ia.md: Regla 13 Auto-Contextualización Topológica
- 07_proyectos.md: Sección 'Topología y Red' obligatoria en manifiestos
- P2601_dasuten.md: Contexto de red documentado
- nodos/pcv-dasu0.md: Puerto SSH actualizado a 7022
Dashboard P2601:
- Hitos completados: 8 → 11 (P02.APP, NET01, TEST03)
- Progreso: 67% → 79%
- pcv-dasu0: Testing → Online
- Nuevo hito activo: UAT (verificación presencial)
Bitácoras y Documentación:
- Bitácora 04/03 y 05/03 completas
- Plan de despliegue en docs/plan/260305-1017
- Investigación de ingeniería inversa documentada
- ns8-candados: Instrucciones de uso para IA agregadas
- dtic-BITACORAs: CRUD completo, Dashboard P2601 integrado
Herramientas:
- w-zombi: Mejora anti-loop (max 5 ciclos)
- Payloads de despliegue SQL y sistema generados
116 lines
4.5 KiB
PowerShell
116 lines
4.5 KiB
PowerShell
$ErrorActionPreference = "Continue"
|
|
$ZOMBI_URL = "http://10.0.10.8:8000"
|
|
|
|
function Log($msg) {
|
|
$ts = Get-Date -Format "HH:mm:ss"
|
|
Write-Host "[$ts] $msg" -ForegroundColor Cyan
|
|
try { Invoke-RestMethod -Uri "$ZOMBI_URL/log" -Method Post -Body @{msg="[$env:COMPUTERNAME] $msg"} -UseBasicParsing -ErrorAction SilentlyContinue | Out-Null } catch {}
|
|
}
|
|
|
|
$DEST = "C:\SysDasuten"
|
|
$ZIP = "C:\TEMP\runSysDasuten.zip"
|
|
$SQL_SERVER = "sql-dasuten"
|
|
$SQL_DB = "sysdasuten"
|
|
|
|
Log "=========================================="
|
|
Log "DEPLOY SYSDASUTEN — $env:COMPUTERNAME"
|
|
Log "=========================================="
|
|
|
|
# --- PASO 1: Descargar ZIP ---
|
|
if (-not (Test-Path $DEST\Sistema\DasutenSQL.exe)) {
|
|
Log "PASO 1: Descargando runSysDasuten.zip (~268 MB)..."
|
|
New-Item -ItemType Directory -Path "C:\TEMP" -Force | Out-Null
|
|
try {
|
|
Invoke-WebRequest -Uri "$ZOMBI_URL/payloads/runSysDasuten.zip" -OutFile $ZIP -UseBasicParsing -ErrorAction Stop
|
|
Log "Descarga completada: $(((Get-Item $ZIP).Length / 1MB).ToString('N0')) MB"
|
|
} catch {
|
|
Log "ERROR descarga: $($_.Exception.Message)"
|
|
return
|
|
}
|
|
|
|
# --- PASO 2: Extraer ---
|
|
Log "PASO 2: Extrayendo a $DEST..."
|
|
New-Item -ItemType Directory -Path $DEST -Force | Out-Null
|
|
Expand-Archive -Path $ZIP -DestinationPath "C:\" -Force
|
|
# El zip contiene runSysDasuten/ como raiz, renombrar
|
|
if (Test-Path "C:\runSysDasuten") {
|
|
Copy-Item -Path "C:\runSysDasuten\*" -Destination $DEST -Recurse -Force
|
|
Remove-Item "C:\runSysDasuten" -Recurse -Force
|
|
}
|
|
Remove-Item $ZIP -Force -ErrorAction SilentlyContinue
|
|
Log "Extraido OK."
|
|
} else {
|
|
Log "PASO 1-2: SKIP — Ya existe $DEST\Sistema\DasutenSQL.exe"
|
|
}
|
|
|
|
# --- PASO 3: Modificar Kermet.ini ---
|
|
Log "PASO 3: Configurando Kermet.ini..."
|
|
$iniPaths = @("$DEST\Kermet.ini", "$DEST\Sistema\Kermet.ini")
|
|
foreach ($ini in $iniPaths) {
|
|
if (Test-Path $ini) {
|
|
$content = Get-Content $ini -Raw
|
|
$content = $content -replace 'SERVER=srvFENIX', "SERVER=$SQL_SERVER"
|
|
$content = $content -replace 'SERVER=172\.16\.9\.204\\SQL2017', "SERVER=$SQL_SERVER"
|
|
Set-Content $ini $content -Force
|
|
Log "Actualizado: $ini -> SERVER=$SQL_SERVER"
|
|
}
|
|
}
|
|
|
|
# --- PASO 4: Instalar Fuentes ---
|
|
Log "PASO 4: Instalando fuentes..."
|
|
$fontDir = "$DEST\Fonts\Fonts"
|
|
if (Test-Path $fontDir) {
|
|
$shell = New-Object -ComObject Shell.Application
|
|
$fontsFolder = $shell.NameSpace(0x14) # Windows Fonts folder
|
|
Get-ChildItem "$fontDir\*.ttf" | ForEach-Object {
|
|
$fontPath = $_.FullName
|
|
$fontName = $_.Name
|
|
if (-not (Test-Path "C:\Windows\Fonts\$fontName")) {
|
|
Copy-Item $fontPath "C:\Windows\Fonts\" -Force
|
|
$regKey = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"
|
|
New-ItemProperty -Path $regKey -Name $fontName -Value $fontName -PropertyType String -Force | Out-Null
|
|
Log "Fuente instalada: $fontName"
|
|
} else {
|
|
Log "Fuente ya existe: $fontName"
|
|
}
|
|
}
|
|
} else {
|
|
Log "WARN: No se encontro directorio de fuentes"
|
|
}
|
|
|
|
# --- PASO 5: Verificar firewall SQL en sql-dasuten ---
|
|
Log "PASO 5: Probando conectividad SQL..."
|
|
$tcpTest = Test-NetConnection -ComputerName $SQL_SERVER -Port 1433 -WarningAction SilentlyContinue
|
|
if ($tcpTest.TcpTestSucceeded) {
|
|
Log "Conexion TCP a ${SQL_SERVER}:1433 OK"
|
|
} else {
|
|
Log "WARN: No se puede conectar a ${SQL_SERVER}:1433 — verificar firewall"
|
|
}
|
|
|
|
# --- PASO 6: Probar conexion SQL con sqlcmd (si existe) ---
|
|
$sqlcmd = Get-Command sqlcmd -ErrorAction SilentlyContinue
|
|
if ($sqlcmd) {
|
|
Log "PASO 6: Probando SQL con sqlcmd..."
|
|
$result = sqlcmd -S $SQL_SERVER -E -Q "SELECT DB_NAME() AS db_actual; SELECT name FROM sys.databases WHERE name = '$SQL_DB'" -W 2>&1
|
|
Log "SQL Result: $result"
|
|
} else {
|
|
Log "PASO 6: SKIP — sqlcmd no disponible (normal en Win10), probar con DasutenSQL.exe"
|
|
}
|
|
|
|
# --- PASO 7: Crear acceso directo ---
|
|
Log "PASO 7: Creando acceso directo en Escritorio..."
|
|
$desktopPath = [Environment]::GetFolderPath('CommonDesktopDirectory')
|
|
$shortcutPath = "$desktopPath\DasutenSQL.lnk"
|
|
$WshShell = New-Object -ComObject WScript.Shell
|
|
$shortcut = $WshShell.CreateShortcut($shortcutPath)
|
|
$shortcut.TargetPath = "$DEST\Sistema\DasutenSQL.exe"
|
|
$shortcut.WorkingDirectory = "$DEST\Sistema"
|
|
$shortcut.Description = "Sistema DASUTEN"
|
|
$shortcut.Save()
|
|
Log "Acceso directo creado: $shortcutPath"
|
|
|
|
Log "=========================================="
|
|
Log "DEPLOY SYSDASUTEN COMPLETADO"
|
|
Log "Ejecutar desde: $DEST\Sistema\DasutenSQL.exe"
|
|
Log "=========================================="
|