Skip to content

RFD - tsh upgrade#28337

Closed
bernardjkim wants to merge 1 commit intomasterfrom
bernard/rfd-tsh-upgrade
Closed

RFD - tsh upgrade#28337
bernardjkim wants to merge 1 commit intomasterfrom
bernard/rfd-tsh-upgrade

Conversation

@bernardjkim
Copy link
Copy Markdown
Contributor

@espadolini
Copy link
Copy Markdown
Contributor

Comment thread rfd/XXXX-tsh-upgrade.md
Comment on lines +19 to +20
One of our goals for Teleport Cloud is to increase the cadence at which clusters can be upgraded.
This requires that Teleport Agents and Teleport client tools be up to date with the latest compatible version of the cluster.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the automatic tsh upgrade process design for Cloud only or do we want to support self-hosted users as well?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be supported for self-hosted as well. Doesn't feel like there would be much difference as the client will be checking the version against the proxy endpoint.

Comment thread rfd/XXXX-tsh-upgrade.md

Detecting the version of the Teleport cluster should be straight forward.
Teleport supports a ping RPC that returns a response containing information about the Teleport version of the cluster and the minimum client version required.
In the case that the cluster version of Teleport is newer than the tsh version, the user will be prompted to upgrade.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implies there's no downgrade path? On one side, this mitigates downgrade attacks, on the other side, this means Cloud cannot perform an emergency rollback if things go sideways during a major update.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, as mentioned above let's just have the client track the server version and upgrade/downgrade as needed.

Comment thread rfd/XXXX-tsh-upgrade.md
Comment on lines +39 to +54
### Identifying installation method

The Teleport client tools should be re-installed using the original installation method.
Teleport documents several different methods for installing the client tools. https://goteleport.com/docs/installation/
- Teleport can be installed from source and built using go. This scenario can be handled the same as if Teleport was installed by downloading the pre-build binaries.
- Teleport pre-built binaries can be downloaded for the desired platform.
- Teleport can be installed through the system package managers. Teleport currently maintains DEB and RPM repositories.
- Teleport is available for installation using brew on macOS, but it is not officially supported by Teleport and not recommended.
- Teleport provides macOS installation packages. One package installs all Teleport binaries, while the other installs only the tsh client.
- Teleport provides a tsh only zip installation for windows.

Additionally, Teleport supports a couple different releases: Open Source, Enterprise, and a FIPS compliant release.
The upgrade process will need to detect which release was installed and make sure to re-install the same release.

In order to identify which installation method was used to install the Teleport client tools, various checks will be executed.
The default installation method will be downloading the pre-built binaries.
Copy link
Copy Markdown
Contributor

@hugoShaka hugoShaka Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a different process per installation method sounds tedious. We'll have to maintain one installation/update method in tsh for each system/installation-method/package combination. Extensive testing will be hard and we'll have a lot of weird edge cases + we won't support custom package managers (hello brew/chocolatey).

Is there a way to unify the update process and make it distribution-agnostic? e.g. storing tsh binaries in the user's home and installing a launcher system-wide.

Comment thread rfd/XXXX-tsh-upgrade.md

## What

A tsh subcommand that will prompt the user to upgrade if the version of tsh is older than the cluster version.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this RFD also cover tctl? From what I understand, Cloud users have to use a local tctl to perform administration operations.

If that's the case, will tctl upgrade work? Will tsh upgrade also update tctl?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tctl should be in scope.

Comment thread rfd/XXXX-tsh-upgrade.md
Comment on lines +97 to +102
$ sudo tsh upgrade
Teleport v12.0.0
Proxy version v13.1.2
Teleport client tools version is behind the Teleport cluster version, do you wish to upgrade? [y/N]:
no
Exiting without upgrading Teleport client tools. Teleport servers are compatible with clients that are on the same major version or one major version older. We recommend updating before Teleport client tools become incompatible. If you would like to upgrade manually, installation instructions can be found at https://goteleport.com/docs/installation/
Copy link
Copy Markdown
Contributor

