Commit Graph

65 Commits

Author SHA1 Message Date
Connor Peet
036d8e31b2 cli: use the legacy server for environment with prereq detection skipped (#210952)
Fixes #210029
2024-04-22 21:18:15 +02:00
Connor Peet
26edf9ca9f cli: add progress for extraction (#209499)
For https://github.com/microsoft/vscode-remote-tunnels/issues/724
2024-04-03 17:08:49 -07:00
Connor Peet
2efb6a9f8c cli: allow downloading legacy servers for older glibc versions (#204194)
* cli: allow downloading legacy servers for older glibc versions

Refs #206790

* chore: update asset name

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2024-03-21 11:01:24 -07:00
Connor Peet
1ab312aeed cli: try to automatically reload services during tunnel service install (#208119)
Fixes #208094
2024-03-19 15:29:30 -07:00
Connor Peet
7015a87618 cli: avoid adoption of tunnels with existing host connections (#208033)
Fixes https://github.com/microsoft/vscode-remote-release/issues/9655
2024-03-18 19:44:07 +01:00
Aiday Marlen Kyzy
487e155ebb Merge pull request #16 from devdiv-microsoft/connor4312/msrc/use-token-file
MSRC Fix for February 2024 Patch Tuesday
2024-03-12 11:02:18 -07:00
Connor Peet
9a07ceb9f7 cli: ensure the canonical snap exe is used for the CLI (#206133)
Fixes #204907
2024-02-23 15:02:22 -08:00
Robo
cf7ddbb51d fix: use legacy server as default with additional warnings (#204377)
* ci: switch to glibc 2.17 remote server

* chore: signal user about unsupported connection

* chore: address review comments

* chore: update nodejs build

* chore: bump distro

* chore: lower the minimum requirements

* fix: glibc version check

* chore: remove explicit connection disposal
2024-02-06 11:25:58 +01:00
Connor Peet
7e0c93cec5 cli: skip integrity check when prereq skip flag is present (#203912) 2024-01-31 18:33:55 +01:00
Robo
fc9dcad098 fix: skip server requirements check based on file presence (#203729) 2024-01-29 19:55:17 +01:00
Connor Peet
f58d7ff83d cli: fix GLIBC version requirement hardcoded in error message (#202605)
Fixes #202082
2024-01-16 11:34:18 -08:00
Connor Peet
68bc4c82c8 cli: update server prereq versions (#201261)
Fixes #201129
2023-12-20 14:27:09 +09:00
Connor Peet
4aa04c7db2 cli: add extra fs operations for container
Ref https://github.com/microsoft/vscode-remote-tunnels/issues/695
2023-10-18 20:28:02 -07:00
Connor Peet
e250c8066d cli: fix command prompt showing up on windows (#194946)
cli: fix wsl prompt up on windows machine

Fixes #190425 again
2023-10-06 17:09:47 +01:00
Connor Peet
4fa7137b05 cli: add more details if untar fails
For #192647
2023-09-21 14:37:33 -07:00
Connor Peet
1fe8359ed0 cli: implement 'server of server' for a local web server (#191014)
Closes https://github.com/microsoft/vscode/issues/168492

This implements @aeschli's 'server server' concept in a new
`code serve-web` command.

Command line args are similar to the standalone web server. The first
time a user hits that page, the latest version of the VS Code web server
will be downloaded and run. Thanks to Martin's previous PRs, all
resources the page requests are prefixed with `/<quality-<commit>`.

The latest release version is cached, but when the page is loaded again
and there's a new release, a the new server version will be downloaded
and started up.

Behind the scenes the servers all listen on named pipes/sockets and the
CLI acts as a proxy server to those sockets. Servers without connections
for an hour will be shut down automatically.
2023-08-22 17:29:51 -07:00
Connor Peet
5a14d85f48 cli: adding forwarding for local port for remote tunnels (#188715)
This reuses a lot of the logic we use for the normal VS Code Server
tunnel to do port forwarding. It does use a _different_ tunnel than what
Remote Tunnels would otherwise use for the control server. The reason
for this is that ports exist on a tunnel instance, and if we reused the
same tunnel then a client would expect all CLI hosts to serve all
tunnels, where the port forwarding instance would not provide the VS
Code server. It also reuses the singleton logic so all ports on a
machine are handled by a single CLI instance for the same reason: we
can't have different instances hosting subsets of
ports on a single tunnel.

Currently all ports are under the default privacy: support for
public/private tunnels is either later today or next iteration.
2023-07-24 15:12:21 -07:00
Connor Peet
b5038f81d1 cli: allow exec server to listen on a port and require token authentication (#188434)
* cli: allow exec server to listen on a port and require token authentication

For remote ssh on Windows where pipe forwarding doesn't work

* fix linux build
2023-07-21 18:32:20 +02:00
Connor Peet
30fde0d369 fix: stall on "starting new singleton" on linux if keychain blocks (#187182)
Adds a 5s timeout to keychain access on Linux. We had an issue about this a long time ago, but I never repro'd it until today and can't find the original...

If this timeout is hit, it'll fall back to the file-based keychain.
2023-07-06 23:49:31 +02:00
Connor Peet
2f867fa7a1 cli: fix macos build (#185401) 2023-06-17 09:38:58 +09:00
Connor Peet
8a006c7114 cli: improve dbus error messaging on linux
Fixes https://github.com/microsoft/vscode-remote-release/issues/7778
2023-06-16 14:45:26 -07:00
Connor Peet
8a74ad8ff5 cli: show service status in tunnel log
Fixes #183714
2023-06-16 10:42:13 -07:00
Connor Peet
1942c0eccc cli: ensure ordering of rpc server messages (#183558)
* cli: ensure ordering of rpc server messages

Sending lots of messages to a stream would block them around the async
tokio mutex, which is "fair" so doesn't preserve ordering. Instead, use
the write_loop approach I introduced to the server_multiplexer for the
same reason some time ago.

* fix clippy
2023-05-26 18:48:06 +02:00
Connor Peet
679bb967c3 cli: add stdio control server
* signing: implement signing service on the web

* wip

* cli: implement stdio service

This is used to implement the exec server for WSL. Guarded behind a signed handshake.

* update distro

* rm debug

* address pr comments
2023-05-19 17:19:52 +02:00
Martin Aeschlimann
0c85b95c48 stop tunnel when executable gets deleted (#181505)
stop when executable gets deleted
2023-05-09 09:25:51 +02:00
Connor Peet
d54402822a cli: fix mutex names contain extra characters (#181335)
Fixes #181334
2023-05-02 17:16:17 +02:00
Connor Peet
cedf1eaa25 cli: add new control server messages for wsl (#180438)
* cli: add new control server messages for wsl

* support cwd in spawn
2023-04-20 15:19:05 -07:00
Connor Peet
f743297aa1 cli: add acquire_cli (#179837)
* cli: add acquire_cli

As given in my draft document, pipes a CLI of the given platform to the
specified process, for example:

```js
const cmd = await rpc.call('acquire_cli', {
	command: 'node',
	args: [
		'-e',
		'process.stdin.pipe(fs.createWriteStream("c:/users/conno/downloads/hello-cli"))',
	],
	platform: Platform.LinuxX64,
	quality: 'insider',
});
```

It genericizes caching so that the CLI is also cached on the host, just
like servers.

* fix bug
2023-04-13 19:18:48 +01:00
Connor Peet
2d8ff25c85 cli: add streams to rpc, generic 'spawn' command (#179732)
* cli: apply improvements from integrated wsl branch

* cli: add streams to rpc, generic 'spawn' command

For the "exec server" concept, fyi @aeschli.

* update clippy and apply fixes

* fix unused imports :(
2023-04-12 16:51:29 +01:00
Connor Peet
b547b58db6 cli: use win32 app mutex to detect running tunnels and tunnel sevices (#179622)
* cli: fix distro mixin

* cli: use win32 app mutex to detect running tunnels and tunnel sevices

Fixes #179265

* cli: fix distro mixin more

* fix

* fix build
2023-04-10 20:25:14 +01:00
Connor Peet
3d7f6dec00 cli: fix tunnel message command (#178079)
Fixes #177394
2023-03-22 14:44:49 -07:00
Connor Peet
eab8ba65bf cli: add tunnel status command (#177381)
Fixes #177372
2023-03-16 12:26:56 -07:00
Connor Peet
abab52dd94 cli: add tunnel kill/restart subcommands (#177286) 2023-03-15 15:09:12 -07:00
Connor Peet
0e7d14d32d cli: allow client process to control singleton process (#177141)
Other connected clients will now print:

```
Connected to an existing tunnel process running on this machine. You can press:

- Ctrl+C to detach
- "x" to stop the tunnel and exit
- "r" to restart the tunnel
```

These are then sent to the server to have that take effect. This is
mostly some refactors in the singleton_server to make the lifecycle work.
2023-03-14 17:55:28 -07:00
Connor Peet
1b5fd140fb Run tunnels as singleton process (for a --cli-data-dir) (#177002)
* wip on singleton

* wip

* windows support

* wip

* wip

* fix clippy
2023-03-14 08:09:47 -07:00
Connor Peet
40f31f92d0 cli: fix download for arm32 linux (#173374)
Once again, wishing target_* were statically typed...

Fixes https://github.com/microsoft/vscode-remote-release/issues/7631
2023-02-03 13:30:31 -08:00
Connor Peet
618da1e00a cli: fix arch check for musl arm64 (#172092)
Fixes https://github.com/microsoft/vscode-remote-release/issues/7812

Wish Rust had compilation errors for bad compile time checks :(
2023-01-23 16:50:24 -08:00
Connor Peet
4d882322ca cli: start to extract a generic rpc interface (#171299)
I want to use the rpc interface for communication via stdin/out in wsl,
but currently RPC is tightly coupled to the control server. The control
server also speaks msgpack instead of JSON, since it deals with binary
messages. WSL won't, and we'll want to use JSON to interact with VS
Code, so some separation is needed.

This pulls out a base set of RPC types for use in both scenarios.
Currently these are only 'helper' structs that don't actually do any
i/o, but once I figure out the model I would like to have a cleaner way
to do i/o in a unified way as well.

For the control server, previously we basically handled all methods in
one big `switch` block with nasty macros, whereas now there's
nicer `register_a/sync` functions.

Some additional small refactors were needed to preserve the strict
ordering of server messages, since they need to be order else we get
decompression errors. This is the `start_bridge_write_loop`. As a small
benefit, this means we can avoid the relatively expensive async Tokio
mutex that we were using, and instead use the standard library mutex.
2023-01-16 21:43:41 -08:00
Connor Peet
b5ad508dfb cli: cleanup some process querying code (#170306)
Avoid pulling system info we don't have to.

Minor cleanups while working on https://github.com/microsoft/vscode/pull/170305
2022-12-30 12:55:57 -08:00
Connor Peet
82b239204c cli: print oauth errors better, respect slow_down (#169164)
For diagnosing https://github.com/microsoft/vscode/issues/169066
2022-12-14 14:06:24 -05:00
Connor Peet
fb53973c5f cli: pull documentation url from product.json (#166993)
Fixes https://github.com/microsoft/vscode-cli/issues/560
2022-11-22 11:21:41 -08:00
Connor Peet
796ee2bf3c chore: pull more strings from the product.json (#166769)
Fixes the bulk of https://github.com/microsoft/vscode-cli/issues/560
2022-11-18 18:52:52 -08:00
Connor Peet
03798c3b1d cli: look for ldconfig in the right location for 32 bit installs (#166723)
See https://github.com/microsoft/vscode-remote-release/issues/7495\#issuecomment-1320331537
2022-11-18 13:34:34 -05:00
Connor Peet
9dd6dc2874 cli: check glibc version more correctly on gnu (#166622)
Fixes https://github.com/microsoft/vscode-remote-release/issues/7495
2022-11-17 11:16:30 -08:00
Connor Peet
707f91aaa6 cli: fix 'failed to lookup tunnel' with a name given (#166507)
Fixes https://github.com/microsoft/vscode-cli/issues/563

If a new tunnel `--name` was provided but the existing tunnel was deleted,
the CLI would error out with a lookup failed message. Instead it now
recreates it like it normally would.
2022-11-16 14:10:49 -08:00
Connor Peet
e996746b14 add observability for windows 2022-11-15 20:38:18 -08:00
Connor Peet
1bf3323015 cli: add service integration for macos, observability
Adds support for running the tunnel as a service on macOS via launchservices.

It also hooks up observability (`code tunnel service log`) on macOS and Linux.
On macOS--and later Windows, hence the manual implementation of `tail`--it
saves output to a log file and watches it. On Linux, it simply delegates to
journalctl.

The "tailing" is implemented via simple polling of the file size. I didn't want
to pull in a giant set of dependencies for inotify/kqueue/etc just for this use
case; performance when polling a single log file is not a huge concern.
2022-11-15 15:39:58 -08:00
Connor Peet
0cd1422809 cli: skip glibc check for nixos
Fixes https://github.com/microsoft/vscode-remote-release/issues/7129
2022-11-11 13:32:41 -08:00
Connor Peet
446be2cd8b fixup! clippy suggestion 2022-11-10 09:30:50 -08:00
Connor Peet
d31573550f cli: implement local download fallback
Implements an automatic local download fallback, similar to SSH
(cc @roblourens). If the initial download results in an error, either
in making the request or a 5xx, it'll try to fall back to making the
request locally and streaming it over the tunnel.

This abstracts the request client behing a "SimpleHttp" trait which
either uses to the native reqwest or uses the 'delegated' mode over the
socket.
2022-11-09 15:27:47 -08:00