-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
mvollmer
wants to merge
3
commits into
cockpit-project:main
Choose a base branch
from
mvollmer:host-switcher-warnings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" | ||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> | ||
<chapter id="multi-host"> | ||
<title> | ||
Managing multiple hosts at the same time | ||
</title> | ||
|
||
<para> | ||
Cockpit allows you to access multiple hosts in a single session, | ||
by establishing SSH connections to other hosts. This is quite | ||
similar to logging into these other hosts using the "ssh" command | ||
on the command line, with one very important difference: | ||
</para> | ||
<para> | ||
Code from the local host and all the remote hosts run at the same | ||
time, in the same browser context. They are not sufficiently | ||
isolated from each other in the browser. All code effectively has | ||
the same privileges as the primary session on the local host. | ||
</para> | ||
<para> | ||
Thus, <emphasis>you should only only connect to remote hosts that | ||
you trust</emphasis>. You must be sure that none of the hosts that | ||
you connect to will cause Cockpit to load malicious JavaScript | ||
code into your browser. | ||
</para> | ||
<para> | ||
Going forward, Cockpit will try to provide sufficient isolation to | ||
make it safe to manage multiple hosts in a single Cockpit | ||
session. But until we get there, Cockpit will at least warn you | ||
before connecting to more than one host. It is also possible to | ||
disable multiple hosts entirely, and some operating systems do | ||
this already by default. | ||
</para> | ||
<para> | ||
You can prevent loading of JavaScript, HTML, etc from more than | ||
one host by adding this to <filename>cockpit.conf</filename>: | ||
</para> | ||
<programlisting> | ||
[WebService] | ||
AllowMultiHost=false | ||
</programlisting> | ||
<para> | ||
When you allow multiple hosts in a single Cockpit session by | ||
setting <code>AllowMultiHost</code> to true, then the user will be | ||
warned once per session, before connecting to the second host. If | ||
that is still too much, you can switch it off completely by adding | ||
the following to <filename>cockpit.conf</filename>: | ||
</para> | ||
<programlisting> | ||
[Session] | ||
WarnBeforeConnecting=false | ||
</programlisting> | ||
</chapter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,24 @@ export function ShellState() { | |
if (meta_multihost instanceof HTMLMetaElement && meta_multihost.content == "yes") | ||
config.host_switcher_enabled = true; | ||
|
||
/* Should show warning before connecting? */ | ||
let config_ready = false; | ||
cockpit.dbus(null, { bus: "internal" }).call("/config", "cockpit.Config", "GetString", | ||
["Session", "WarnBeforeConnecting"], []) | ||
.then(([result]) => { | ||
if (result == "false" || result == "no") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This added line is not executed by any test. |
||
window.sessionStorage.setItem("connection-warning-shown", "yes"); | ||
} | ||
}) | ||
.catch(e => { | ||
if (e.name != "cockpit.Config.KeyError") | ||
console.warn("Error reading WarnBeforeConnecting configuration:", e.message); | ||
}) | ||
.finally(() => { | ||
config_ready = true; | ||
on_ready(); | ||
}); | ||
|
||
/* MACHINES DATABASE AND MANIFEST LOADER | ||
* | ||
* These are part of the machinery in the basement that maintains | ||
|
@@ -74,7 +92,7 @@ export function ShellState() { | |
on_ready(); | ||
|
||
function on_ready() { | ||
if (machines.ready) { | ||
if (machines.ready && config_ready) { | ||
self.ready = true; | ||
window.addEventListener("popstate", ev => { | ||
update(); | ||
|
@@ -489,7 +507,6 @@ export function ShellState() { | |
|
||
// Methods | ||
jump, | ||
ensure_connection, | ||
remove_frame, | ||
most_recent_path_for_host, | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.