{{ message }}
Repository navigation
fix(collector): SSH private key ignored when password is also configured (#4409) - #4470
Open
Madhav-Rakhonde wants to merge 1 commit into
Conversation
…red (apache#4409) SshHelper.addIdentity() contained an early return after registering the password identity: if (StringUtils.hasText(password)) { clientSession.addPasswordIdentity(password); return; // <-- key never loaded } This meant that whenever a Linux SSH monitor had both a password and a private key configured, only the password was added to the MINA SSHD client session. If the target server had PasswordAuthentication disabled (public-key only), the connection always failed even though a valid private key was present. Fix: remove the early return so that both credentials are registered. MINA SSHD will then attempt each method in order and succeed with whichever the server accepts. Changes: - Removed the premature return in SshHelper.addIdentity() so that the private key is always loaded when privateKey is non-empty, regardless of whether a password is also set. - Added regression test bothPasswordAndPrivateKeyAreRegisteredWhenBothConfigured in SshHelperTest that verifies both addPasswordIdentity and addPublicKeyIdentity are called on the client session when both credentials are supplied. Fixes apache#4409
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What's changed?
In
SshHelper.addIdentity(), an early return was executed immediately after registering the password identity: