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

Always use SSH in non-interactive mode #319

Merged
merged 1 commit into from
Dec 12, 2017
Merged

Always use SSH in non-interactive mode #319

merged 1 commit into from
Dec 12, 2017

Conversation

jhernand
Copy link
Contributor

@jhernand jhernand commented Dec 12, 2017

The default configuration of the net/ssh gem uses interactive mode.
That means that when authentication with a provided password fails, the
gem will retry, discarding the provided password and asking
interactively for a new one. In the ManageIQ environment this will
always fail, because there is no human user to type that alternative
password. The result is the following error:

Errno::ENOTTY: Inappropriate ioctl for device

That happens when the gem tries to read the password using the
IO#noecho method, because inside the ManageIQ process $stdin isn't
attached to a terminal.

The net result is an exception that isn't caught by the gem, and scary
error messages in the log and in the UI.

To avoid these problems this patch adds the :non_interactive => true
option to the constructor of the SSH client. This instructs the gem to
never retry failed authentications interactively.

Fixes https://bugzilla.redhat.com/1516849

The default configuration of the `net/ssh` gem uses _interactive_ mode.
That means that when authentication with a provided password fails, the
gem will retry, discarding the provided password and asking
interactively for a new one. In the ManageIQ environment this will
always fail, because there is no human user to type that alternative
password. The result is the following error:

  Errno::ENOTTY: Inappropriate ioctl for device

That happens when the gem tries to read the password using the
`IO#noecho` method, because inside the ManageIQ process `$stdin` isn't
attached to a terminal.

The net result is an exception that isn't caught by the gem, and scary
error messages in the log and in the UI.

To avoid these problems this patch adds the `:non_interactive => true`
option to the constructor of the SSH client. This instructs the gem to
never retry failed authentications interactively.

This addresses the following bug:

  Password change for a Host fails with error code 500
  https://bugzilla.redhat.com/1516849

Signed-off-by: Juan Hernandez <[email protected]>
@jhernand
Copy link
Contributor Author

@pkliczewski @agrare please review.

@miq-bot
Copy link
Member

miq-bot commented Dec 12, 2017

Checked commit https://github.com/jhernand/manageiq-gems-pending/commit/2e11a920da8c7fee52938ad920798dfa71b6238a with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍪

@agrare agrare merged commit 6372d23 into ManageIQ:master Dec 12, 2017
@jhernand
Copy link
Contributor Author

@miq-bot add_labels bug, gaprindashvili/yes

simaishi pushed a commit that referenced this pull request Dec 14, 2017
Always use SSH in non-interactive mode
(cherry picked from commit 6372d23)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526060
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit 5c5d3db576a2bb0dfeb2a25259998f54cc92a417
Author: Adam Grare <[email protected]>
Date:   Tue Dec 12 13:13:14 2017 -0500

    Merge pull request #319 from jhernand/ssh_non_interactive
    
    Always use SSH in non-interactive mode
    (cherry picked from commit 6372d2351537779777fcde8ce4396c187175943e)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526060

@Fryguy
Copy link
Member

Fryguy commented Dec 18, 2017

cc @gmcculloug

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

Successfully merging this pull request may close these issues.

6 participants