@letitbexai_root/lexxit-automation-framework 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -237,8 +237,50 @@ New-NetFirewallRule -DisplayName "Lexxit Agent" -Direction Inbound -Protocol TCP
|
|
|
237
237
|
Write-Host "[lexxit] Installing TightVNC..."
|
|
238
238
|
$tvncMsi = Join-Path $env:TEMP "tightvnc.msi"
|
|
239
239
|
Invoke-WebRequest -Uri $TightVncMsiUrl -OutFile $tvncMsi -UseBasicParsing
|
|
240
|
+
|
|
241
|
+
# Confirmed on a real Windows EC2 AMI: REINSTALL=ALL + REINSTALLMODE=vomus
|
|
242
|
+
# (tried first, see git history) does NOT reliably make TightVNC's MSI
|
|
243
|
+
# reapply VALUE_OF_PASSWORD on top of an already-installed copy - verified
|
|
244
|
+
# by decrypting the backend's actual stored password for a freshly
|
|
245
|
+
# re-registered agent and running it through the real VNC auth handshake
|
|
246
|
+
# directly: still rejected, even with REINSTALLMODE=vomus on the reinstall
|
|
247
|
+
# that supposedly set it. TightVNC's password-setting custom action
|
|
248
|
+
# evidently gates on something REINSTALLMODE doesn't override. An explicit
|
|
249
|
+
# uninstall first removes that "already installed" state entirely, so the
|
|
250
|
+
# following /i is always a genuine fresh install, which does apply every
|
|
251
|
+
# property correctly. /x against the same MSI package is a no-op (not an
|
|
252
|
+
# error) when TightVNC isn't installed yet, so this is safe on every run.
|
|
253
|
+
#
|
|
254
|
+
# Both steps below check msiexec's exit code and wait for the service to
|
|
255
|
+
# actually disappear/reappear rather than just firing /x then /i back to
|
|
256
|
+
# back and trusting it. Found the hard way on a real VM: a `msiexec /i`
|
|
257
|
+
# that reports exit code 0 does not guarantee the tvnserver service
|
|
258
|
+
# actually got registered - after enough uninstall/reinstall churn, Windows
|
|
259
|
+
# Installer's own service-management custom actions (InstallServices/
|
|
260
|
+
# RegService/StartService) can silently no-op while the outer process still
|
|
261
|
+
# exits 0, leaving TightVNC uninstalled and NOTHING listening on 5900 (worse
|
|
262
|
+
# than the wrong-password bug this was meant to fix, and invisible under
|
|
263
|
+
# /quiet with no exit-code or service check). A reboot reliably clears
|
|
264
|
+
# whatever Windows-side state causes this; the exit-code and service-wait
|
|
265
|
+
# checks here exist so a silent failure throws loudly instead of leaving a
|
|
266
|
+
# half-broken agent that looks like it installed fine. /l*v below logs the
|
|
267
|
+
# full MSI trace to %TEMP%\tvnc_install.log for exactly this class of
|
|
268
|
+
# "exit 0 but nothing happened" failure, next time it needs debugging.
|
|
269
|
+
$uninstallResult = Start-Process msiexec.exe -ArgumentList @("/x", "`"$tvncMsi`"", "/quiet", "/norestart") -Wait -NoNewWindow -PassThru
|
|
270
|
+
# 1605 = ERROR_UNKNOWN_PRODUCT - not installed yet, not a failure.
|
|
271
|
+
if ($uninstallResult.ExitCode -ne 0 -and $uninstallResult.ExitCode -ne 1605) {
|
|
272
|
+
Write-Warning "[lexxit] TightVNC uninstall returned exit code $($uninstallResult.ExitCode) - continuing, but the reinstall below may fail too."
|
|
273
|
+
}
|
|
274
|
+
$waited = 0
|
|
275
|
+
while ((Get-Service tvnserver -ErrorAction SilentlyContinue) -and $waited -lt 30) {
|
|
276
|
+
Start-Sleep -Seconds 1
|
|
277
|
+
$waited++
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
$tvncLogPath = Join-Path $env:TEMP "tvnc_install.log"
|
|
240
281
|
$msiArgs = @(
|
|
241
282
|
"/i", "`"$tvncMsi`"", "/quiet", "/norestart",
|
|
283
|
+
"/l*v", "`"$tvncLogPath`"",
|
|
242
284
|
"ADDLOCAL=Server",
|
|
243
285
|
"SERVER_REGISTER_AS_SERVICE=1",
|
|
244
286
|
"SERVER_ADD_FIREWALL_EXCEPTION=1",
|
|
@@ -274,7 +316,18 @@ $msiArgs = @(
|
|
|
274
316
|
# way: a real VM's live view broke from exactly this gap.
|
|
275
317
|
"REINSTALL=ALL", "REINSTALLMODE=vomus"
|
|
276
318
|
)
|
|
277
|
-
Start-Process msiexec.exe -ArgumentList $msiArgs -Wait -NoNewWindow
|
|
319
|
+
$installResult = Start-Process msiexec.exe -ArgumentList $msiArgs -Wait -NoNewWindow -PassThru
|
|
320
|
+
if ($installResult.ExitCode -ne 0) {
|
|
321
|
+
throw "[lexxit] TightVNC install failed with exit code $($installResult.ExitCode) - msiexec /i did not succeed, nothing is listening on 5900. Check $tvncLogPath for details."
|
|
322
|
+
}
|
|
323
|
+
$waited = 0
|
|
324
|
+
while (-not (Get-Service tvnserver -ErrorAction SilentlyContinue) -and $waited -lt 30) {
|
|
325
|
+
Start-Sleep -Seconds 1
|
|
326
|
+
$waited++
|
|
327
|
+
}
|
|
328
|
+
if (-not (Get-Service tvnserver -ErrorAction SilentlyContinue)) {
|
|
329
|
+
throw "[lexxit] TightVNC install reported success but the tvnserver service never appeared after ${waited}s. Check $tvncLogPath for details - a reboot of this VM has resolved this before."
|
|
330
|
+
}
|
|
278
331
|
# TightVNC's "service mode" specifically captures the active CONSOLE
|
|
279
332
|
# session regardless of which account is logged on there - that is the
|
|
280
333
|
# whole point of running it as a service, and it is NOT the generic
|