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
Initial implementation of a builtin SSH connection support #1323
Conversation
f3f325d
to
5a3abf1
Compare
93ff06d
to
82bcf9a
Compare
82bcf9a
to
febb5de
Compare
3e158ec
to
498f618
Compare
977a89a
to
b64d840
Compare
7667d3b
to
9ad7a29
Compare
nice catch. the instant failure is because it tries to connect to SSH (localhost here) via IPv6. apparently that's not working (either not possible or i need to fix IPv6 support, will check). On the other hand, SSH should not be used when using default config. i'll address that asap. (it's because ssh.hostname defaults to "localhost" and makes the frontend think that it should connect to SSH rather than spawn a local process. |
7492123
to
ae99510
Compare
@whisperity I cannot repro what you described. my earlier comment was based on an old state of this PR. :( I've found some other minor issue though. the default user name on windows was not properly inferred. it was set to "unknown" as fallback. I've just fixed that. |
I linked exactly the build I was using... 😦 Although, yeah, it does not point to a commit. I will try the latest build of the branch tomorrow! |
ae99510
to
1bc0843
Compare
Using this build, I can confirm that Contour auto-starts PowerShell on Windows using the default configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contour
failed to spawn ssh sessions for me because i dont have .ssh/config
file
1bc0843
to
192e31a
Compare
192e31a
to
95ae4cd
Compare
Signed-off-by: Christian Parpart <christian@parpart.family>
…itCode Signed-off-by: Christian Parpart <christian@parpart.family>
95ae4cd
to
9948f20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it asks password for three times, but if i insert correct password second time it does not work
here is output log for two different runs
~/r/contour feature/ssh-client 20.2s ❱ ./build/src/contour/contour
QML debugging is enabled. Only use this in a safe environment.
Info: libpng warning: iCCP: known incorrect sRGB profile ((null):0, (null))
[2023-11-08 14:52:05.116606663.116606] [ssh] (contour) Resizing PTY to 80x24.
[2023-11-08 14:52:05.116649454.116649] [ssh] Starting SSH session to host: user@192.168.50.20
[2023-11-08 14:52:05.116654083.116654] [ssh] (contour) State transition from Initial to Started.
[2023-11-08 14:52:05.116656448.116656] [ssh] (contour) State transition from Started to Connect.
[2023-11-08 14:52:05.117152308.117152] [ssh] Connected to 192.168.50.20
[2023-11-08 14:52:05.117156336.117156] [ssh] (contour) State transition from Connect to Handshake.
[2023-11-08 14:52:05.255754371.255754] [ssh] (contour) State transition from Handshake to VerifyHostKey.
[2023-11-08 14:52:05.255812912.255812] [ssh] Host key verification succeeded (AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCvNflTlLiqQTLfsiDJpdiZbqVov9zWXFfnw4EcEGr8WEeeH7UoIkwaQk8pwvs9LOXGDYAOpsDtMO/Aza3cx7oY=).
[2023-11-08 14:52:05.255818603.255818] [ssh] (contour) State transition from VerifyHostKey to AuthenticateAgent.
[error] Failed to connect to SSH agent. Bad use
[error] Failed to authenticate with SSH agent. No more identities available.
[2023-11-08 14:52:05.255828111.255828] [ssh] (contour) State transition from AuthenticateAgent to AuthenticatePasswordStart.
[2023-11-08 14:52:05.255830425.255830] [ssh] (contour) State transition from AuthenticatePasswordStart to AuthenticatePasswordWaitForInput.
[2023-11-08 14:52:05.268786526.268786] [ssh] (contour) Resizing PTY to 80x23.
[2023-11-08 14:52:05.420128299.420128] [ssh] (QSGRenderThread) Resizing PTY to 80x24.
[2023-11-08 14:52:05.469879871.469879] [ssh] (contour) Resizing PTY to 162x24.
[2023-11-08 14:52:05.470018193.470018] [ssh] (contour) Resizing PTY to 162x43.
[2023-11-08 14:52:05.471272903.471272] [ssh] (contour) Resizing PTY to 162x43.
[2023-11-08 14:52:05.471277902.471277] [ssh] (contour) Resizing PTY to 162x43.
[2023-11-08 14:52:05.913383187.913383] [ssh] (contour) Handling pre-authentication input: "s"
[2023-11-08 14:52:06.120066394.120066] [ssh] (contour) Handling pre-authentication input: "t"
[2023-11-08 14:52:06.297095622.297095] [ssh] (contour) Handling pre-authentication input: "a"
[2023-11-08 14:52:06.456843719.456843] [ssh] (contour) Handling pre-authentication input: "r"
[2023-11-08 14:52:06.903854537.903854] [ssh] (contour) Handling pre-authentication input: "f"
[2023-11-08 14:52:07.003769011.003768] [ssh] (contour) Handling pre-authentication input: "i"
[2023-11-08 14:52:07.138722175.138722] [ssh] (contour) Handling pre-authentication input: "v"
[2023-11-08 14:52:07.226831010.226830] [ssh] (contour) Handling pre-authentication input: "e"
[2023-11-08 14:52:07.382814777.382814] [ssh] (contour) Handling pre-authentication input: "\r"
[2023-11-08 14:52:07.382837070.382837] [ssh] (contour) State transition from AuthenticatePasswordWaitForInput to AuthenticatePassword.
[2023-11-08 14:52:07.763370245.763370] [ssh] Successfully authenticated with password.
[2023-11-08 14:52:07.763397417.763397] [ssh] (contour) State transition from AuthenticatePassword to OpenChannel.
[2023-11-08 14:52:09.521277450.521277] [ssh] (contour) State transition from OpenChannel to RequestAuthAgent.
[2023-11-08 14:52:09.521298640.521298] [ssh] (contour) State transition from RequestAuthAgent to RequestPty.
[2023-11-08 14:52:09.535460839.535460] [ssh] (contour) State transition from RequestPty to SetEnv.
[error] Failed to set SSH environment variable "COLORTERM". Request denied
[error] Failed to set SSH environment variable "TERMINAL_NAME". Request denied
[error] Failed to set SSH environment variable "TERMINAL_VERSION_STRING". Request denied
[error] Failed to set SSH environment variable "TERMINAL_VERSION_TRIPLE". Request denied
[2023-11-08 14:52:09.537095809.537095] [ssh] (contour) State transition from SetEnv to StartShell.
[2023-11-08 14:52:09.538545749.538545] [ssh] (contour) State transition from StartShell to Operational.
[2023-11-08 14:52:11.648588210.648588] [ssh] (Terminal.Loop) State transition from Operational to Closed.
Debug[qml]: Client process terminated. Closing the window. (file:///home/yaraslau/repo/contour/src/contour/ui/Terminal.qml:205, expression for onTerminated)
~/r/contour feature/ssh-client 6.7s ❱ ./build/src/contour/contour
QML debugging is enabled. Only use this in a safe environment.
Info: libpng warning: iCCP: known incorrect sRGB profile ((null):0, (null))
[2023-11-08 14:52:16.257187556.257187] [ssh] (contour) Resizing PTY to 80x24.
[2023-11-08 14:52:16.257235167.257235] [ssh] Starting SSH session to host: user@192.168.50.20
[2023-11-08 14:52:16.257240276.257240] [ssh] (contour) State transition from Initial to Started.
[2023-11-08 14:52:16.257242711.257242] [ssh] (contour) State transition from Started to Connect.
[2023-11-08 14:52:16.257757607.257757] [ssh] Connected to 192.168.50.20
[2023-11-08 14:52:16.257761916.257761] [ssh] (contour) State transition from Connect to Handshake.
[2023-11-08 14:52:16.409017837.409017] [ssh] (contour) State transition from Handshake to VerifyHostKey.
[2023-11-08 14:52:16.409078292.409078] [ssh] Host key verification succeeded (AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCvNflTlLiqQTLfsiDJpdiZbqVov9zWXFfnw4EcEGr8WEeeH7UoIkwaQk8pwvs9LOXGDYAOpsDtMO/Aza3cx7oY=).
[2023-11-08 14:52:16.409085085.409085] [ssh] (contour) State transition from VerifyHostKey to AuthenticateAgent.
[error] Failed to connect to SSH agent. Bad use
[error] Failed to authenticate with SSH agent. No more identities available.
[2023-11-08 14:52:16.409096647.409096] [ssh] (contour) State transition from AuthenticateAgent to AuthenticatePasswordStart.
[2023-11-08 14:52:16.409099613.409099] [ssh] (contour) State transition from AuthenticatePasswordStart to AuthenticatePasswordWaitForInput.
[2023-11-08 14:52:16.422029935.422029] [ssh] (contour) Resizing PTY to 80x23.
[2023-11-08 14:52:16.497921300.497921] [ssh] (QSGRenderThread) Resizing PTY to 80x24.
[2023-11-08 14:52:16.545855757.545855] [ssh] (contour) Resizing PTY to 162x24.
[2023-11-08 14:52:16.545968671.545968] [ssh] (contour) Resizing PTY to 162x43.
[2023-11-08 14:52:16.547079417.547079] [ssh] (contour) Resizing PTY to 162x43.
[2023-11-08 14:52:16.547085208.547085] [ssh] (contour) Resizing PTY to 162x43.
[2023-11-08 14:52:17.405177073.405177] [ssh] (contour) Handling pre-authentication input: "a"
[2023-11-08 14:52:17.797939193.797939] [ssh] (contour) Handling pre-authentication input: "\r"
[2023-11-08 14:52:17.797957808.797957] [ssh] (contour) State transition from AuthenticatePasswordWaitForInput to AuthenticatePassword.
[error] Authentication failed. Authentication failed
[2023-11-08 14:52:20.657258732.657258] [ssh] (contour) State transition from AuthenticatePassword to AuthenticatePasswordStart.
[2023-11-08 14:52:20.657267468.657267] [ssh] (contour) State transition from AuthenticatePasswordStart to AuthenticatePasswordWaitForInput.
[2023-11-08 14:52:21.703121413.703121] [ssh] (contour) Handling pre-authentication input: "s"
[2023-11-08 14:52:22.084141599.084141] [ssh] (contour) Handling pre-authentication input: "t"
[2023-11-08 14:52:22.478187858.478187] [ssh] (contour) Handling pre-authentication input: "a"
[2023-11-08 14:52:22.773196283.773196] [ssh] (contour) Handling pre-authentication input: "r"
[2023-11-08 14:52:23.172443805.172443] [ssh] (contour) Handling pre-authentication input: "f"
[2023-11-08 14:52:23.316162514.316162] [ssh] (contour) Handling pre-authentication input: "i"
[2023-11-08 14:52:23.407145251.407145] [ssh] (contour) Handling pre-authentication input: "v"
[2023-11-08 14:52:23.517153830.517153] [ssh] (contour) Handling pre-authentication input: "e"
[2023-11-08 14:52:23.891107564.891107] [ssh] (contour) Handling pre-authentication input: "\r"
[2023-11-08 14:52:23.891129065.891129] [ssh] (contour) State transition from AuthenticatePasswordWaitForInput to AuthenticatePassword.
[error] Authentication failed. Authentication failed
[2023-11-08 14:52:26.750514333.750514] [ssh] (contour) State transition from AuthenticatePassword to AuthenticatePasswordStart.
[2023-11-08 14:52:26.750523881.750523] [ssh] (contour) State transition from AuthenticatePasswordStart to AuthenticatePasswordWaitForInput.
…lementation Signed-off-by: Christian Parpart <christian@parpart.family>
9948f20
to
a9efd73
Compare
we weren't clearing the input buffer on retry. I did not notice, because I only tried success and login failure excess. thx for pointing it out. fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested that things are working
Main motivation of implementing this is to bypass local PTY (ConPTY) on Windows. But there may be more use to it than that on other platforms maybe as well, so we make it available on all platforms, if possible.
Closes #1319, #1064.
Implement builtin SSH support. While being not THAT useful on Linux desktop or MacOS, it turns out to be a game changer on Windows platform, as we can fully bypass ConPTY with a builtin SSH client in case would simply SSH away only anyways.
Maybe this would also bypass ConPTY on Windows when using to get into WSL / WSL2 (I do not know yet).
Checklist
SshClient
)vtpty::Pty
implementation:SshSession
getaddr
(API matches on UNIX + Win32, yay)ssh-add -l
the session terminates - ref)Postponed post-merge and maybe post-0.4.0-release
Notes
this feature is only built if
libssh2
is installed (its development package).