Bug 2903 - ssh-keyscan returns '0' when no keys are found
Summary: ssh-keyscan returns '0' when no keys are found
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-keyscan (show other bugs)
Version: 7.6p1
Hardware: amd64 Linux
: P5 normal
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks: V_8_0
  Show dependency treegraph
 
Reported: 2018-09-09 15:44 AEST by Robert Grizzell
Modified: 2021-10-14 01:43 AEDT (History)
3 users (show)

See Also:


Attachments
exit with status 1 if no keys found (753 bytes, patch)
2019-01-23 20:32 AEDT, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Grizzell 2018-09-09 15:44:28 AEST
ssh-keyscan returns with an exit status of '0' when DNS resolution of a domain fails or an SSH connection can't be made. In instances where scripting is involved, this leads to situations where there is no indication that the command completed successfully. Authors are then forced to capture and parse the output in order to test for a successful run.

DNS Resolution:
> ssh-keyscan shouldnotresolve.example
> echo $?
0


No SSH Service:
> ssh-keyscan example.com
> echo $?
0
Comment 1 Damien Miller 2019-01-23 20:32:08 AEDT
Created attachment 3229 [details]
exit with status 1 if no keys found
Comment 2 Damien Miller 2019-01-27 21:54:52 AEDT
This has been committed and will be in openssh-8.0
Comment 3 Damien Miller 2019-10-09 15:11:47 AEDT
Close bugs fixed in openssh-8.1 release cycle
Comment 4 Ahmed Sayeed 2021-10-14 01:43:00 AEDT
[spam removed]