@hugoShaka hugoShaka Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm on a Debian server A, which is running teleport (an agent, or a full-featured Teleport cluster) and want to login to a Teleport instance running on a server B (let's say cloud). Cloud is running a different version than server A. What happens when I run sudo tsh update? Does it update the whole teleport package, including my teleport process running? Should it only update tsh? tsh and tctl?

Comment thread rfd/XXXX-tsh-upgrade.md
## UX

The tsh upgrade command should simply upgrade the Teleport client tools while providing some basic observability about the currently installed version of the Teleport client tools, the Teleport cluster version, and what version the client tools will be upgraded to.
The upgrade command will require root privileges.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that many Cloud users might not have sudo/admin access on their workstations. Requiring sudo access might make us miss a lot of customers. Do we have a way to estimate what proportion of our users can run this command?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we just keep client cache somewhere we have access to, I don't think it'll need root?

Comment thread rfd/XXXX-tsh-upgrade.md
The tsh upgrade command should simply upgrade the Teleport client tools while providing some basic observability about the currently installed version of the Teleport client tools, the Teleport cluster version, and what version the client tools will be upgraded to.
The upgrade command will require root privileges.

If the Teleport client tools are up to date, simply output the client and server version and exit
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What leads the user to run tsh upgrade? Users won't think to run tsh upgrade every week. Do we want to warn each time the versions are drifting too much? (what is the definition of "too much," lower than the min supported version, as soon as there's a drift?).

Comment thread rfd/XXXX-tsh-upgrade.md
### Identifying cluster version

Detecting the version of the Teleport cluster should be straight forward.
Teleport supports a ping RPC that returns a response containing information about the Teleport version of the cluster and the minimum client version required.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will pre-release teleport and/or tsh versions be handled differently?

Comment thread rfd/XXXX-tsh-upgrade.md
Teleport supports a ping RPC that returns a response containing information about the Teleport version of the cluster and the minimum client version required.
In the case that the cluster version of Teleport is newer than the tsh version, the user will be prompted to upgrade.

### Identifying installation method
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one more installation method for tsh – Teleport Connect comes bundled with it.

On Linux, the bundled version is automatically symlinked to /usr/local/bin/tsh if there's no existing symlink there. On Windows, the folder with the bundled tsh is automatically added to Path. On macOS you can select a menu option that adds tsh to path. See RFD 99 for more details.

If someone runs tsh upgrade using the binary bundled with Connect, I don't think we should upgrade the binary as it'll simply get overwritten on the next Connect update (which users have to do manually for now). But even more important, since Connect was first released we've always assumed that the version of Connect is bound to the version of tsh. As such, we didn't really put effort into making the gRPC service served by tsh daemon backwards compatible. So if someone updates the bundled tsh without updating Connect, they risk breaking the app.

I think for now when someone runs tsh upgrade we could detect if tsh is bundled with Connect. If so, instead of upgrading the binary we could show a message telling the user to download a new Connect version instead.

The bundled tsh lives in a specific folder in the installation folder of Connect, so for now we could see if simple pattern matching on the binary path would be sufficient.

Copy link
Copy Markdown
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments.

Comment thread rfd/XXXX-tsh-upgrade.md

## What

A tsh subcommand that will prompt the user to upgrade if the version of tsh is older than the cluster version.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tctl should be in scope.

Comment thread rfd/XXXX-tsh-upgrade.md
Comment on lines +19 to +20
One of our goals for Teleport Cloud is to increase the cadence at which clusters can be upgraded.
This requires that Teleport Agents and Teleport client tools be up to date with the latest compatible version of the cluster.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be supported for self-hosted as well. Doesn't feel like there would be much difference as the client will be checking the version against the proxy endpoint.

Comment thread rfd/XXXX-tsh-upgrade.md
## Details

The main idea here is to add an upgrade command to the Teleport client tools. This will detect the version of the Teleport cluster.
If the version of tsh is older than the version of the cluster, the user will be prompted to upgrade.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed in our sync, I think the criteria should be "if tsh/tctl version is different from the cluster it's talking to" so it would upgrade/downgrade itself as needed.

Comment thread rfd/XXXX-tsh-upgrade.md

