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.

proxycommand not being used

See original GitHub issue

Describe the bug

My ssh config file uses a Match directive to set the value of ProxyCommand. This works with openssh, and also works with paramiko if I run it by hand, but doesn’t work from pyinfra.

To Reproduce

Install pyinfra and paramiko[invoke] (for Match support). Create an ssh config like this:

Match host <hostname>
  ProxyCommand <command>

Then try to execute a simple command on <hostname>: pyinfra <hostname> exec – whoami

Expected behavior

I expect pyinfra to connect and execute “whoami” and show me the output.

Meta

pyinfra was installed into a pristine virtualenv, using pip.

pyinfra --support
--> Support information:

    If you are having issues with pyinfra or wish to make feature requests, please
    check out the GitHub issues at https://github.com/Fizzadar/pyinfra/issues .
    When adding an issue, be sure to include the following:

    System: Darwin
      Platform: macOS-11.2.3-x86_64-i386-64bit
      Release: 20.3.0
      Machine: x86_64
    pyinfra: v1.3.10
    Executable: /Users/anandb/.venv/pyinfra/bin/pyinfra
    Python: 3.8.2 (CPython, Clang 12.0.0 (clang-1200.0.32.29))
pyinfra -vv --debug <hostname> exec -- whoami
--> Loading config...
--> Loading inventory...
    [pyinfra_cli.inventory] Creating fake inventory...

--> Connecting to hosts...
    [pyinfra.api.connectors.ssh] Connecting to: <hostname> ({'allow_agent': True, 'look_for_keys': True, 'hostname': '<hostname>', 'timeout': 10})
    [hostname] Could not connect ([Errno None] Unable to connect to port 22 on A.B.C.D)
    [pyinfra.api.state] Failing hosts: hostname
--> pyinfra error: No hosts remaining!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
anandb-ripencccommented, Apr 23, 2021

Thanks for the update and explanation. I’ll follow #574 for news.

1reaction
Fizzadarcommented, Apr 17, 2021

I believe the issue here is the Match support, added in paramiko 2.7; pyinfra contains an out of date inlined version of SSHConfig with support for include directives. I’m not a fan of this because this exact situation occurrs.

I’m going to remove and reimplement include support by inlining the included files before parsing, leaving the parsing back to paramiko. Will also bump the minimum paramiko version to 2.7.

Read more comments on GitHub >

github_iconTop Results From Across the Web

proxy - Problems with SSH ProxyCommand - Stack Overflow
The problem seems to be, that the proxy tries to login with my local rsa_key and not with the key stored on the...
Read more >
OpenSSH config file on Windows - ProxyCommand not working
Show activity on this post. I am trying to use OpenSSH ProxyCommand on Windows to connect to device2 through device1. Device2 requests xxxxx ......
Read more >
Can't use a ProxyCommand-based SSH connection #285
I understand this is hard for mosh to imitate, given UDP connections and what not, so let's assume that there's a hole poked...
Read more >
Problems with SSH ProxyCommand execution - Server Fault
The command will log in to machine-1 , and from there to remote_server , using the authentication methods it would use, had you...
Read more >
ssh_config(5) - OpenBSD manual pages
For each parameter, the first obtained value will be used. ... If set to yes then, for connections that do not use a...
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