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

SudoHelper broken for sudo versions newer than 1.8.7 (released 2013) #274

Open
notfoundry opened this issue Apr 23, 2020 · 0 comments
Open

Comments

@notfoundry
Copy link

In version 1.8.8 of the sudo utility the description of the -S flag was changed from "causes sudo to read the password from the standard input instead of the terminal device" to "write the prompt to the standard error and read the password from the standard input instead of using the terminal device" (emphasis mine), which is documented at https://www.sudo.ws/man.html between the man pages for those two versions.

Inside the SudoHelper class, a listener to the effect of when(partial: prompt, from: standardOutput) exists to wait for the sudo command to present a prompt asking the user for a password. Since it listens on stdout, but modern sudo writes that prompt to stderr, the listener will hang forever until terminated.

Writing a bytecode patch to the groovy ssh library that changed nothing except replacing that occurrence of standardOutput with standardError allowed sudo executions to proceed perfectly on every machine I had available to me to test.

Environment info

groovy-ssh-2.10.1
java_1.8.0_242-8u242-b08-0ubuntu3~18.04-b08
First encountered on Ubuntu kernel 4.15.0-76, later verified on a variety of linux machines

Steps to reproduce

  1. connect to a machine with a version of sudo newer than 1.8.7 using username/password authentication
  2. attempt to execute a command as sudo
@notfoundry notfoundry changed the title SudoHelper broken for sudo versions newer than 1.8.7 (released 2014) SudoHelper broken for sudo versions newer than 1.8.7 (released 2013) Apr 23, 2020
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

No branches or pull requests

1 participant