-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSH via Intellij products on Windows does not work #46024
Comments
It looks like the ssh library used by PyCharm doesn't respect a Another user ran into this on this upstream SSH library recently: hierynomus/sshj#960 On my Mac, I see it try and fail with my ~/.tsh/ private key specified in IdentityFile. It works because I have an The Intellij logs here show that no I'd recommend running the |
After starting the IntelliJ Logs from the successful connection attempt: 2024-09-05 17:11:18,051 [ 237414] FINE - #c.i.s.c.OpenSshConfigViaToolService - stderr of ssh -G -vvv tunnel.vanbergh.teleport.sh:
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data C:\\Users\\Administrator/.ssh/config
debug1: C:\\Users\\Administrator/.ssh/config line 2: Applying options for *.vanbergh.teleport.sh
debug1: C:\\Users\\Administrator/.ssh/config line 8: Applying options for *.vanbergh.teleport.sh
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
Pseudo-terminal will not be allocated because stdin is not a terminal.
2024-09-05 17:11:18,051 [ 237414] FINE - #c.i.s.c.OpenSshConfigViaToolService - ssh -G -vvv tunnel.vanbergh.teleport.sh executed in PT0.1079724S
2024-09-05 17:11:18,051 [ 237414] FINE - #c.i.s.c.SshConnectionConfig - Change after applying remote credentials for host tunnel.vanbergh.teleport.sh:
port: 3022
-> 22
user: administrator
-> tim
2024-09-05 17:11:18,051 [ 237414] FINE - #c.i.s.c.SshConnectionConfigService - Change after replacing %-tokens for host tunnel.vanbergh.teleport.sh:
proxyConfig: Command(command="C:\Users\Administrator\AppData\Local\Programs\teleport-connect\resources\bin\tsh.exe" proxy ssh --cluster=vanbergh.teleport.sh --proxy=vanbergh.teleport.sh:443 %r@%h:%p)
-> Command(command="C:\Users\Administrator\AppData\Local\Programs\teleport-connect\resources\bin\tsh.exe" proxy ssh --cluster=vanbergh.teleport.sh --proxy=vanbergh.teleport.sh:443 [email protected]:22)
2024-09-05 17:11:18,051 [ 237414] FINE - #c.i.s.i.SshConnection - Checking that can authenticate [email protected]:22
2024-09-05 17:11:18,051 [ 237414] INFO - net.schmizz.sshj.transport.random.JCERandom - Creating new SecureRandom.
2024-09-05 17:11:18,051 [ 237414] FINE - #c.i.s.i.s.sshj - Full connection config:
authMethods: PublicKey(privateKeys=[C:\Users\Administrator\AppData\Roaming\Teleport Connect\tsh\keys\vanbergh.teleport.sh\rosstimothy], agent=ALL), Password, KeyboardInteractive
ciphers: [[email protected], aes128-ctr, aes192-ctr, aes256-ctr, [email protected], [email protected]]
compression: false
connectTimeout: PT10S
environmentVariables: []
forwardAgent: false
host: tunnel.vanbergh.teleport.sh
hostKeyAlgorithms: [[email protected], [email protected], [email protected]]
hostKeyVerifier: OpenSSH-like host key verifier (knownHostsFile=[C:\Users\Administrator\AppData\Roaming\Teleport, C:\Users\Administrator\Desktop\Connect\tsh\known_hosts, C:\Users\Administrator\Desktop\__PROGRAMDATA__\ssh\ssh_known_hosts, C:\Users\Administrator\Desktop\__PROGRAMDATA__\ssh\ssh_known_hosts2], strictHostKeyChecking=ASK, hashKnownHosts=false)
identityAgent: null
initialLocalTcpForwardings: []
initialRemoteTcpForwardings: []
kexAlgorithms: [curve25519-sha256, [email protected], ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256, diffie-hellman-group14-sha1]
macs: [[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], hmac-sha2-256, hmac-sha2-512, hmac-sha1]
port: 22
proxyConfig: Command(command="C:\Users\Administrator\AppData\Local\Programs\teleport-connect\resources\bin\tsh.exe" proxy ssh --cluster=vanbergh.teleport.sh --proxy=vanbergh.teleport.sh:443 [email protected]:22)
serverAlive: null
user: tim
x11Forwarding: null
2024-09-05 17:11:18,067 [ 237430] FINE - #c.i.s.i.s.sshj - Delegating connection to non-default socket factory com.intellij.ssh.ProxyCommandSocketFactory@66a0e762
2024-09-05 17:11:18,067 [ 237430] INFO - #c.i.s.ProxyCommand - ProxyCommand for tunnel.vanbergh.teleport.sh:22: "C:\Users\Administrator\AppData\Local\Programs\teleport-connect\resources\bin\tsh.exe" proxy ssh --cluster=vanbergh.teleport.sh --proxy=vanbergh.teleport.sh:443 [email protected]:22
2024-09-05 17:11:18,067 [ 237430] INFO - #c.i.s.ProxyCommand - Started ProxyCommand for tunnel.vanbergh.teleport.sh:22: Process[pid=6860, exitValue="not exited"]
2024-09-05 17:11:18,067 [ 237430] INFO - #c.i.s.i.s.sshj - Client identity string: SSH-2.0-IntelliJ__GoLand_GO-242.21829.165__SSHJ_0.38.1_SNAPSHOT
2024-09-05 17:11:18,765 [ 238128] INFO - #c.i.s.i.s.sshj - Server identity string: SSH-2.0-Teleport
2024-09-05 17:11:19,085 [ 238448] FINE - c.i.s.i.s.PlatformAuthAgent - Attempting authentication using agent identity teleport:vanbergh.teleport.sh:vanbergh.teleport.sh:rosstimothy
2024-09-05 17:11:19,304 [ 238667] INFO - #c.i.s.i.s.sshj - Authentication log: SSH connection to [email protected]:22
* With altered connection settings:
- authMethods: PublicKey(privateKeys=[C:\Users\Administrator\AppData\Roaming\Teleport Connect\tsh\keys\vanbergh.teleport.sh\rosstimothy], agent=ALL), Password, KeyboardInteractive
- ciphers: [[email protected], aes128-ctr, aes192-ctr, aes256-ctr, [email protected], [email protected]]
- connectTimeout: PT10S
- hostKeyAlgorithms: [[email protected], [email protected], [email protected]]
- hostKeyVerifier: OpenSSH-like host key verifier (knownHostsFile=[C:\Users\Administrator\AppData\Roaming\Teleport, C:\Users\Administrator\Desktop\Connect\tsh\known_hosts, C:\Users\Administrator\Desktop\__PROGRAMDATA__\ssh\ssh_known_hosts, C:\Users\Administrator\Desktop\__PROGRAMDATA__\ssh\ssh_known_hosts2], strictHostKeyChecking=ASK, hashKnownHosts=false)
- kexAlgorithms: [curve25519-sha256, [email protected], ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256, diffie-hellman-group14-sha1]
- macs: [[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], hmac-sha2-256, hmac-sha2-512, hmac-sha1]
- proxyConfig: Command(command="C:\Users\Administrator\AppData\Local\Programs\teleport-connect\resources\bin\tsh.exe" proxy ssh --cluster=vanbergh.teleport.sh --proxy=vanbergh.teleport.sh:443 [email protected]:22)
- user: tim
* With auth agent OpenSSH Agent for Windows
* Connected: Socket[addr=null,port=0,localport=0]
* Starting authentication
=> none (failure, new auth methods allowed by the server: publickey)
=> publickey from the SSH agent, comment: teleport:vanbergh.teleport.sh:vanbergh.teleport.sh:rosstimothy (success)
2024-09-05 17:11:19,304 [ 238667] FINE - #c.i.s.i.s.sshj - Disconnecting SshjSshConnection([email protected])@17a04857
2024-09-05 17:11:19,304 [ 238667] FINE - #c.i.s.i.s.sshj - The IDE decided to disconnect the SSH session com.intellij.ssh.impl.sshj.PlatformSSHClient@527b6de8
java.lang.Exception
at com.intellij.ssh.impl.sshj.PlatformSSHClient.disconnect(SshjConnectionUtil.kt:599)
at net.schmizz.sshj.SSHClient.close(SSHClient.java:836)
at com.intellij.ssh.impl.sshj.SshjSshConnection$disconnect$4.invoke(SshjSshConnection.kt:206)
at com.intellij.ssh.impl.sshj.SshjSshConnection$disconnect$4.invoke(SshjSshConnection.kt:206)
at com.intellij.ssh.impl.sshj.SshjSshConnection.disconnect(SshjSshConnection.kt:209)
at com.intellij.ssh.impl.SshConnection$checkCanAuthenticate$1.invoke$addToThePool$lambda$1(SshConnection.kt:242)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
at java.base/java.lang.Thread.run(Thread.java:1583)
2024-09-05 17:11:19,304 [ 238667] INFO - #c.i.s.i.s.sshj - Disconnected - BY_APPLICATION
2024-09-05 17:11:19,483 [ 238846] WARN - #c.i.s.ProxyCommand - Process[pid=6860, exitValue=1] exited with code 1
|
Connections that attempt to make use of proxy templates to resolve hosts are however rejected.
IntelliJ Logs
The same connection attempt directly via SSH works: PS C:\Users\Administrator> ssh tim@pear uptime
2024-09-05T19:00:19Z DEBU [TSH] Will search for hosts via "pear" according to proxy template. common\tsh.go:3929
2024-09-05T19:00:19Z INFO [CLIENT] ALPN connection upgrade required for "vanbergh.teleport.sh:443": false. client\api.go:831
2024-09-05T19:00:19Z INFO [CLIENT] [KEY AGENT] Connected to the system agent: "\\\\.\\pipe\\openssh-ssh-agent" client\api.go:4580
2024-09-05T19:00:19Z DEBU [KEYSTORE] Reading certificates from path "C:\\Users\\Administrator\\AppData\\Roaming\\Teleport Connect\\tsh\\keys\\vanbergh.teleport.sh\\rosstimothy-ssh\\vanbergh.teleport.sh-cert.pub". client\keystore.go:357
2024-09-05T19:00:19Z DEBU [KEYSTORE] Teleport TLS certificate valid until "2024-09-06 02:43:18 +0000 UTC". client\client_store.go:118
2024-09-05T19:00:19Z INFO [KEYAGENT] Loading SSH key for user "rosstimothy" and cluster "vanbergh.teleport.sh". client\keyagent.go:198
2024-09-05T19:00:19Z DEBU [KEYSTORE] Teleport TLS certificate valid until "2024-09-06 02:43:18 +0000 UTC". client\client_store.go:118
2024-09-05T19:00:19Z DEBU [KEYSTORE] Teleport TLS certificate valid until "2024-09-06 02:43:18 +0000 UTC". client\client_store.go:118
2024-09-05T19:00:19Z DEBU [KEYSTORE] Teleport TLS certificate valid until "2024-09-06 02:43:18 +0000 UTC". client\client_store.go:118
2024-09-05T19:00:19Z DEBU [KEYSTORE] Teleport TLS certificate valid until "2024-09-06 02:43:18 +0000 UTC". client\client_store.go:118
2024-09-05T19:00:19Z DEBU [KEYSTORE] Teleport TLS certificate valid until "2024-09-06 02:43:18 +0000 UTC". client\client_store.go:118
2024-09-05T19:00:19Z DEBU attaching new resumable connection trace_id:7065b99f7625de089deeef6b109d4078 span_id:55af61b2c3375487 resumption/client.go:284
15:00 up 16 days, 20:14, 7 users, load averages: 1.49 1.54 1.64 |
SSH connections do work when established outside of IntelliJ products on Windows:
However, attempting to use the same configuration within IntelliJ products fails:
Node logs show that a connection is being attempted, but closed prior to the SSH handshake completing:
IntelliJ Logs
Disabling session resumption causes logs on the node to be slightly different, but still point to the SSH connection being terminated by IntelliJ.
IntelliJ logs
Mac
No issues when connecting to the same host via IntelliJ on macOS.
IntelliJ Logs
The text was updated successfully, but these errors were encountered: