-
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
pybridge: Add initial authorize request to cockpit-beiboot, and handle host key prompts #19401
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
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 looks like it's coming together really nicely and I'm starting to get excited about the finished result. 🚀
src/cockpit/beiboot.py
Outdated
|
||
async def do_askpass(self, messages: str, prompt: str, hint: str) -> Optional[str]: | ||
if self.basic_password and 'password:' in prompt.lower(): |
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.
yikes...
I guess this will work "for now" but we really need to do something more (airquotes) 'professional' here...
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.
Yep, see my comment above, that's why it's still draft. Of course we could also consider/mark this as # HACK
and update ferny as a follow-up. I still do want to do that, but it's much nicer to iterate on something that actually works.
774f2ee
to
60c6729
Compare
edae05b
to
ee489a1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
fede982
to
1220a19
Compare
This comment was marked as outdated.
This comment was marked as outdated.
d7f3fa3
to
a10e8a8
Compare
This comment was marked as outdated.
This comment was marked as outdated.
a10e8a8
to
f3ee0e7
Compare
aeae62e
to
f21866b
Compare
This comment was marked as resolved.
This comment was marked as resolved.
f21866b
to
fb73cc7
Compare
fb73cc7
to
cfcd08f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
cfcd08f
to
4457911
Compare
This comment was marked as outdated.
This comment was marked as outdated.
fp_match = re.search(r'\n(\w+) key fingerprint is ([^.]+)\.', prompt) | ||
args = {} | ||
if fp_match: | ||
args['host-key'] = f'{fp_match.group(2)} {fp_match.group(1)}' |
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 guess this isn't quite right — this is the fingerprint, not the key...
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.
Hm yes, but we don't ever get the actual key via SSH_ASKPASS; I figure that's why you went through this whole business of KnownHostCommand
? Do we need to use that after all?
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.e. I just consider that as the "new key format" -- key fingerprints are just the "language" that ssh
speaks, while for cockpit-ssh
it was the full keys. But does that matter? Or what would you suggest?
4457911
to
79d426a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
79d426a
to
6b8f3b6
Compare
In order to use cockpit.beiboot as cockpit-ssh replacement from the "normal" (not Client mode) login page, it needs to consider the given username and password. cockpit-ssh sends an initial `authorize` message for that and checks for "Basic" auth. If that fails, it aborts immediately with `authentication-failed`. Implement the same in cockpit.beiboot. Note: The UI does not currently get along with multiple password attempts. Once we drop cockpit-ssh, we should fix the UI and cockpit.beiboot to behave like the flatpak, keep the initial SSH running, and just answer the "try again" prompts. Cover this in a new `TestLogin.testLoginSshBeiboot`. Once we generally replace cockpit-ssh with cockpit.beiboot, this will get absorbed by TestLogin and TestMultiMachine* and can be dropped again.
Stop treating host key prompts as generic conversation messages. We want the UI to handle them properly, with some verbiage/buttons and the recipe for validating host keys, instead of letting the user type "yes". The login page recognizes these through the presence of the `host-key` authorize field (and irritatingly, an extra `default` field with the actual value). We can't use ferny's builtin `do_hostkey()` responder for this, as that requires `ferny.Session(handle_host_key=True)`, and that API is not flexible enough to handle our ssh command modifications and the extra beiboot_helper handler. This needs some bigger redesign. So just recognize and parse SSH's host key prompts, and rely on our integration tests to spot breakage in future distro releases. This enables the login page's host key localstorage mechanism, so adjust TestLogin.testLoginSshBeiboot to only expect the host key on the first login attempt.
6b8f3b6
to
03fb291
Compare
I have rebased this to get it back into working order. #19668 has been open for 4 months, and at some point I'd really like to unblock this and the follow-up work -- the string parsing hack is easy enough to revert/adjust if/once we land the FernyTransport rework. |
In order to use cockpit-beiboot as cockpit-ssh replacement from the "normal" (not Client mode) login page, it needs to consider the given username and password. It also needs to properly handle "unknown host key" prompts.
This paves the way for completely replacing cockpit-ssh with cockpit.beiboot. See https://issues.redhat.com/browse/COCKPIT-954 and #19441.