From 07f0a0cb00add4bef48f09b97bbabbe032035744 Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 14 Jun 2026 10:43:57 +0200 Subject: [PATCH] fix(ssh): accept SSH servers that omit an exit-status packet testConnection gated success on `exit code === 0`, but phpseclib returns false from getExitStatus() when a server omits the optional exit-status message, which would reject a valid login with an empty error. A successful connect() already proves the credential (it throws on auth failure), so the probe now succeeds on any exception-free connect + exec. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/Services/FleetService.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Services/FleetService.php b/app/Services/FleetService.php index 7a48792..8c221f1 100644 --- a/app/Services/FleetService.php +++ b/app/Services/FleetService.php @@ -130,12 +130,17 @@ class FleetService try { $ssh = (new SshClient($this->vault, timeout: 10))->connect($server); try { - [, $code] = $ssh->run('true'); + // A successful login (connect() throws otherwise) already proves the + // credential; running a trivial command also exercises the exec channel. + // Do NOT gate on the exit code: some SSH servers omit the optional + // exit-status packet, so getExitStatus() returns false even on success — + // reaching here without an exception is proof enough. + $ssh->run('true'); } finally { $ssh->disconnect(); } - return ['ok' => $code === 0, 'error' => null]; + return ['ok' => true, 'error' => null]; } catch (Throwable $e) { return ['ok' => false, 'error' => $e->getMessage()]; }