Skip to content

ssh command can't spawn a proxy command via "exec" from a pwsh 7.3.0 session  #18561

@nvarscar

Description

@nvarscar

Prerequisites

Steps to reproduce

When using an ssh command with a proxy host (-J) parameter on a Mac, it tries to relaunch the command using exec. Before 7.3.0 this worked through a workaround exec file that was created in /usr/local/microsoft/powershell/7:

#!/usr/bin/env pwsh
param($command)

& $command @args

Now, after 7.3.0 upgrade, with or without the "exec" file, the command returns an error whenever attempting to spawn a proxy command.

Expected behavior

(bash)$ ssh 10.1.0.12 -J proxyhost.local -v
OpenSSH_8.6p1, LibreSSL 3.3.6
debug1: Setting implicit ProxyCommand from ProxyJump: ssh -v -W '[%h]:%p' proxyhost.local
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Executing proxy command: exec ssh -v -W '[10.1.0.12]:22' proxyhost.local
debug1: identity file /Users/user/.ssh/id_rsa type 0
debug1: identity file /Users/user/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
OpenSSH_8.6p1, LibreSSL 3.3.6
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to proxyhost.local port 22.
debug1: Connection established.

Actual behavior

PS> ssh 10.1.0.12 -J proxyhost.local -v
OpenSSH_8.6p1, LibreSSL 3.3.6
debug1: Setting implicit ProxyCommand from ProxyJump: /usr/bin/ssh -v -W '[%h]:%p' proxyhost.local
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Executing proxy command: exec /usr/bin/ssh -v -W '[10.1.0.12]:22' proxyhost.local
debug1: identity file /Users/user/.ssh/id_rsa type 0
debug1: identity file /Users/user/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
debug1: kex_exchange_identification: banner line 0: \033[31;1mSwitch-Process: \033[31;1mA positional parameter cannot be found that accepts argument '/usr/bin/ssh'.\033[0m
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

Error details

$null

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Darwin 21.6.0 Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions