rundeck-plugins / ansible-plugin

Ansible Integration for Rundeck
MIT License
330 stars 100 forks source link

ssh-add hangs with Bad passphrase, try again #314

Open mchubby opened 2 years ago

mchubby commented 2 years ago

Tested on v4.0.0 Debian 10 openjdk 11 openssh-client 7.9p1

When providing a wrong passphrase, the ssh-add says it's a Bad passphrase, try again for <path> and prompts again indefinitely (expects more stdin data).

As far as the plugin is concerned it does not expect this case, we see nothing of that in the logs. We have to either kill the job or wait for it to time out.

Relevant code is https://github.com/rundeck-plugins/ansible-plugin/blob/34e9ddeb9acdfd7ce8c55d48b562d9f110fe5e9a/src/main/groovy/com/rundeck/plugins/ansible/ansible/AnsibleRunner.java#L633-L650

but my Java is too rusty to provide a PR (sorry).

I suppose it should read stdout and look for the error message (pass LANG=C just in case). or use -p for later openssh versions (8.4 I think)