Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scanner): skip SSH configuration validation when ssh-key(scan|gen) failed #2065

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading