You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/connection_ssh
Martin Krizek 54ccad9e46
Limit askpass prompts to single attempt (#85364)
* Limit askpass prompts to single attempt

OpenSSH client option NumberOfPasswordPrompts defaults to 3 so in case
an incorrect connection password is provided it is excessively tried 3
times. Not only that but running the `_ssh_askpass` entry point multiple
times (via ssh) results in `json.decoder.JSONDecodeError` as after the
first run the shared memory is zero'd and the subsequent runs end up
calling `json.loads` on empty data.

`json.decoder.JSONDecodeError` does not happen prior to Python 3.13 as
the share memory is unlinked automatically on `.close()` and the
`_ssh_askpass` entry point exits with return code 1 before attempting to
load zero'd memory.

Fixes #85359

* changelog and tests

* Update changelogs/fragments/85359-askpass-incorrect-password-retries.yml

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>

* Update lib/ansible/cli/_ssh_askpass.py

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>

* Avoid race condition in second unlink

---------

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
Co-authored-by: Matt Clay <matt@mystile.com>
5 months ago
..
files Typo fixes and other bits and bobs (#83672) 1 year ago
aliases Remove reliance on `sshpass` and utilize `SSH_ASKPASS` (#83936) 9 months ago
check_ssh_defaults.yml Typo fixes and other bits and bobs (#83672) 1 year ago
posix.sh Modernize install (#76021) 4 years ago
runme.sh Decouple SSH client verbosity from Ansible display (#85224) 6 months ago
test_connection.inventory Fix integration tests with custom inventory. 7 years ago
test_ssh_askpass.yml Limit askpass prompts to single attempt (#85364) 5 months ago
test_ssh_defaults.cfg fix ssh cli defaults (#75245) 4 years ago
test_unreachable_become_timeout.yml Make timeout on become an unreachable error (#84589) 10 months ago
verify_config.yml fix ssh cli defaults (#75245) 4 years ago