PowerShell / PowerShell/Win32-OpenSSH
SSH_ORIGINAL_COMMAND not set for second command
@vthiebaut10 is already working on this.
Since Oct 31, 2022.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.