Kayla Washburn-Love
d8e0be6ee6
feat: add support for multiple banners ( #13081 )
2024-05-08 15:40:43 -06:00
Mathias Fredriksson
c63f569174
refactor(agent/agentssh): move envs to agent and add agentssh config struct ( #12204 )
...
This commit refactors where custom environment variables are set in the
workspace and decouples agent specific configs from the `agentssh.Server`.
To reproduce all functionality, `agentssh.Config` is introduced.
The custom environment variables are now configured in `agent/agent.go`
and the agent retains control of the final state. This will allow for
easier extension in the future and keep other modules decoupled.
2024-02-19 16:30:00 +02:00
Mathias Fredriksson
f2aef0726b
fix(agent/agentssh): allow scp to exit with zero status ( #12028 )
...
Fixes #11786
2024-02-07 10:22:31 +02:00
Steven Masley
081fbef097
fix: code-server path based forwarding, defer to code-server ( #11759 )
...
Do not attempt to construct a path based port forward url.
Always defer to code server, as it has it's own proxy method.
2024-01-23 11:36:44 -06:00
Asher
72d9ec07aa
fix: detect JetBrains running on local ipv6 ( #11676 )
2024-01-17 14:08:15 -09:00
Spike Curtis
b173195e0d
Revert "fix: detect JetBrains running on local ipv6 ( #11653 )" ( #11664 )
...
This reverts commit 2d61d5332a
.
2024-01-17 15:38:39 +04:00
Asher
2d61d5332a
fix: detect JetBrains running on local ipv6 ( #11653 )
2024-01-16 15:53:41 -09:00
Mathias Fredriksson
385d58caf6
fix(agent/agentssh): allow remote forwarding a socket multiple times ( #11631 )
...
* fix(agent/agentssh): allow remote forwarding a socket multiple times
Fixes #11198
Fixes https://github.com/coder/customers/issues/407
2024-01-16 21:26:13 +02:00
Mathias Fredriksson
b1d53a68c2
fix(agent/agentssh): fix X11 forwarding by improving Xauthority management ( #11550 )
...
Fixes #11531
2024-01-10 19:04:44 +02:00
Mathias Fredriksson
df3c310379
feat(cli): add `coder open vscode` ( #11191 )
...
Fixes #7667
2024-01-02 20:46:18 +02:00
Spike Curtis
4071f1713b
feat: add logging to agent stats and JetBrains tracking ( #11364 )
...
Adds logging so we can hope to diagnose #11363
2024-01-02 13:34:49 +04:00
Spike Curtis
edeb9bb42a
fix: appease linter on darwin ( #11154 )
...
Fixing up some linting errors that show up on Darwin, but not in CI.
2023-12-12 17:02:28 +04:00
Steven Masley
8221544514
chore: check if process is nil ( #11090 )
...
* chore: check if process is nil
We check if process is nil in the ports_supported file.
Just matching that defensive check, not sure if it can be nil.
2023-12-07 22:23:42 +00:00
Asher
dbbf8acc26
fix: track JetBrains connections ( #10968 )
...
* feat: implement jetbrains agentssh tracking
Based on tcp forwarding instead of ssh connections
* Add JetBrains tracking to bottom bar
2023-12-07 12:15:54 -09:00
Spike Curtis
6c67add2d9
fix: detect and retry reverse port forward on used port ( #10844 )
...
Fixes #10799
The flake happens when we try to remote forward, but the port we've chosen is not free. In the flaked example, it's actually the SSH listener that occupies the port we try to remote forward, leading to confusing reads (c.f. the linked issue).
This fix simplies the tests considerably by using the Go ssh client, rather than shelling out to OpenSSH. This avoids using a pseudoterminal, avoids the need for starting any local OS listeners to communicate the forwarding (go SSH just returns in-process listeners), and avoids an OS listener to wire OpenSSH up to the agentConn.
With the simplied logic, we can immediately tell if a remote forward on a random port fails, so we can do this in a loop until success or timeout.
I've also simplified and fixed up the other forwarding tests. Since we set up forwarding in-process with Go ssh, we can remove a lot of the `require.Eventually` logic.
2023-11-27 09:42:45 +04:00
Mathias Fredriksson
61be4dfe5a
fix: improve exit codes for agent/agentssh and cli/ssh ( #10850 )
2023-11-24 14:35:56 +02:00
Mathias Fredriksson
dbdcad0d09
test(agent/agentssh): fix flake in signal test ( #10855 )
2023-11-24 13:47:40 +02:00
Mathias Fredriksson
2c6e0f7d0a
feat(agent/agentssh): handle session signals ( #10842 )
2023-11-23 19:55:36 +02:00
Steven Masley
e448c10122
chore: add uuid's to ssh sessions for logging ( #10721 )
...
* chore: add uuid to ssh connection logs
2023-11-17 16:04:23 +00:00
Spike Curtis
f400d8a0c5
fix: handle SIGHUP from OpenSSH ( #10638 )
...
Fixes an issue where remote forwards are not correctly torn down when using OpenSSH with `coder ssh --stdio`. OpenSSH sends a disconnect signal, but then also sends SIGHUP to `coder`. Previously, we just exited when we got SIGHUP, and this raced against properly disconnecting.
Fixes https://github.com/coder/customers/issues/327
2023-11-13 15:14:42 +04:00
Steven Masley
63a4f5f4a7
fix: case insensitive magic label ( #10592 )
2023-11-08 11:17:14 -06:00
Kyle Carberry
54648b90ca
fix: properly trim spaces so multi-line shebang executes ( #10146 )
2023-10-09 19:19:57 +00:00
Kyle Carberry
b402f2a816
feat: add shebang support to scripts ( #10134 )
...
This enables much greater portability!
2023-10-09 10:57:57 -05:00
Steven Masley
e0e6d7c9a6
fix: case insensitve agent ssh session env var ( #9675 )
2023-09-13 14:18:00 -05:00
Kyle Carberry
22e781eced
chore: add /v2 to import module path ( #9072 )
...
* chore: add /v2 to import module path
go mod requires semantic versioning with versions greater than 1.x
This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```
Migrate generated files to import /v2
* Fix gen
2023-08-18 18:55:43 +00:00
Mathias Fredriksson
34c3f919dc
fix(agent/agentssh): check for hushlogin via afero fs ( #8358 )
2023-07-07 13:30:23 +03:00
Mathias Fredriksson
3f058f28e7
test(agent): use afero for motd tests to allow parallel execution ( #8329 )
2023-07-06 10:57:51 +03:00
Asher
6015319e9d
feat: show service banner in SSH/TTY sessions ( #8186 )
...
* Allow workspace agents to get appearance
* Poll for service banner every two minutes
* Show service banner before MOTD if not quiet
2023-06-30 10:41:29 -08:00
Spike Curtis
e738123a9c
chore: log ssh connection disconnects with errors ( #8143 )
...
Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-22 11:37:50 +04:00
Marcin Tojek
4fb4c9b270
chore: add more rules to ensure logs consistency ( #8104 )
2023-06-21 12:00:38 +02:00
Spike Curtis
1c8f564fdb
feat: add logging of ssh connections to agent ( #8096 )
...
* feat: adds logging of ssh connections to agent
Signed-off-by: Spike Curtis <spike@coder.com>
* code review improvements
Signed-off-by: Spike Curtis <spike@coder.com>
---------
Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-21 13:49:58 +04:00
Marcin Tojek
b1d1b63113
chore: ensure logs consistency across Coder ( #8083 )
2023-06-20 12:30:45 +02:00
Marcin Tojek
247f8a973f
feat: replace ssh maxTimeout with keep-alive mechanism ( #8062 )
...
* Bump up coder/ssh
* feat: Set default agent timeout to ~72h
* Address PR comments
* Fix
2023-06-16 15:22:18 +02:00
Mathias Fredriksson
74fdcb1ace
fix(agent/agentssh): wait for sessions to exit ( #8008 )
2023-06-13 17:52:31 +00:00
Ammar Bandukwala
fcca639d38
test(agent/agentssh): close SSH servers in all tests ( #7911 )
...
Potentially solves the flake seen here:
https://github.com/coder/coder/actions/runs/5167029213/jobs/9307647816 .
2023-06-07 23:43:38 +00:00
Marcin Tojek
14efdadd3c
feat: Collect agent SSH metrics ( #7584 )
2023-05-25 12:52:36 +02:00
Spike Curtis
9c030a8888
fix: pty.Start respects context on Windows too ( #7373 )
...
* fix: pty.Start respects context on Windows too
Signed-off-by: Spike Curtis <spike@coder.com>
* Fix windows imports; rename ToExec -> AsExec
Signed-off-by: Spike Curtis <spike@coder.com>
* Fix import in windows test
Signed-off-by: Spike Curtis <spike@coder.com>
---------
Signed-off-by: Spike Curtis <spike@coder.com>
2023-05-03 11:43:05 +04:00
Spike Curtis
daee91c6dc
refactor: PTY & SSH ( #7100 )
...
* Add ssh tests for longoutput, orphan
Signed-off-by: Spike Curtis <spike@coder.com>
* PTY/SSH tests & improvements
Signed-off-by: Spike Curtis <spike@coder.com>
* Fix some tests
Signed-off-by: Spike Curtis <spike@coder.com>
* Fix linting
Signed-off-by: Spike Curtis <spike@coder.com>
* fmt
Signed-off-by: Spike Curtis <spike@coder.com>
* Fix windows test
Signed-off-by: Spike Curtis <spike@coder.com>
* Windows copy test
Signed-off-by: Spike Curtis <spike@coder.com>
* WIP Windows pty handling
Signed-off-by: Spike Curtis <spike@coder.com>
* Fix truncation tests
Signed-off-by: Spike Curtis <spike@coder.com>
* Appease linter/fmt
Signed-off-by: Spike Curtis <spike@coder.com>
* Fix typo
Signed-off-by: Spike Curtis <spike@coder.com>
* Rework truncation test to not assume OS buffers
Signed-off-by: Spike Curtis <spike@coder.com>
* Disable orphan test on Windows --- uses sh
Signed-off-by: Spike Curtis <spike@coder.com>
* agent_test running SSH in pty use ptytest.Start
Signed-off-by: Spike Curtis <spike@coder.com>
* More detail about closing pseudoconsole on windows
Signed-off-by: Spike Curtis <spike@coder.com>
* Code review fixes
Signed-off-by: Spike Curtis <spike@coder.com>
* Rearrange ptytest method order
Signed-off-by: Spike Curtis <spike@coder.com>
* Protect pty.Resize on windows from races
Signed-off-by: Spike Curtis <spike@coder.com>
* Fix windows bugs
Signed-off-by: Spike Curtis <spike@coder.com>
* PTY doesn't extend PTYCmd
Signed-off-by: Spike Curtis <spike@coder.com>
* Fix windows types
Signed-off-by: Spike Curtis <spike@coder.com>
---------
Signed-off-by: Spike Curtis <spike@coder.com>
2023-04-24 14:53:57 +04:00
Kyle Carberry
fd84df769d
fix: add `DISPLAY` env var for X11 connections ( #7248 )
...
* fix: add `DISPLAY` env var for X11 connections
* Update agent/agentssh/agentssh.go
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
---------
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-04-21 16:43:49 +00:00
Kyle Carberry
f39e6a79de
feat: add support for X11 forwarding ( #7205 )
...
* feat: add support for X11 forwarding
* Only run X forwarding on Linux
* Fix piping
* Fix comments
2023-04-21 15:52:40 +00:00
Mathias Fredriksson
aa660e0631
feat(agentssh): Gracefully close SSH sessions on Close ( #7027 )
...
By tracking and closing sessions manually before closing the underlying
connections, we ensure that the termination is propagated to SSH/SFTP
clients and they're not left waiting for a connection timeout.
Refs: #6177
2023-04-06 19:57:30 +03:00
Mathias Fredriksson
0224426e5b
refactor(agent): Move SSH server into agentssh package ( #7004 )
...
Refs: #6177
2023-04-06 19:39:22 +03:00