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: Don't automatically connect to remote machines on navigation #20826

Open
wants to merge 1 commit 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 mvollmer removed the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Sep 5, 2024
@mvollmer mvollmer force-pushed the host-switcher-warnings branch 4 times, most recently from b62a27f to 6e91d23 Compare September 11, 2024 09:16
@mvollmer mvollmer added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Sep 11, 2024
pkg/shell/hosts.jsx Fixed Show fixed Hide fixed
@mvollmer mvollmer removed the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Sep 11, 2024
@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
Comment on lines +100 to +101
componentWillUnmount() {
window.trigger_connection_flow = null;
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.

try {
await try2Connect(this.props.machines, machine.connection_string);
connection_string = machine.connection_string;
} catch (err) {
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.

// continue with troubleshooting in the dialog
connection_string = await this.showModal({
address: machine.address,
template: codes[err.problem] || "change-port",
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.

@@ -124,6 +196,8 @@ class AddMachine extends React.Component {
old_machine = props.machines_ins.lookup(props.old_address);
if (old_machine)
color = this.rgb2Hex(old_machine.color);
if (old_machine && !old_machine.visible)
old_machine = null;
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.

Comment on lines +307 to +308
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.

Comment on lines +990 to +993
if (machine && machine.host_key && !machine.on_disk) {
conn_options['temp-session'] = false; // Compatibility option
conn_options.session = 'shared';
conn_options['host-key'] = machine.host_key;
Copy link
Contributor

Choose a reason for hiding this comment

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

These 4 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