Detecting the version of the Teleport cluster should be straight forward.
Teleport supports a ping RPC that returns a response containing information about the Teleport version of the cluster and the minimum client version required.
In the case that the cluster version of Teleport is newer than the tsh version, the user will be prompted to upgrade.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, as mentioned above let's just have the client track the server version and upgrade/downgrade as needed.

Comment thread rfd/XXXX-tsh-upgrade.md

### Identifying installation method

The Teleport client tools should be re-installed using the original installation method.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have discussed instead keeping a cache of tsh/tctl binaries of different versions somewhere on the client machine instead, right? Can you change this section to describe how that would work instead?

Comment thread rfd/XXXX-tsh-upgrade.md
Comment on lines +56 to +80
#### Linux

Teleport currently maintains DEB and RPM repositores.
So before upgrading, the upgrade command needs to identify whether the system it's running on is a Debian or Red Hat distribution.
The upgrade command will look at the /etc/lsb-release or /etc/redhat-release files to identify the Linux distribution and to determine which package manager to use.

The installation method can be further narrowed down by using the package manager CLI tools dpkg for Debian, and rpm for Red Hat.
If Teleport was installed using the manager, dpkg or rpm can be used to identify which release was installed: teleport, teleport-ent, or teleport-ent-fips.
Once the release has been identified, the Teleport client tools can now be upgraded using the package manager.

If Teleport was not installed using the package manager, the Teleport client tools will be upgraded by downloading the pre-built binaries.

#### macOS

On macOS, the Teleport package is available for installation using the macOS package installer.
To detect whether or not Teleport was installed using the installer, the pkgutil command can be used to search for the Teleport package.
Only Teleport Open Source and Teleport Enterprise are supported on macOS.

A signed release of tsh is also supported on macOS and is required to use TouchID.
So tsh will need to be upgraded separately after the initial upgrade of the other Teleport client tools.

#### Windows

Only the tsh command is supported on Windows machines.
tsh only supports an Open Source release, so for windows machines, the tsh upgrade command simply needs to download the desired tsh binary and install it.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this (i.e. how Teleport was installed) will be irrelevant if we implement the client binary cache store we talked about. So tsh will basically become a thin shim that detects the cluster version and executes appropriate version tsh binary from the local cache (downloading it first if needed).

The question is how to upgrade the shim though.

Comment thread rfd/XXXX-tsh-upgrade.md
Only the tsh command is supported on Windows machines.
tsh only supports an Open Source release, so for windows machines, the tsh upgrade command simply needs to download the desired tsh binary and install it.

## UX
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also describe the following things we discussed:

  • Will the users be able to disable the auto-upgrade behavior? How? Describe tsh config changes.
  • What will the default behavior be? We should default to auto-upgrade.

Comment thread rfd/XXXX-tsh-upgrade.md
## UX

The tsh upgrade command should simply upgrade the Teleport client tools while providing some basic observability about the currently installed version of the Teleport client tools, the Teleport cluster version, and what version the client tools will be upgraded to.
The upgrade command will require root privileges.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we just keep client cache somewhere we have access to, I don't think it'll need root?

Comment thread rfd/XXXX-tsh-upgrade.md

If the Teleport client tools are up to date, simply output the client and server version and exit
```console
$ sudo tsh upgrade
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate command is good, but it's "automatic upgrade" so tsh/tctl should also check the version on each command invocation and upgrade itself if needed "on demand". Can you cover this in the RFD as well and provide a UX example?

Comment thread rfd/XXXX-tsh-upgrade.md
Comment on lines +9 to +11
* Engineering: ...
* Infra: ...
* Kube: ...
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Engineering: ...
* Infra: ...
* Kube: ...
* Engineering: @r0mant && @jimbishopp
* Product: @klizhentas || @xinding33
* Security: @jentfoo

@bernardjkim
Copy link
Copy Markdown
Contributor Author

Going to close this PR since I've let this PR go a little stale and I didn't follow the correct RFD process. I've created a new PR with an updated design at #30317.

We've decided to limit the scope and only support Cloud users. This should simplify the design quite a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants