question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ssh_gateway_command not passed to Netcat command for testing remote port

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
icycommented, Nov 13, 2019

@crimv42 Please have a look at my PR. In the meanwhile you can fix the netcat on the gateway 😉

1reaction
icycommented, Nov 11, 2019

@crimv42 I was wrong. The netcat command is executed on the gateway server . It’s mentioned here https://github.com/saltstack/salt/blob/29a016f78e80633a23ada1af3fba5580b81969b7/salt/utils/cloud.py#L784 .

Though adding new configuration variable to avoid hard-coded command string is possible, I’m looking at using the ssh command instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Check Remote Ports are Reachable Using 'nc ...
In this guide, we will show you how to determine if ports on a remote host are reachable/open using simple netcat (in short...
Read more >
How To Use Netcat to Establish and Test TCP and UDP ...
By default, netcat operates by initiating a TCP connection to a remote host. The most basic syntax is: netcat [options] host port.
Read more >
Using netcat to test remote ports for accessibility - AskF5
The netcat utility (nc) is a networking utility that can be used to test if a network device is listening on a particular...
Read more >
How to Use Netcat Commands: Examples and Cheat Sheets
nc -l – This command will instruct the local system to begin listening for TCP connections and UDP activity on a specific port...
Read more >
Use netcat (nc) to check if a remote port is reachable - InfoHeap
The following commands were tried on Mac and Ubuntu Linux. Checking tcp port. Use -t (tcp), -v (verbosity) and -z (to scan the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found