Skip to content

[v18] Share TELEPORT_HOME between Connect and tsh#61846

Merged
gzdunek merged 16 commits intobranch/v18from
gzdunek/shared-tsh/v18
Dec 4, 2025
Merged

[v18] Share TELEPORT_HOME between Connect and tsh#61846
gzdunek merged 16 commits intobranch/v18from
gzdunek/shared-tsh/v18

Conversation

@gzdunek
Copy link
Copy Markdown
Contributor

@gzdunek gzdunek commented Nov 28, 2025

Backport #59539, #59642, #59643, #60553, #60622, #61044, #60884, #61090, #61295, #61352, #61479, #61668, #61665, #61322, #61467

changelog: Teleport Connect and tsh now share the same local state
changelog: Fixed "SSH cert not found" errors in Teleport Connect

gzdunek and others added 14 commits November 28, 2025 14:44
* Remove clusters immediately after a logout, move `useClusterLogout` to `AppContext`

* Review callsites to ensure cluster is properly checked before being accessed

* Revert "Review callsites to ensure cluster is properly checked before being accessed"

This reverts commit 8343c3c.

* Switch to removing the cluster at the end of logout sequence

* Lint

* Move `logoutWithCleanup` to `ui/ClusterLogout`

(cherry picked from commit de6b4ed)
…59642)

* Create awaitable sender

* Review comments

* Fix test and lint

(cherry picked from commit 5dc76fe)
* Create `ClusterStore` that manages cluster state

* Fix tests that mocked tshd directly

* Remove IPC to notify the main process about cluster list changes

* Load immer plugins in `MainProcess`

* Improve comments

* Refactor `useSender`

* Get rid of unnecessary Map and try/catch around send

* Get rid of `MainProcess.create`

* Do not return early `c.proxyHost` is falsy

* Add more context to test

* Add missing logout handler in main process

* Fix applying patches

* Adjust `subscribeToClusterStore` to updated `startAwaitableSenderListener`

* Crash window when sending state update fails

* Extract WebContents navigation handlers and add tests for opening links

* Improve error message

* Initialize `ClusterStore` synchronously

* Convert `lazyTshdClient` field to `getTshdClient` function, add docs

* Remove unused eslint directive

(cherry picked from commit a41d021)
* Remove `ClusterRemove` RPC, make logging out idempotent

* Move calling `removeKubeConfig` and `maybeRemoveAppUpdatesManagingCluster` to main process

The main process should not depend on the renderer to clean up its own resources.

* Remove cleaning up kube dir

* Lint

(cherry picked from commit 2d1bc7b)
* Add profile watcher

* Move `makeClusterWithOnlyProfileProperties` to `profileWatcher.ts`, improve test

* Handle watched directory removal

* Improve comments

* Make tests faster, pass abort signal everywhere

* Improve docs

* Make `removing tsh directory does not break watcher` easier to understand

* Make test dir per test

* Improve timing in tests

* Add a limit of how many events can be emitted by `fs.watch` (to break the endless stream of events on Windows when watched dir is removed), go into the polling mode only when it's expected that the watched dir was removed

* Use `expect().rejects.toThrow` correctly

* Deflake 'max file system events count is restricted'

* Replace `makeClusterWithOnlyProfileProperties` with `mergeClusterProfileWithDetails`, move it back to `cluster.ts`

* Attempt to fix tests

* Clarify comment

(cherry picked from commit d4e6f19)
* Add `ClusterLifecycleManager`

* Register handlers for adding, removing and logging out from cluster

* Provide `rootCluster` in `useWorkspaceContext`

The handlers in the profile watcher will proceed with updating the cluster store, even if the renderer handlers returned errors.
This check protects us from a runtime error if the renderer fails to remove the workspace.

* Improve docs

* Move processing queue to listener

* Make `will-` operations always interrupt main process actions

* Improve error messages

* Do not remove managing cluster when **only** logging out

The app updater displays all clusters, not just those the user is logged into.

* Revert "Provide `rootCluster` in `useWorkspaceContext`"

This reverts commit cf76d2b.

* Rename `logoutWithCleanup` to `cleanUpBeforeLogout`

* Do not pass `AbortSignal` to `this.mainProcessClient.syncRootClusters`

* Lint

* Fix types issues

* Do not stack watcher notifications

(cherry picked from commit 5fa8249)
* Include expiration time in `LoggedInUser`

This will allow the profile watcher to detect when the user relogged.

