1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-25 22:33:52 +03:00
Commit Graph

72 Commits

Author SHA1 Message Date
Wez Furlong
de13e17723 ssh: explicitly allow ssh-rsa keys in tests
It looks like the debian 9 test failures with libssh are the
same underlying issue as https://github.com/wez/wezterm/issues/1262

Poking around in the debug output, and then spelunking through the code,
we can use the `pubkeyacceptedtypes` ssh config option to add the key
type to the list of keys.  This doesn't appear to be a documented
option in the current versions of openssh.

I'm not 100% sure that this is right, but it's worth a shot.
2021-12-15 22:05:24 -07:00
Wez Furlong
d6ef3c67c5 ssh: improve diagnostics to debug failing integration test 2021-12-15 11:39:00 -07:00
Wez Furlong
8b58f28125 wezterm-ssh: default to libssh2. mux: revise bootstrap_via_ssh
This commit revises the tls domain bootstrap via ssh code and
makes it work again from a windows client.
2021-12-15 11:10:16 -07:00
Wez Furlong
f398f333cd ssh: make -v option work on Windows, adjust config overlaying
Route logging via the `log` crate because on Windows there is
no stderr visible to libssh.

libssh will override any explicitly set options when it parses
the config file, so we need to apply those after we've loaded it.
2021-12-15 09:18:00 -07:00
Wez Furlong
421bcd25c1 ssh: allow partial auth
Some systems employ multi-stage authentication, so allow for that
to work.
2021-12-15 08:58:21 -07:00
Wez Furlong
7926c31209 pty: introduce ChildKiller trait
In the mux layer, we have some code that takes a `Child` and then
does a bit of naughty reaching through the abstraction to get at
the pid/handle of the child so that we can send it signals even
if the child is itself mutably (and thus exclusively) borrowed
for the purposes of waiting.

That worked fine for local processes spawned in the mux, but we also
use LocalPane to wrap around arbitrary `Child`ren, such as Ssh,
that are not local and that don't have a local process id, which
meant that this hack wouldn't work for them.

To make things a bit worse, those ssh ptys were used to ssh2 days
where we didn't have a way to signal the remote process and just
did nothing, leading to confusing situations such as
https://github.com/wez/wezterm/issues/1197

This commit graduates the hack mentioned in the first paragraph
to its own ChildKiller trait.  This makes the concept of waiting
for the Child distinct from signalling it and explicitly allows
getting a separate object that can be used for signalling.

With that in place, we're forced to implement something appropriate
for the ssh pty implementations; one in the pty crate itself,
one in wezterm-ssh and the wrapper that we use in the mux crate.

The upshot of this is that the `CloseCurrentPane` action now operates
correctly on panes that were the result of split operations.
2021-12-11 08:40:26 -07:00
nick black
3092443f89 provide missing positional arguments to diagnostics 2021-11-19 14:47:05 -08:00
Wez Furlong
b8ff61da5b ssh: allow wezterm ssh -v to log verbose diagnostics to stderr
Feels generally useful
2021-10-25 15:56:36 -07:00
Wez Furlong
124248028f ssh: enable proxycommand overrides via command line for libssh backend 2021-10-21 07:18:26 -07:00
Wez Furlong
561eaa69be ssh: adopt dispatch helper in a couple more places 2021-10-19 20:33:30 -07:00
Wez Furlong
5ada8e20cc ssh: adopt dispatch helper for ssh file and dir requests too
@chipsenkbeil: I spotted a latent bug in here that got fixed as
a side effect of this change.  For `write_file` and possibly others,
reply.try_send was only called in the case where file_id was valid.
For an invalid id, I think the caller could hang.

Not sure if this was a problem in practice, but I wonder if it might
have contributed to some of the weird state issues you mentioned.
2021-10-19 20:33:30 -07:00
Wez Furlong
74b763a3f6 ssh: remove some boilerplate 2021-10-19 20:33:30 -07:00
Wez Furlong
199fd6f52f ssh: use only the first known host location for libssh 2021-10-19 20:33:30 -07:00
Wez Furlong
8be442e39b ssh: can now pass e2e tests using libssh backend 2021-10-19 20:33:30 -07:00
Wez Furlong
390fcc56ca ssh: stub out DirWrap::read_dir for libssh 2021-10-19 20:33:30 -07:00
Wez Furlong
e3f5174dcc ssh: introduce separate Dir and DirWrap types 2021-10-19 20:33:30 -07:00
Wez Furlong
9d44cc1720 ssh: introduce SftpWrap 2021-10-19 20:33:30 -07:00
Wez Furlong
a6022f5c65 ssh: allow selecting libssh or ssh2 backend via config
Pass this via the ssh option overrides:

```
wezterm ssh -o wezterm_ssh_backend=libssh hostname
```
2021-10-19 20:33:30 -07:00
Wez Furlong
1f073db776 ssh: flatten out session module 2021-10-19 20:33:30 -07:00
Wez Furlong
75f946c22c ssh: split SessionWrap out 2021-10-19 20:33:30 -07:00
Wez Furlong
65eaa44b0d ssh: split FileWrap out 2021-10-19 20:33:30 -07:00
Wez Furlong
e8b83b29c9 ssh: split ChannelWrap out 2021-10-19 20:33:30 -07:00
Wez Furlong
228df03059 ssh: move sftp module to top level
was getting too deep in there!
2021-10-19 20:33:30 -07:00
Wez Furlong
44bbfd2894 ssh: split SessionInner, out 2021-10-19 20:33:30 -07:00
Wez Furlong
bd47566681 ssh: Improve some logging/diagnostics 2021-10-19 20:33:30 -07:00
Wez Furlong
a8b64a2756 Run with libssh
This works, but on macOS, there is a segfault in openssl when the
session is closed... I'm going to try this on Linux to see if it
is consistent behavior and ponder next steps.
2021-10-19 20:33:30 -07:00
Wez Furlong
0bf50924b1 ssh: stub out libssh impl 2021-10-19 20:33:30 -07:00
Wez Furlong
f1e5c59566 ssh: introduce wrapper enum
This is a pre-cursor step to adding libssh support
2021-10-19 20:33:30 -07:00
Wez Furlong
2da43e3666 ssh: unwrap -> error handling
The port number is guaranteed to be set in the config parser,
just like for the host and user, so the unwrap is "OK", but it's
less brittle to handle the error consistent with the others here.
2021-10-10 15:03:21 -07:00
Chip Senkbeil
56c366cc45 Remove Metadata::len and Metadata::is_readonly; replace sftp unwrap() with expect() 2021-10-10 14:54:45 -07:00
Chip Senkbeil
2415a44d74 Switch to camino::{Utf8PathBuf, Utf8Path} 2021-10-10 14:54:45 -07:00
Chip Senkbeil
1ff2a1eb82 Add bitflags type safety to sftp flags 2021-10-10 14:54:45 -07:00
Chip Senkbeil
d15789d2c0 Finish refactoring names of methods based on wez feedback 2021-10-10 14:54:45 -07:00
Chip Senkbeil
c3516341cb Apply renames from code review (needs full refactoring)
Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2021-10-10 14:54:45 -07:00
Chip Senkbeil
072bb1c470 Create SftpError type and associated structs to provide more verbose errors for sftp 2021-10-10 14:54:45 -07:00
Chip Senkbeil
4a0376e6de Refactor exposed ssh2 types to wrapper types 2021-10-10 14:54:45 -07:00
Chip Senkbeil
86c307a214 Add tests for File::readdir and File::stat; change .cirrus.yml to set home directory permissions 2021-10-10 14:54:45 -07:00
Chip Senkbeil
2e19344b22 Add drop impl to file struct; add missing file methods (untested) 2021-10-10 14:54:45 -07:00
Chip Senkbeil
50a0372e17 Fix file asyncread and asyncwrite future handling by keeping stateful futures 2021-10-10 14:54:45 -07:00
Chip Senkbeil
d797b3f27e Add tests for remaining sftp methods off of sftp channel -- 4 are failing 2021-10-10 14:54:45 -07:00
Chip Senkbeil
259ac04ce5 Refactor sftp interaction into a separate struct that uses SessionSender underneath 2021-10-10 14:54:45 -07:00
Chip Senkbeil
23fd145ceb Rewrite File to be smol::io::{AsyncRead, AsyncWrite} 2021-10-10 14:54:45 -07:00
Chip Senkbeil
9c8bdfd177 Add untested sftp methods 2021-10-10 14:54:45 -07:00
Chip Senkbeil
55b85b5424 Re-export portable_pty::Child as it is available in a public API 2021-10-10 14:54:45 -07:00
Chip Senkbeil
e25c4f4a22 Re-export filedescriptor::FileDescriptor as it is available in a public API 2021-10-10 14:54:45 -07:00
Wez Furlong
8da9196491 ssh: Host is space delimited, not comma delimited
closes: #1196
2021-10-03 08:09:04 -07:00
Wez Furlong
7dd77a03da ssh: improve error message around setenv failing
refs: #1015
2021-08-16 09:40:33 -07:00
Wez Furlong
f6a7df9678 ssh: avoid looping forever if the connection drops
I saw this in the stderr logs when the connection was offline:

```
 2021-07-17T01:54:28.036Z ERROR wezterm_ssh::session           > Failed to write data to channel: Failure while draining incoming flow. Now
what?
 2021-07-17T01:54:28.036Z ERROR wezterm_ssh::session           > Failed to write data to channel: Failure while draining incoming flow. Now
what?
 2021-07-17T01:54:28.142Z ERROR wezterm_ssh::session           > Failed to write data to channel: Failure while draining incoming flow. Now
what?
```

This commit propagates the error rather than logging and ignoring it.

In addition, remove a couple of sources of blocking or panicking
that are now unmasked by this.

Possibly the root cause of https://github.com/wez/wezterm/issues/857
2021-07-16 19:31:37 -07:00
Wez Furlong
ba42367fbf ssh: expand %u token 2021-06-30 13:32:55 -07:00
Wez Furlong
f43388c72d ssh: also read windows system ssh config file 2021-06-30 12:19:40 -07:00