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

Paramiko ignores timeout setting #42596

Closed
bmaupin opened this issue Jul 10, 2018 · 4 comments · Fixed by #50448
Closed

Paramiko ignores timeout setting #42596

bmaupin opened this issue Jul 10, 2018 · 4 comments · Fixed by #50448
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@bmaupin
Copy link

bmaupin commented Jul 10, 2018

SUMMARY

timeout in ansible.cfg appears to be ignored when using paramiko.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

paramiko_ssh

ANSIBLE VERSION
ansible 2.5.5
  config file = /home/user/workspace/git/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609]
CONFIGURATION
[defaults]
timeout = 60
transport = paramiko
OS / ENVIRONMENT

Control machine: Ubuntu 16.04 64-bit
Managed node: RHEL 7 64-bit

STEPS TO REPRODUCE
ansible-playbook --connection=paramiko --timeout=60
EXPECTED RESULTS

Because timeout was set to 60, ansible-playbook shouldn't have timed out before then.

ACTUAL RESULTS

ansible-playbook returns after 34 seconds:

$ time ansible-playbook --connection=paramiko --timeout=60 ... -vvvv
ansible-playbook 2.5.5
config file = ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609]
Using ansible.cfg as config file

<server.example.org> ESTABLISH CONNECTION FOR USER: user on PORT 22 TO server.example.org
fatal: [server.example.org]: UNREACHABLE! => {
    "changed": false,
    "msg": "Authentication timeout.",
    "unreachable": true
}

NO MORE HOSTS LEFT ************************************************************************************************************************************************************************************************

PLAY RECAP ********************************************************************************************************************************************************************************************************
server.example.org : ok=0    changed=0    unreachable=1    failed=0


real	0m34.854s
user	0m2.316s
sys	0m0.398s
@ansibot
Copy link
Contributor

ansibot commented Jul 10, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jul 10, 2018
@jborean93 jborean93 removed needs_triage Needs a first human triage before being processed. python3 labels Jul 11, 2018
@sivel
Copy link
Member

sivel commented Jul 15, 2018

This is due to not passing auth_timeout to SSHClient.connect. The timeout argument for SSHClient.connect only handles the TCP connection. In paramiko 2.2 auth_timeout was added (paramiko/paramiko@0fd54bb), so older versions, such as those shipped with RHEL 6 and 7 do not support this option.

We would need to add logic to handle this.

@bmaupin
Copy link
Author

bmaupin commented Jul 16, 2018

so older versions, such as those shipped with RHEL 6 and 7 do not support this option.

For what it's worth, even the latest Ubuntu (18.04) ships with paramiko 2.0:
https://packages.ubuntu.com/bionic/python-paramiko

Thanks!

@orgito
Copy link
Contributor

orgito commented Jan 2, 2019

#50448 worked for me. It sets auth_timeout with the timeout value if paramiko is at least version 2.2.

@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants