PowerShell / PowerShell/Win32-OpenSSH

SSH_ORIGINAL_COMMAND not set for second command

Open
#1,417 2 comments 0 reactions 1 assignee View on GitHub

@vthiebaut10 is already working on this.

Since Oct 31, 2022.

2 - In progress Area-sshd Issue-Bug
Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

OpenSSH for Windows" version
7.7.2.0

Server OperatingSystem
Windows 10 Enterprise.

Client OperatingSystem
Windows 10 Enterprise.

What is failing
When executing a second command in the same session, sshd does not update the SSH_ORIGINAL_COMMAND environment variable.

After setting up a ForceCommand configuration, the issue can be replicated using the following python snippet.

import paramiko
cl = paramiko.client.SSHClient()
cl.load_system_host_keys()
cl.connect("<IP>", username="<USER>", password="<PASSWORD>")
cl.exec_command("ipconfig")
cl.exec_command("ping 127.0.0.1")

It seems that the issue is in do_exec_windows where the environment is updated only once per session.

Expected output
SSHD executes ipconfig and then ping.

Actual output
SSHD executes ipconfig twice.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.