Skip to content

Commit fa1f892

Browse files
Release v1.0.55 with socket liveness checks and SSH auth status accuracy.
Validate PHP-FPM socket connectivity (not just socket file presence) before considering pools ready, and fix SSH password-auth status detection to account for keyboard-interactive/challenge-response paths. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent bb8cdf1 commit fa1f892

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

internal/agent/handlers.go

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,11 +1220,16 @@ func cleanupLegacySiteSockets(username, siteID, keepSocket string) {
12201220
_ = os.Remove(filepath.Join(runDir, fmt.Sprintf("php-%s.sock", siteSocketID(siteID))))
12211221
}
12221222

1223-
func allSocketsExist(paths []string) bool {
1223+
func allSocketsReady(paths []string) bool {
12241224
for _, p := range paths {
12251225
if _, err := os.Stat(p); err != nil {
12261226
return false
12271227
}
1228+
conn, err := net.DialTimeout("unix", p, 300*time.Millisecond)
1229+
if err != nil {
1230+
return false
1231+
}
1232+
_ = conn.Close()
12281233
}
12291234
return true
12301235
}
@@ -1235,7 +1240,7 @@ func waitForSockets(paths []string, timeout time.Duration) bool {
12351240
}
12361241
deadline := time.Now().Add(timeout)
12371242
for {
1238-
if allSocketsExist(paths) {
1243+
if allSocketsReady(paths) {
12391244
return true
12401245
}
12411246
if time.Now().After(deadline) {
@@ -3379,6 +3384,11 @@ func parseSSHConfigFile(path string, cfg *SSHConfig) {
33793384
}
33803385
defer f.Close()
33813386

3387+
passwordAuth := cfg.PasswordAuth
3388+
kbdAuth := cfg.PasswordAuth
3389+
passwordSeen := false
3390+
kbdSeen := false
3391+
33823392
scanner := bufio.NewScanner(f)
33833393
for scanner.Scan() {
33843394
line := scanner.Text()
@@ -3403,9 +3413,17 @@ func parseSSHConfigFile(path string, cfg *SSHConfig) {
34033413
cfg.Port = port
34043414
}
34053415
case "passwordauthentication":
3406-
cfg.PasswordAuth = (val == "yes")
3416+
passwordSeen = true
3417+
passwordAuth = (val == "yes")
3418+
case "kbdinteractiveauthentication", "challengeresponseauthentication":
3419+
kbdSeen = true
3420+
kbdAuth = (val == "yes")
34073421
}
34083422
}
3423+
3424+
if passwordSeen || kbdSeen {
3425+
cfg.PasswordAuth = passwordAuth || kbdAuth
3426+
}
34093427
}
34103428

34113429
func resolveSSHDBinary() (string, error) {
@@ -3447,6 +3465,11 @@ func (s *Server) getEffectiveSSHConfig() (*SSHConfig, error) {
34473465
return nil, fmt.Errorf("failed to read effective ssh config: %w: %s", err, strings.TrimSpace(string(output)))
34483466
}
34493467

3468+
passwordAuth := true
3469+
kbdAuth := true
3470+
passwordSeen := false
3471+
kbdSeen := false
3472+
34503473
for _, line := range strings.Split(string(output), "\n") {
34513474
fields := strings.Fields(strings.TrimSpace(line))
34523475
if len(fields) < 2 {
@@ -3458,9 +3481,17 @@ func (s *Server) getEffectiveSSHConfig() (*SSHConfig, error) {
34583481
cfg.Port = port
34593482
}
34603483
case "passwordauthentication":
3461-
cfg.PasswordAuth = strings.EqualFold(fields[1], "yes")
3484+
passwordSeen = true
3485+
passwordAuth = strings.EqualFold(fields[1], "yes")
3486+
case "kbdinteractiveauthentication", "challengeresponseauthentication":
3487+
kbdSeen = true
3488+
kbdAuth = strings.EqualFold(fields[1], "yes")
34623489
}
34633490
}
3491+
if passwordSeen || kbdSeen {
3492+
// Treat "password authentication" in UI as any password-based SSH auth path.
3493+
cfg.PasswordAuth = passwordAuth || kbdAuth
3494+
}
34643495

34653496
return cfg, nil
34663497
}

0 commit comments

Comments
 (0)