-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
macos: podman asks for login even when remote does not allow password authentications #8498
Comments
Podman should only fall back to asking for the password, if it can't find any of:
if len(authMethods) == 0 {
pass, err := terminal.ReadPassword("Login password:")
if err != nil {
return Connection{}, err
}
authMethods = append(authMethods, ssh.Password(string(pass)))
} In your case you are passing an identity (CONTAINER_SSHKEY), so it should not ask for password. But your log output is missing a vital line, |
@ssbarnea I'm sorry, I have been unable to reproduce this issue. I'm using:
I have tried:
/cc @ashley-cui |
I suspect this is highly dependent on key type and size and apparently there is no debug option to enable to make it more verbose. Confirmed that my both keys are 4096 rsa, one of them is encrypted at rest (loaded into agent) and the other one is unencrypted. podman refuses to connect to the bastion host with both, but ssh has no problems connecting. The bastion is a fedora 33 machine but i doubt that matters much because ssh works, with RSA keys too! UpdateNow I do have the confirmation that podman is unable to establish ssh connection using RSA keys, regardless if they are loaded by itself or via ssh-agent, it fails to establish a handshake with them:
Following https://www.ssh.com/ssh/keygen/ I created two other keys |
@afbjorklund the logic in the mentioned code snipped seams flawed at best. An app should not prompt user for a password just because it failed to load other authentication methods. Interactive (challenge) SSH authentication should be taken care of the ssh library and should establish a real connection with the server, not to ask user about a password. This is confusing at best, but I would even add that it has some security implications. Also it breaks because it does not support any authentication variations, for example some systems may require multiple answers, like OTP tokens. I personally do not see much use for that prompt and I would not mind seeing it removed, or at least making it appear only when user explicitly asked for this "feature" to be enabled, like a At this moment if I force podman to run with a non-tty by adding
If I try to pipe the std stream to something else, I still get the interactive prompt, yet another reason for causing breakage in production or CI.
|
I didn't write the code, I was just looking at it... (It was added in cbca625 and 6ff4239) https://github.com/containers/podman/blob/v2.2.0/pkg/bindings/connection.go#L185_L215 Still don't know why any of it is used though, if you are indeed providing an identity (or agent) ? Maybe $SSH_AUTH_SOCK is misbehaving ?
Seems reasonable, and this is how |
I would not mind removing that code myself but I am waiting for some podman core developer to comment on this as I do not want to propose an unwanted change. |
But it seems like the main difference between and Mac and Linux is the missing ssh-agent (SSH_AUTH_SOCK) ? Here it has either 2 (identity+agent) or 1 (agent only) auth method, so it never falls back to asking for a password... |
It is possible to change the code to use PasswordCallback (when needed) instead of Password (up front). You might still want to have an option to enable/disable, but at least wouldn't ask if not supported by server. |
After PR #8596 : Now it goes directly to failure mode, if server doesn't support passwords. If it does, it will prompt (like before).
Normally passwords are disabled for root. If they are allowed, but the wrong one is given, it looks more like:
For this particular test, I did: Normally would suggest keys... |
I think it's a bit weird that it is called the "bastion host", since as far as I know it only supports unix sockets ? https://en.wikipedia.org/wiki/Bastion_host So it's not so much about jumping to another server on the network, the Podman service is probably local... But it was only the message, not important. |
/kind bug
Description
It seams that podman-remote goes into interactive password prompts regardless if remote servers allow them or not, which is different from ssh implementation and also breaks automation.
Please note that this problem seams to be particular to "podman" cli on macos (which is in fact podman-remote), but when trying to reproduce the same login prompt from a linux host while using the podman-remote command, it did fail correctly with a "no supported methods remain". Both versions were the same (2.1.1).
Steps to reproduce the issue:
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:podman version 2.1.1
Output of
podman info --debug
:Irellevant because it does not work due to current bug
Package info (e.g. output of
rpm -q podman
orapt list podman
):Related: #7806
The text was updated successfully, but these errors were encountered: