1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 23:04:49 +03:00
Commit Graph

129 Commits

Author SHA1 Message Date
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
d635512138 wezterm-ssh: restore dep after cargo publish 2021-10-10 16:38:03 -07:00
Wez Furlong
163783f483 wezterm-ssh: prep for cargo publish 2021-10-10 16:35:12 -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
9a8a0f35e7 Update realpath test to support error or ok 2021-10-10 14:54:45 -07:00
Chip Senkbeil
0cc426df7d Reenable PAM as Fedora was complaining about it being disabled 2021-10-10 14:54:45 -07:00
Chip Senkbeil
4befffccd4 Add ignore attr to non-linux/non-macos tests 2021-10-10 14:54:45 -07:00
Chip Senkbeil
7d5c301c66 Ensure /run/sshd exists, explicitly set username in sshd fixture, add back use_privilege_mode no 2021-10-10 14:54:45 -07:00
Chip Senkbeil
d98a2cbbc2 Remove deprecated privilege separation from sshd 2021-10-10 14:54:45 -07:00
Chip Senkbeil
1dd3d5cdf0 Update tests to generate keys using old PEM format 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
35043e9341 Fix four failing tests and clean up sshd setup to not require ssh-add 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
ec09a6ab68 Add tests for stat and lstat 2021-10-10 14:54:45 -07:00
Chip Senkbeil
dc61ba2774 Add a couple more tests for sftp to cover mkdir and rmdir 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
fca3bd6904 Add some initial tests to wezterm-ssh, ignoring read/write of file as those are hanging 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
Chip Senkbeil
2c69c306b6 Bump to 0.2.0 2021-10-10 14:54:45 -07:00
Chip Senkbeil
e7110b20c4 Expose vendored-openssl feature of ssh2 from wezterm-ssh 2021-10-10 14:54:45 -07:00
Wez Furlong
bb2c534a56 ssh: my openssl+windows ssh2 patch was published upstream
So remove my local patch
2021-10-10 07:29:54 -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
91d6344180 weird dependency hack for mac+windows
Adding an edge from wezterm-ssh -> async_ossl causes the
openssl vendoring feature selection logic to trigger, which
in turn allows `cargo build -p window --examples` to succeed
again on macos.
2021-07-09 20:34:42 -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
Wez Furlong
d3deca60cd ssh-config: allow multiple IdentityFile lines in ssh config
The man page states:

> For each parameter, the first obtained value will be used.

but then later says:

> It is possible to have multiple identity files specified in
> configuration files; all these identities will be tried in sequence.
> Multiple IdentityFile directives will add to the list of identities
> tried (this behaviour differs from that of other configuration
> directives).

So that's what this commit does
2021-06-30 12:08:28 -07:00
Wez Furlong
d657721163 fix lingering ssh connections
Similar to 3f6ff534d3, we need to
tickle the mux to detect when the session terminates.

In this case we can relatively simply schedule an async wait without
spawning an additional thread.
2021-05-28 22:16:31 -07:00
Wez Furlong
3093fb3eb6 wezterm-ssh: process Include statements
refs: https://github.com/wez/wezterm/issues/824
2021-05-28 22:16:24 -07:00
Wez Furlong
3f6ff534d3 windows: fix lingering cmd.exe panes
Since removing the regular periodic background tasks, we're now
prone to not noticing child processes exiting.

This commit explicictly schedules a thread to do that on Windows
so that we can close a tab as soon as it exits.
2021-05-28 15:11:29 -07:00
Wez Furlong
f78190ec9c filedescriptor: remove anyhow from public interface
Use thiserror instead
2021-05-23 14:24:01 -07:00
Wez Furlong
494fa999bb fix system ssh config path 2021-05-03 19:54:09 -07:00
Wez Furlong
57ab9e36f5 restore features post wezterm-ssh release 2021-05-03 09:58:27 -07:00
Wez Furlong
4af66ff4b1 wezterm-ssh: prep for release 2021-05-03 09:57:04 -07:00
Wez Furlong
e119313e37 ssh: add basic support for Match Host, Match User in ssh_config parser 2021-05-01 08:53:51 -07:00
Wez Furlong
49b0ef2356 wezterm-ssh: restore win32 build feature 2021-04-30 10:30:06 -07:00
Wez Furlong
5fb2db10fe prep for wezterm-ssh release
This temporarily disables the win32 openssl build stuff; need
https://github.com/alexcrichton/ssh2-rs/pull/216 to land before
this package can publish with that feature.
2021-04-30 10:27:39 -07:00
Wez Furlong
5b9be21165 prep for pty 0.4 release 2021-04-30 10:17:25 -07:00
Wez Furlong
3df9527371 ssh: expand ~/ in ssh config
refs: https://github.com/wez/wezterm/issues/729
2021-04-24 19:25:51 -07:00
Wez Furlong
ecc500af05 ssh: don't override the ssh config User value 2021-04-08 16:17:49 -07:00
Wez Furlong
3ee86a2e8b wezterm-ssh: don't assume sh is in /bin
This improves compat with nixos
2021-03-29 21:11:54 -07:00
Wez Furlong
c6cd1a6a33 add placeholder for agent forwarding
It's not fully implemented by libssh2.
refs: https://github.com/libssh2/libssh2/issues/535
2021-03-28 18:27:03 -07:00
Wez Furlong
98604ff52e Add support for ProxyCommand
`wezterm ssh "-oProxyCommand=nc localhost 22" localhost`

refs: #233
2021-03-28 08:58:26 -07:00
Wez Furlong
f6db68564b wezterm-ssh: don't accidentally blend stdout into stderr 2021-03-28 07:29:57 -07:00
Wez Furlong
369888c94e wezterm-client: cut over to new wezterm-ssh bits
refs: https://github.com/wez/wezterm/issues/507
2021-03-28 07:18:38 -07:00
Wez Furlong
99131a2a98 fixup build on windows, and update tests 2021-03-27 20:40:40 -07:00
Wez Furlong
e103653923 RemoteSshDomain now uses wezterm-ssh crate
There are a few notable changes as a result:

* A number of `.ssh/config` options are now respected; host matching
  and aliasing and identity file are the main things
* The authentication prompt is inline in the window, rather than
  popping up a separate authentication window

Refs: https://github.com/wez/wezterm/issues/457
2021-03-27 18:12:34 -07:00
Wez Furlong
13f13d7309 wezterm-ssh: add pubkey based auth
I can't get this to succeed though; I suspect there may be a lingering
bug from libssh2 and/or trailing support for newer openssh features.

refs: https://github.com/wez/wezterm/issues/457
2021-03-26 23:54:57 -07:00
Wez Furlong
6bb941b653 wezterm-ssh: flesh out improved ssh crate
This implementation should be less prone to stutters/stalls
than my earlier hacky implementation in pty/src/ssh.rs
2021-03-26 21:57:44 -07:00
Wez Furlong
945c95faa7 fixup .ssh path on windows 2021-03-26 10:03:22 -07:00
Wez Furlong
bc5c1fcfc4 wezterm-ssh: set defaults for user, port and agent 2021-03-26 08:51:12 -07:00
Aaron Abramov
786888ce0a update k9 to 0.11.0 to make it work with rustc@1.51.0
1.51.0 no longer takes non string literals in `panic()`. k9@0.11.0 fixes that
2021-03-25 10:39:00 -07:00
Wez Furlong
dfca18db02 add hostname to ssh config map 2021-03-23 21:18:03 -07:00
Wez Furlong
b0572bbf1f Add ssh_config parser
refs: https://github.com/wez/wezterm/issues/457
2021-03-23 12:58:41 -07:00