* Display expiration time in UI

* Add `ClearStaleClusterClients` RPC

* Implement `ClearStaleClusterClients`

* Clear stale clients when profile changes

* Improve session expiration component

* Move refresh button back to top

* `ClearCachedStaleClientsForRoot` -> `ClearStaleCachedClientsForRoot`

* `unchanged` -> `stale`

* Make "closing stale clients" a subtest

* Add `clientcache` test

* Remove `getProfile` error wrapping

* Improve comment

* Convert story to controls

(cherry picked from commit 6615e42)
…XY` in `tsh status` (#61295)

* Respect `TELEPORT_PROXY` env var in `tsh status`

* Enable listing profiles if there is no active profile

* Add test

* Define `err` within the block where it's actually used

* Handle missing current profile in `tsh logout`

* Make check more explicit

* Revert mistakenly commited change

(cherry picked from commit 95bec3a)
* Switch tsh home directory to ~/.tsh

* Migrate old tsh home to new location, disallow updating fields outside the `state` key in app_state.json from the renderer process

* Show banner about migrated tsh home

* `promoteMigratedTshHome` -> `showTshHomeMigrationBanner`

* `MigratedTshHomeBanner` -> `TshHomeMigrationBanner`

* 'Profiles are' -> 'Profiles are now', remove unnecessary space

* Fix assigning colors for new workspaces

* Improve logs

(cherry picked from commit 54b5f6c)
…sterLifecycleManager` (#61479)

* Detect when user's access changes

* Refresh resources in UI when `did-change-access` is received

* Add tests for `ClusterLifecycleManager`

* Add better docs for ClusterLifecycleEvent

* Test assuming requests too

* Improve test names

(cherry picked from commit 4b00520)
* Serialize all enumerable error fields

* Add wrappers around `ipcMain.handle` and `ipcRenderer.invoke`

* Fix `Method Error.prototype.toString called on incompatible receiver undefined`

* Improve docs

* Lint

(cherry picked from commit a1f2ae0)
* Initialize default Username/HostLogin only in tsh

* Move `Username()` from `api.go` to `tsh.go`

* Remove wrong `Profile.SiteName` default

* Remove resetting `SiteName`

Not sure why it was needed. Perhaps to clear the default that we just removed? But even if add the default back and remove this fix, everything works.

* Gracefully handle missing SSH/TLS certs

* Remove unused `TeleportClient.LoadKeyForClusterWithReissue`

* Revert "Move `Username()` from `api.go` to `tsh.go`"

This reverts commit f7ff0ff.

* Revert "Initialize default Username/HostLogin only in tsh"

This reverts commit ed38bab.

* When any of SSH/TLS cert is missing, return partial profile

* Only log non-nil errors

* Revert "Remove wrong `Profile.SiteName` default"

* Revert "Remove resetting `SiteName`"

This reverts commit f54ab3f.

* Set `SiteName` when adding cluster

* Improve comments

* Add test

* Fix test

* Add myself to TODO

* Add test for logging out with missing SSH cert

* Lint

(cherry picked from commit cd3c8f8)
@github-actions github-actions bot added backport size/xl tsh tsh - Teleport's command line tool for logging into nodes running Teleport. ui labels Nov 28, 2025
@public-teleport-github-review-bot
Copy link
Copy Markdown

@gzdunek - this PR will require admin approval to merge due to its size. Consider breaking it up into a series smaller changes.

* Update docs for sharing ~/.tsh directory

* Review comments

* Lint

(cherry picked from commit 19533bf)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 28, 2025

Amplify deployment status

Branch Commit Job ID Status Preview Updated (UTC)
gzdunek/shared-tsh/v18 60464dd 2 ✅SUCCEED gzdunek-shared-tsh-v18 2025-12-04 08:52:49

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from avatus December 1, 2025 16:02
@gzdunek gzdunek added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@gzdunek gzdunek added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@gzdunek gzdunek enabled auto-merge December 4, 2025 08:44
@gzdunek gzdunek added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@gzdunek gzdunek added this pull request to the merge queue Dec 4, 2025
Merged via the queue into branch/v18 with commit 7768f66 Dec 4, 2025
44 checks passed
@gzdunek gzdunek deleted the gzdunek/shared-tsh/v18 branch December 4, 2025 10:08
@aadc-dev aadc-dev mentioned this pull request Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport hold-for-18.5 size/xl tsh tsh - Teleport's command line tool for logging into nodes running Teleport. ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants