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

Add support for multiple entries in known hosts #406

Closed
wants to merge 1 commit into from

Conversation

ragebiswas
Copy link

Issue#405 - similar to openssh, add support for attempting to verify
host keys by trying all entries in known_hosts, instead of bailing out
on the first failure. This is because there could be multiple entries for
a host, and only one/some of them may be valid.

Couple of notes:

  • Used a generic Exception class in the OpenSSHKnownHosts constructor to continue with the rest of the file in case of other runtime exceptions (e.g. inability to base64 decode a line - covered by tests)
  • Updated the known_hosts file to successfully validate multiple entries for the same host (where only one entry is valid)

Issue#405 - similar to openssh, add support for attempting to verify
host keys by trying all entries in known_hosts, instead of bailing out
on the first failure. This is because there could be multiple entries for
a host, and only one/some of them may be valid.
@codecov-io
Copy link

codecov-io commented Mar 9, 2018

Codecov Report

Merging #406 into master will increase coverage by 0.17%.
The diff coverage is 60%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #406      +/-   ##
============================================
+ Coverage     55.22%   55.39%   +0.17%     
- Complexity     1148     1151       +3     
============================================
  Files           189      189              
  Lines          7482     7486       +4     
  Branches        652      653       +1     
============================================
+ Hits           4132     4147      +15     
+ Misses         3001     2991      -10     
+ Partials        349      348       -1
Impacted Files Coverage Δ Complexity Δ
...sshj/transport/verification/OpenSSHKnownHosts.java 56.52% <60%> (+3.53%) 10 <0> (ø) ⬇️
src/main/java/net/schmizz/sshj/common/KeyType.java 59.41% <0%> (+0.58%) 9% <0%> (ø) ⬇️
src/main/java/net/schmizz/sshj/common/Base64.java 16.43% <0%> (+0.6%) 20% <0%> (+1%) ⬆️
...zz/sshj/connection/channel/ChannelInputStream.java 76.11% <0%> (+2.98%) 16% <0%> (+1%) ⬆️
...t/schmizz/sshj/connection/ConnectionException.java 44.44% <0%> (+11.11%) 4% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4be5a98...84a362f. Read the comment docs.

@hierynomus
Copy link
Owner

Did some refactoring on this PR, closing the original one.

@hierynomus hierynomus closed this Mar 22, 2018
@ragebiswas
Copy link
Author

Thanks @hierynomus - a release would be great ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants