-
Notifications
You must be signed in to change notification settings - Fork 81
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
consoles: Don't use listening address to connect to VNC #1982
consoles: Don't use listening address to connect to VNC #1982
Conversation
02946bd
to
887cde1
Compare
235c6fd
to
4b2534b
Compare
if (app.startsWith("cockpit+=")) { | ||
address = app.substr(9); |
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.
Hmm, this should run...
} | ||
} | ||
|
||
domainDesktopConsole({ name: vm.name, consoleDetail: Object.assign({}, consoleDetail, { address }) }); |
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.
{...consoleDetail, address}
reads a bit nicer IMHO, but up to you.
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.
Done, thanks!
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.
Thanks! Let's discuss this a little bit. My first two comments were not part of the review.
test/check-machines-consoles
Outdated
class TestMultiMachinesConsoles(ConsoleCase): | ||
provision = { # noqa: RUF012 | ||
"machine": {"address": "10.111.113.1/20"}, | ||
} |
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.
This is still only one machine -- seems you could get this more cheaply with the already running nondestructive machine? 172.27.0.15
is reliable, a couple of cockpit tests refer to it as well.
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.
Right, I thought I'd seen something like that... Will that work also with TF?
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.
I have made the new test destructive and use that address.
b.open(f"/={my_ip}/machines") | ||
b.set_val('#login-user-input', "admin") | ||
b.set_val('#login-password-input', "foobar") | ||
b.click("#login-button") |
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.
That should be self.login_and_go("/machines", host=my_ip)
. I wonder why you don't' have to m.start_cockpit()
here, it's usually required?
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.
That should be self.login_and_go("/machines", host=my_ip)
The host
parameter gives you a "/@{host}" prefix, but I want a "/={host}" prefix.
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.
I wonder why you don't' have to m.start_cockpit() here, it's usually required?
Good question... I guess cockpit is enabled by default somewhere already?
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.
I have added a call to "start_cockpit".
# Login from Shell via SSH | ||
|
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.
Is that actually something different? I thought transport-wise bastion host and shell host selector would be the same?
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.
The new code in the PR handles that differently.. maybe it doesn't have to.
Bastion host has:
- cockpit.transport.host == "localhost"
- application == "cockpit+=address"
where "address" is the string typed into the login page, and visible in the browser URL as "/=address". But it's not in the frame URL.
SSH from the Shell has:
- cockpit.transport.host == "address"
where "address" is the string typed into the "add remote host" dialog.
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.
(I don't really understand our "application" business, tbh.)
06e86cb
to
9c6e8b6
Compare
The listening address is most likely 127.0.0.1 (libvirt default) or 0.0.0.0 (yolo config). Neither of these works remotely. Let's tell the remote viewer some address that has a chance of working. More complicated setups, like a bastion host or connecting via SSH inside Cockpit, might not work because of networking routing challanges, but at least we get better error messages like "No route to host" etc. Also, with the libvirt default of only listening on 127.0.0.1, no remote connection will work. But again, we now at least get the expected "Connection refused" error message.
9c6e8b6
to
5ac4425
Compare
if (app.startsWith("cockpit+=")) { | ||
address = app.substr(9); |
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.
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.
I don't understand this... these lines clearly run.
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.
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.
Yeah, coverage collection must be buggy somehow... grr.
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.
TF is still running, but it seems it already skips the console tests there (the 172.27.0.15 IP is specific to our bots images), and some tests already passed.
This is a significant improvement, let's get this in without more bikeshedding. Thank you!
The listening address is most likely 127.0.0.1 (libvirt default) or 0.0.0.0 (yolo config). Neither of these works remotely.
Let's tell the remote viewer some address that has a chance of working. More complicated setups, like a bastion host or connecting via SSH inside Cockpit, might not work because of networking routing challanges, but at least we get better error messages like "No route to host" etc.
Also, with the libvirt default of only listening on 127.0.0.1, no remote connection will work. But again, we now at least get the expected "Connection refused" error message.
Demo: https://youtu.be/zjQlyt3SzG4
Machines: "Launch viewer" now uses correct address
The "Launch viewer" button in the "Console" card of a virtual machine would tell the remote viewer application to connect to the listening address of the VNC server. This is wrong when the server listens on 127.0.0.1 (libvirt default) or 0.0.0.0 (allow connections on all interfaces). Now Cockpit will tell the remote viewer application to connect to the same domain name or IP address that Cockpit itself is using to reach the virtual machine host.