Skip to content

Commit

Permalink
feat(scanner): skip SSH configuration validation when ssh-key(scan|ge…
Browse files Browse the repository at this point in the history
…n) failed (#2065)
  • Loading branch information
MaineK00n authored Nov 12, 2024
1 parent dd28532 commit e281d5f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ func validateSSHConfig(c *config.ServerInfo) error {
sshScanCmd := strings.Join([]string{sshKeyscanBinaryPath, "-p", c.Port, sshConfig.hostname}, " ")
r := localExec(*c, sshScanCmd, noSudo)
if !r.isSuccess() {
return xerrors.Errorf("Failed to ssh-keyscan. cmd: %s, err: %w", sshScanCmd, r.Error)
logging.Log.Warnf("SSH configuration validation is skipped. err: Failed to ssh-keyscan. cmd: %s, err: %s", sshScanCmd, r.Error)
return nil
}
serverKeys := parseSSHScan(r.Stdout)

Expand All @@ -471,7 +472,8 @@ func validateSSHConfig(c *config.ServerInfo) error {
if r := localExec(*c, cmd, noSudo); r.isSuccess() {
keyType, clientKey, err := parseSSHKeygen(r.Stdout)
if err != nil {
return xerrors.Errorf("Failed to parse ssh-keygen result. stdout: %s, err: %w", r.Stdout, r.Error)
logging.Log.Warnf("SSH configuration validation is skipped. err: Failed to parse ssh-keygen result. stdout: %s, err: %s", r.Stdout, r.Error)
return nil
}
if serverKey, ok := serverKeys[keyType]; ok && serverKey == clientKey {
return nil
Expand Down

0 comments on commit e281d5f

Please sign in to comment.