PowerShell / PowerShell/Win32-OpenSSH

keys registered to ssh-agent are not picked up

Open
#1,532 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

"OpenSSH for Windows" version

PS C:\WINDOWS\system32> ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

Server OperatingSystem
N/A

Client OperatingSystem

PS C:\WINDOWS\system32> ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion\" -Name ProductName).ProductName)
Windows 10 Enterprise

Version 1809 (17763.864)

Background

  1. I enabled ssh-agent on a domain joined machine and the service is up and running (ssh-add -l shows my key under C:\Users\<name>\.ssh).
  2. The target SSH server (Linux) has a user that has the same name as the Windows machine
  3. Have a ssh config in C:\Users\<name>\.ssh\config with
Host <remote host>
    User <name>
    HostName <remote host IP>
    IdentityFile C:\Users\<name>\.ssh\id_rsa
    CertificateFile C:\Users\<name>\.ssh\id_rsa-cert.pub

What is failing

  1. ssh <remote host> still asks me a passphrase and after enter it I can connect to the host.

Expected output

  1. I can connect to the host without typing passphrase.

Other notes
When I remove the User line from my ssh config and run ssh <remote host>, it says <domain>\\<name>@<remote host IP>: Permission denied (publickey). so I suspect this is due to the fact the machine is domain joined, but not sure about the relationship.

Also, it seems like the two keys are recognized as different keys. Here are logs from ssh -vvv

debug1: Host '<remote host IP>' is known and matches the RSA host key.
debug1: Found key in C:\\Users\\<name>/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: C:/Users/<name>/.ssh/id_rsa-cert.pub (0000022CA546EBE0), explicit
debug2: key: C:\\Users\\<name>/.ssh/id_rsa (0000022CA546E630), agent
debug2: key: C:\\Users\\<name>\\.ssh\\id_rsa (0000022CA546E2B0), explicit
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>

I also tried matching the slashes / backslashes but it didn't help.

debug1: rekey after 134217728 blocks
debug2: key: C:/Users/<name>/.ssh/id_rsa-cert.pub (000001C0AD756C40), explicit
debug2: key: C:\\Users\\<name>/.ssh/id_rsa (000001C0AD756D90), agent
debug2: key: C:\\Users\\<name>/.ssh/id_rsa (000001C0AD756E00), explicit

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.

Research direction

Start by reproducing the Windows 10 connection with the shown ssh config and ssh-agent state, then run ssh -vvv and compare the agent and explicit key entries in the logs. The issue is done when the configured certificate and agent key are used consistently and the connection succeeds without prompting for the passphrase.

Written by the indexing model from the issue text.

Assessment

Domain
authentication, networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.