saltstack / saltstack/salt

ssh_gateway_command not passed to Netcat command for testing remote port

Open
#55,219 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Confirmed needs-testcase Salt-Cloud severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

With the update in PR's #48062 and #48199 by @icy, the custom command is not getting passed to the port test on line 810.

Setup
....
ssh_gateway: gateway.host.com
ssh_gateway_user: saltproxyuser
ssh_gateway_key: /key
ssh_gateway_command: "-W %h:%p"

gateway:
   ssh_gateway: gateway.host.com
   ssh_gateway_user: saltproxyuser
   ssh_gateway_key: /key
   ssh_gateway_command: "-W %h:%p"
...
Steps to Reproduce Issue

sudo salt-cloud -ym newHostFile -l debug

[DEBUG   ] Retrying connection to host 123.45.67.89 on port 22 via gateway gateway.host.com on port 22. (try 13)
[DEBUG   ] Child Forked! PID: 7498  STDOUT_FD: 7  STDERR_FD: 12
[DEBUG   ] Terminal Command: /bin/sh -c ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oIdentitiesOnly=yes -oKbdInteractiveAuthentication=no -i /key saltproxyuser@gateway.host.com -p 22 'nc -z -w5 -q0 123.45.67.89'
[DEBUG   ] Warning: Permanently added 'gateway.host.com' (ECDSA) to the list of known hosts.
nc: invalid option -- 'q'
Versions Report
Salt Version:
           Salt: 2019.2.2
 
Dependency Versions:
           cffi: 1.5.2
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Oct  8 2019, 14:14:10)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.4.0-150-generic
         system: Linux
        version: Ubuntu 16.04 xenial

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at salt/utils/cloud.py around line 810 and reproduce with the provided salt-cloud command and gateway configuration. Trace the remote port-test command construction and verify that ssh_gateway_command is included in the resulting Netcat invocation; the debug output should no longer omit the configured gateway command.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud, networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.