contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.37k stars 102 forks source link

Initial implementation of a builtin SSH connection support #1323

Closed christianparpart closed 9 months ago

christianparpart commented 9 months ago

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

Postponed post-merge and maybe post-0.4.0-release

Notes

this feature is only built if libssh2 is installed (its development package).

christianparpart commented 9 months ago

Right off the bat, here is something weird. When using the build from https://github.com/contour-terminal/contour/actions/runs/6763840917, I immediately get a complete failure when just starting Contour if I let contour create its default configuration:

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.

christianparpart commented 9 months ago

@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.

whisperity commented 9 months ago

I cannot repro what you described. my earlier comment was based on an old state of this PR. :(

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!

whisperity commented 9 months ago

Using this build, I can confirm that Contour auto-starts PowerShell on Windows using the default configuration.

christianparpart commented 9 months ago

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

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.