Skip to content

[BUG] Salt-Cloud: Unable to pass SSH timeout param -oConnectTimeout #59901

Closed

Description

@cheburakshu

Description
I am using salsify driver to install a minion on a remote host. When there are issues with the SSH connection, salt-cloud initiated SSH process hangs indefinitely. L1492 sets timeout instead of ssh_timetout in kwargs, when calling root_cmd in L1504 which expects ssh_timeout. So, ssh_timeout gets missed even though it is present.

Runner invocation in code:

__salt__['cloud.profile'](profile_name, minion_id, ssh_timeout=15, hard_timeout=900, show_deploy_args=False)
2021-03-25 13:32:26,838 [salt.loaded.int.utils.cloud][DEBUG   ] [11739] SSH command: 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none  -p 22 [email protected] /tmp/.saltcloud-84bd4974-0c73-48f6-9783-7fdd3784b0fc/deploy.sh -c '/tmp/.saltcloud-84bd4974-0c73-48f6-9783-7fdd3784b0fc'  -x python3 '
[root@cava-6-242-186 cloud.providers.d]# cat ssc_saltify_provider.conf 
ssc_saltify_provider:
  driver: saltify
[root@cava-6-242-186 cloud.profiles.d]# cat ssc_10.196.195.92_profile.conf
ssc_10.196.195.92_profile:
  deploy: true
  minion:
    master: cava-6-242-186.eng.vmware.com
  password: xxx
  priv_key: ''
  provider: ssc_saltify_provider
  pub_key: ''
  script_args: ' -x python3 '
  ssh_host: 10.196.195.92
  ssh_timeout: 15
  ssh_username: root
[root@cava-6-242-186 cloud.profiles.d]#

salt/salt/utils/cloud.py

Lines 1488 to 1495 in 3f30104

ssh_kwargs = {
"hostname": host,
"port": port,
"username": username,
"timeout": ssh_timeout,
"display_ssh_output": display_ssh_output,
"sudo_password": sudo_password,
"sftp": opts.get("use_sftp", False),

salt/salt/utils/cloud.py

Lines 1504 to 1510 in 3f30104

if root_cmd(
"test -e '{}'".format(tmp_dir),
tty,
sudo,
allow_failure=True,
**ssh_kwargs
):

salt/salt/utils/cloud.py

Lines 2427 to 2428 in 3f30104

if "ssh_timeout" in kwargs:
ssh_args.extend(["-oConnectTimeout={}".format(kwargs["ssh_timeout"])])

[root@cava-6-242-186 salt]# salt-master -V
Salt Version:
           Salt: 3001.3
 
Dependency Versions:
           cffi: 1.13.2
       cherrypy: 18.5.0
       dateutil: 2.8.1
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.10.3
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: 3.9.8
         pygit2: Not Installed
         Python: 3.6.8 (default, Oct  5 2020, 17:12:01)
   python-gnupg: 0.4.5
         PyYAML: 5.2
          PyZMQ: 18.1.1
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2
 
System Versions:
           dist: centos 7 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-1160.15.2.el7.x86_64
         system: Linux
        version: CentOS Linux 7 Core
 
[root@cava-6-242-186 salt]# 

Activity

  1. added
    bug
    on Mar 25, 2021
  2. welcome commented on Mar 25, 2021

    @welcome

    Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
    Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

    There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
    If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!

  3. sagetherage commented on Mar 25, 2021

    @sagetherage
    Contributor

    @cheburakshu Hey Sud! 3001.3 is vulnerable, you will want to update to the latest 3001.7 from the tag or from the package repo for v3001 latest, likely that will not resolve the issue but simply giving you this detail :)

  4. added
    severity-high
    and removed on Mar 25, 2021
  5. added this to the Approved milestone on Mar 25, 2021
  6. cheburakshu commented on Mar 25, 2021

    @cheburakshu
    Author

    Thanks @sagetherage for pointing it out, I will upgrade. You're right, the code hasn't changed much in the latest one too and this bug may likely be around.

  7. modified the milestones: Approved, Silicon on Mar 29, 2021
  8. dwoz commented on May 19, 2021

    @dwoz
    Contributor

    This issue is related to #59903

  9. added
    bugfix-bckport
    and removed
    Silicon v3004.0
    on Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Salt-Cloudbugbugfix-bckportseverity-high

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions