Skip to content

[BUG] salt-ssh terraform roster returns invalid timeout value when no timeout is specified #64109

@cebe

Description

@cebe

Description

Using salt-ssh with the terraform roster results in invalid ssh command.

Setup

Saltfile:

salt-ssh:
  config_dir: salt/etc
  max_procs: 30
  wipe_ssh: True

salt/etc/master:

root_dir: .
file_roots:
  base:
    - salt/states
pillar_roots:
  base:
    - salt/pillar
roster: terraform

infra_servers.tf:

# create servers here

resource "salt_host" "k8s_worker_minion" {
  salt_id = hcloud_server.k8s_worker_minion.name
  host = hcloud_server.k8s_worker_minion.ipv6_address
  user = "root"
  passwd = ""
  priv = "~/.ssh/id_rsa"
#  timeout = 30
}

This terraform state creates a roster entry for the Server, with a minion ID and an IPv6 address to connect to.

Steps to Reproduce the behavior

Running test.ping with this server results in the following output:

$ salt-ssh '*' -i test.ping
nat-gw-hel1.k.cebe.net:
    ----------
    retcode:
        255
    stderr:
        command-line line 0: invalid time value.
    stdout:

When I look at the debug output with salt-ssh '*' -i test.ping -v -l trace the following ssh command is executed:

[TRACE   ] Executing command: ssh 2a01:4f9:c012:a535::1 -o KbdInteractiveAuthentication=no -o PasswordAuthentication=no -o GSSAPIAuthentication=no -o ConnectTimeout=None -o IdentityFile=/home/cebe/dev/cebe.cloud/k8s-cloud/k8s/terraform/etc/salt/pki/master/ssh/salt-ssh.rsa -o User=root  /bin/sh << 'EOF'
...

The option -o ConnectTimeout=None is invalid an results in the output

command-line line 0: invalid time value.

uncommenting the timeout option in the terraform file and running terraform apply fixes the issue.

Expected behavior

When not specifying a timeout, the command should not add a timeout option or fall back to a default value.

Citing from man 5 ssh_config:

ConnectTimeout
Specifies the timeout (in seconds) used when connecting to the SSH server, instead of using the default system TCP timeout.
This timeout is applied both to establishing the connection and to
performing the initial SSH protocol handshake and key exchange.

None is definitively not a valid value here.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
$ salt-ssh --versions-report
Salt Version:
          Salt: 3006.0
 
Python Version:
        Python: 3.8.10 (default, Mar 13 2023, 10:26:41)
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.7.3
     docker-py: 4.1.0
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.3
       libgit2: Not Installed
  looseversion: 1.1.2
      M2Crypto: Not Installed
          Mako: 1.1.0
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.1
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: 3.12.0
        pygit2: Not Installed
  python-gnupg: Not Installed
        PyYAML: 5.3.1
         PyZMQ: 25.0.2
        relenv: Not Installed
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: ubuntu 20.04.5 focal
        locale: utf-8
       machine: x86_64
       release: 5.15.0-10060-tuxedo
        system: Linux
       version: Ubuntu 20.04.5 focal
 

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions