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

Shell: Extra warnings when connecting to remote hosts #20826

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mvollmer
Copy link
Member

@mvollmer mvollmer commented Jul 31, 2024

Shell: Extra warnings when connecting to remote hosts

Connecting to multiple hosts in a single Cockpit session allows all these hosts to access each other freely. Eventually Cockpit will not allow multiple connections, but in the mean time, we want to educate people better.

image

This warning can be disabled by including the following in /etc/cockpit/cockpit.conf:

[Session] 
WarnBeforeConnecting=false

Demo: https://youtu.be/Un6k3DiukOg

@mvollmer mvollmer added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Aug 1, 2024
@garrett
Copy link
Member

garrett commented Aug 1, 2024

I was thinking of something more like this:

Modal _ Modal backdrop

Then we can succinctly explain what can happen, provide a link with more information, and say this will show up once per session on the very first connection to any remote machine (instead of a "don't remind me"). If accepted, it would not show up again until the next Cockpit session.

The external page would explain it a little more in depth and mention the config file options, including:

  1. Being able to toggle the host connection feature on and off completely
  2. Being able to toggle off this warning message (which only matters if remote host connection is on)

Marius said this could be a three-state option, which I agree with:

  1. Off (default for RHEL/CentOS)
  2. On (default for non-RHEL/CentOS)
  3. On without warnings (never default; an override to prevent the connection message that must be manually set)

This would prevent someone from connecting to a host machine without knowing the ramifications, but also allow them to work more-or-less how they currently do, with a workaround to skip the warning in some environments.

If we are indeed going to outright remove this feature, then we could even rephrase the modal and be explicit about the timeline in the external page, something like this:

Modal _ Modal backdrop(3)

These mockups are just examples of what we could do instead, and we'd want to revise the text and plan for the actual version where it would be removed.

@mvollmer mvollmer force-pushed the host-switcher-warnings branch 2 times, most recently from 2fcb51b to 2790704 Compare September 2, 2024 13:50
pkg/shell/hosts_dialog.jsx Fixed Show fixed Hide fixed
@mvollmer mvollmer force-pushed the host-switcher-warnings branch 2 times, most recently from 40ef9ad to 721f769 Compare September 2, 2024 14:18
pkg/shell/indexes.jsx Fixed Show fixed Hide fixed
@mvollmer
Copy link
Member Author

mvollmer commented Sep 3, 2024

@garrett, could you check https://www.youtube.com/watch?v=wL4VyE9tUb8 and tell me whether this goes in the right direction? Then I can work on making this nice and robust.

@garrett
Copy link
Member

garrett commented Sep 3, 2024

@mvollmer: I'm watching this video and wondering: Why is it different form the mockups and discussion we talked about? (See above comment #20826 (comment))

pkg/shell/indexes.jsx Fixed Show fixed Hide fixed
pkg/shell/indexes.jsx Fixed Show fixed Hide fixed
pkg/shell/indexes.jsx Fixed Show fixed Hide fixed
@mvollmer mvollmer force-pushed the host-switcher-warnings branch 7 times, most recently from e37b4cc to a943f94 Compare September 4, 2024 07:26
@mvollmer
Copy link
Member Author

mvollmer commented Sep 4, 2024

I'm watching this video and wondering: Why is it different form the mockups and discussion we talked about?

@garrett, the difference I see is that the dialog is shown more often than what you described. Correct? The warning should be shown only for the very first connection in the session, right? So maximum number of times we show the warning per session is 1. (And reloading doesn't start a new session.)

What do you think of immediately opening the connection dialog when the URL already points to a remote machine when you login to the Cockpit session?

Any opinions about the "Not connected" placeholder page that you see when cancelling the connection dialog in that case? Should we keep it? Redesign it?

@mvollmer mvollmer force-pushed the host-switcher-warnings branch 3 times, most recently from 5751da0 to a28eb5a Compare September 4, 2024 18:10
@mvollmer mvollmer force-pushed the host-switcher-warnings branch 3 times, most recently from 3499f26 to e19df5d Compare September 5, 2024 10:49
@mvollmer
Copy link
Member Author

There are lots more opportunities for cleanup, but I think this is fine for now. The next step would probably be to turn the whole shell into a React component and move the trigger_connection_flow thing into the top component so that it can be cleanly triggered from anywhere in the shell.

@mvollmer mvollmer force-pushed the host-switcher-warnings branch 3 times, most recently from c2f658a to c35a131 Compare September 13, 2024 11:49
@mvollmer mvollmer marked this pull request as ready for review September 13, 2024 11:52
@mvollmer mvollmer added the blocked Don't land until something else happens first (see task list) label Oct 7, 2024
pkg/shell/shell.jsx Fixed Show fixed Hide fixed
Copy link
Member

@garrett garrett left a comment

Choose a reason for hiding this comment

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

This looks mostly great. Thanks!

However: After I added a new host, I got the connect warning dialog and then the key dialog, all as expected. However, it didn't switch to that remote host. Instead, it stayed on the original host and the switcher persisted.

I would have expected it to switch to the new host and the switcher to go away at the same time.

Are you splitting that out into this other PR?

(If that's the case, I can approve this one and check out that one to make it works as expected.)

(I thought I spotted some regressions, like the host switcher not having a hover state, but it looks like that in main too, so I guess we picked up that regression elsewhere, in the past. I guess after we land the rework and reimplement the shell's UI, it'll be automatically fixed. Otherwise, I could send up a PR to fix the CSS outside of your changes.)

@mvollmer mvollmer removed the blocked Don't land until something else happens first (see task list) label Oct 11, 2024
The old behavior was to navigate always and try to login
afterwards. If the login failed, the "Troubleshoot" curtain would be
shown instead of the pages from the host.

The new behavior will first try to connect to the host and only
navigate to it when the connection has succeeded.
@mvollmer mvollmer force-pushed the host-switcher-warnings branch 2 times, most recently from 8020e84 to d370165 Compare October 11, 2024 09:19
@mvollmer mvollmer changed the title shell: Don't automatically connect to remote machines on navigation Shell: Extra warnings when connecting to remote hosts Oct 11, 2024
@mvollmer
Copy link
Member Author

However: After I added a new host, I got the connect warning dialog and then the key dialog, all as expected. However, it didn't switch to that remote host. Instead, it stayed on the original host and the switcher persisted.

Yes, that's the current behavior of the shell. I have included #21004 here now to jump to a newly added host immediately.

@mvollmer mvollmer added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Oct 11, 2024
@mvollmer mvollmer force-pushed the host-switcher-warnings branch 2 times, most recently from 6b0ae6a to 7219b41 Compare October 11, 2024 11:56
This requires calling connect_host() in reaction to the "connect"
event of the ShellState so that the warning dialog will be shown
before attempting any connection.

A consequence of that is that now login attempts are always
interactive, and show the password prompts immediately instead of only
showing the "Troubleshoot" curtain with a button to launch those
dialogs.
@mvollmer mvollmer removed the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Oct 11, 2024
Comment on lines +418 to +419
if (port_index === -1) {
host_id_port = address + ":22";
Copy link
Contributor

Choose a reason for hiding this comment

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

These 2 added lines are not executed by any test.

cockpit.dbus(null, { bus: "internal" }).call("/config", "cockpit.Config", "GetString",
["Session", "WarnBeforeConnecting"], [])
.then(([result]) => {
if (result == "false" || result == "no") {
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.

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

Successfully merging this pull request may close these issues.

3 participants