Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beiboot: Enable beiboot feature for distro packages for same OS #21121

Merged
merged 2 commits into from
Oct 22, 2024

Conversation

martinpitt
Copy link
Member

@martinpitt martinpitt commented Oct 15, 2024

We recently eliminated all on-demand installations of cockpit-* packages in beiboot mode, which prevents accidentally moving from a beiboot to a distro package scenario.

This means we can now carefully open up the beiboot feature for distro packages. However, we need to be careful here: While we can reasonably assume an ever-green flatpak and cockpit/ws container, distro packages may be arbitrarily old, and hence incompatible with APIs from newer OSes. So start small and only allow connecting to the same target OS as the host. This should already cover a lot of use cases in homogenous environments.

Note that this only applies to direct logins (bastion host). The code path for the (deprecated) host switcher is completely different and doesn't support beiboot at all.

Drop the no-cockpit part of TestLoopback.testBasic. Removing /usr/bin/cockpit-bridge now just enables beiboot mode, the OS is always compatible (as it's localhost), and we already check this in TestMultiMachine.

Part of https://issues.redhat.com/browse/COCKPIT-1178

Note that this is an initial step -- we can extend this by translating our bots testmap into a list of allowed OSes, if/when we want to.


Depends on:

Follow-ups:


Connect to similar servers without Cockpit installed

The Cockpit Client flatpak has been capable of connecting to remote machines without Cockpit installed since its beginning in release 295. Recently in version 326, the cockpit/ws container got the same feature.

With this release Cockpit gradually introduces this feature to the standard Linux distribution packages (rpm/deb/Arch). Initially you can connect to a remote machine without installed Cockpit if it runs the same operating system version as the host from which you make the connection. This ensures compatibility and safety: The flatpak and ws container can be assumed to be always up to date in production, and hence can connect to any OS. But distribution packages can be quite old, and thus not be compatible when connecting to newer OS versions.

@martinpitt martinpitt marked this pull request as ready for review October 15, 2024 11:49
@martinpitt
Copy link
Member Author

@jelly @mvollmer please treat the review requests as an "AND" (usually it's an "OR"). I've already talked this over with @allisonkarlitskaya but I'd value both of your opinions here.

logger.debug("cockpit.check-os-release: local: %r", local_os)
# for now, just support the same OS
if remote_os.get('ID') != local_os.get('ID') or remote_os.get('VERSION_ID') != local_os.get('VERSION_ID'):
msg = f'Unsupported OS {remote_os.get("ID", "?")} {remote_os.get("VERSION_ID", "?")}'
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to give the user a tiny bit more information? In theory their OS is supported if they install the relevant cockpit packages (but then it is no longer beiboot).

Just wondering in general if it makes sense to expand the error message a bit as currently it is not really actionable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, good point -- the previous error message (i.e. from main) isn't great either. It's not translated/translatable and has the "no-cockpit" error code in it, and doesn't give you anything actionable either. I think we need to handle this error code properly on the login page, and find a way to convey the os-release information in an extra error field. I can work on that, either as a prerequisite (and block this), or as a follow-up.

Copy link
Member

Choose a reason for hiding this comment

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

This can be a follow up (as long as it makes next week's release)

Copy link
Member Author

Choose a reason for hiding this comment

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

See #21124. For this PR we should amend the error message with something like "Logging into machines without installed Cockpit is only supported on Fedora 40" (i.e. $ID $VERSION_ID). This also easily extends in the future to an itemized list of supported OSes.

@garrett WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like this now:

image

Copy link
Member Author

Choose a reason for hiding this comment

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

.. and in the next step it could look like this:

A compatible version of Cockpit is not installed on HOST. This is only supported for the following operating systems on the target machine:

  • fedora 40
  • fedora 41
  • rhel 10

... and so on.

@martinpitt martinpitt added the blocked Don't land until something else happens first (see task list) label Oct 16, 2024
@martinpitt martinpitt marked this pull request as draft October 16, 2024 08:04
@martinpitt martinpitt force-pushed the beiboot-same-os branch 4 times, most recently from 9390083 to a74fe38 Compare October 21, 2024 05:32
@martinpitt martinpitt marked this pull request as ready for review October 21, 2024 05:32
@martinpitt martinpitt removed the request for review from mvollmer October 21, 2024 05:32
@martinpitt martinpitt removed the blocked Don't land until something else happens first (see task list) label Oct 21, 2024
@martinpitt
Copy link
Member Author

I'm redesigning the login page alerts in #21130, but that (1) is a lot of work, and (2) needs some iteration. This PR is otherwise ready, and I'd like to unblock the next step to open it up for more OSes.

jelly
jelly previously approved these changes Oct 21, 2024
Copy link
Member

@jelly jelly left a comment

Choose a reason for hiding this comment

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

Simple and effective 👍

help="How to run cockpit-bridge from the remote host: auto: if installed (default), "
"never: always copy the local one; "
"supported: copy local one for compatible OSes, fail otherwise; "
Copy link
Member

@mvollmer mvollmer Oct 21, 2024

Choose a reason for hiding this comment

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

I think supported will use the installed cockpit-bridge if there is one, right? This isn't clear from the docs here, they make it sound like it's a variant of never, while it is actually a variant of auto.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, it prefers the remote bridge if installed. I fixed the help. Thanks for spotting!

mvollmer
mvollmer previously approved these changes Oct 21, 2024
Copy link
Member

@mvollmer mvollmer left a comment

Choose a reason for hiding this comment

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

Thanks! Not a fan of this whole direction, but code looks good.

We want to re-use it in beiboot.py.
We recently eliminated all on-demand installations of cockpit-* packages
in beiboot mode, which prevents accidentally moving from a beiboot to a
distro package scenario.

This means we can now carefully open up the beiboot feature for distro
packages. However, we need to be careful here: While we can reasonably
assume an ever-green flatpak and cockpit/ws container, distro packages
may be arbitrarily old, and hence incompatible with APIs from newer
OSes. So start small and only allow connecting to the same target OS as
the host. This should already cover a lot of use cases in homogenous
environments.

Note that this only applies to direct logins (bastion host). The code
path for the (deprecated) host switcher is completely different and
doesn't support beiboot at all.

Drop the `no-cockpit` part of TestLoopback.testBasic. Removing
/usr/bin/cockpit-bridge now just enables beiboot mode, the OS is always
compatible (as it's localhost), and we already check this in
TestMultiMachine.

Part of https://issues.redhat.com/browse/COCKPIT-1178
@@ -1037,7 +1037,13 @@ function debug(...args) {
} else if (xhr.status == 403) {
login_failure(_(decodeURIComponent(xhr.statusText)) || _("Permission denied"));
} else if (xhr.status == 500 && xhr.statusText.indexOf("no-cockpit") > -1) {
login_failure(format(_("A compatible version of Cockpit is not installed on $0."), login_machine || "localhost"));
// always show what's going on
let message = format(_("A compatible version of Cockpit is not installed on $0."), login_machine || "localhost");
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test.

Copy link
Member

@mvollmer mvollmer left a comment

Choose a reason for hiding this comment

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

Thanks!

@martinpitt martinpitt merged commit 02f7899 into cockpit-project:main Oct 22, 2024
84 checks passed
@martinpitt martinpitt deleted the beiboot-same-os branch October 22, 2024 06:59
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.

4 participants