You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you explain why you want to expose the None authmethod? TestClientAuthNone shows how to use the None auth method; it doesn't need client-side configuration.
@hanwen allow client side to send non-auth on their own like password or key
for example, send non after password. this is useful in special client impl
@tg123 thanks for this proposal, can you please provide a real use case for this? For example a server that requires sending the none auth method after the password.
The none auth method is generally used initially just to list the authentication methods that can continue and this is what we already do in our client implementation. As you can see here, none auth is implicitly added to the configured authentication methods.
@tg123 thanks for this proposal, can you please provide a real use case for this? For example a server that requires sending the none auth method after the password.
The none auth method is generally used initially just to list the authentication methods that can continue and this is what we already do in our client implementation. As you can see here, none auth is implicitly added to the configured authentication methods.
If there a way to control the auth to 'not' perform the none auth method, if we already know the list of auth methods the server allows? If the server disallows none auth method, and also doesn't return the auth methods it allows, the auth fails with only the none auth method attempted.
If there a way to control the auth to 'not' perform the none auth method
what are you trying to do? Why do you need this?
I am using the ssh module to connect and authenticate to an FTP server, using public key authentication method.
The server is disallowing the none auth method, and also doesn't return the auth methods it allows, so the auth fails with only the none auth method attempted.
The ssh.Dial call fails with this error, which shows that the public key auth was not even attempted ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
Here's the method in my application which performs the auth :
Looking at the clientAuthenticate method in ssh.client_auth.go, the other auth methods passed in the config are not tried if there are no methods returned in the initial none auth attempt. Please advise if my understanding is incorrect:
// during the authentication phase the client first attempts the "none" method
// then any untried methods suggested by the server.
var tried []string
var lastMethods []string
sessionID := c.transport.getSessionID()
for auth := AuthMethod(new(noneAuth)); auth != nil; {
ok, methods, err := auth.auth(sessionID, config.User, c.transport, config.Rand, extensions)
if err != nil {
// We return the error later if there is no other method left to
// try.
ok = authFailure
}
if ok == authSuccess {
// success
return nil
} else if ok == authFailure {
if m := auth.method(); !contains(tried, m) {
tried = append(tried, m)
}
}
if methods == nil {
methods = lastMethods
}
lastMethods = methods
auth = nil
findNext:
for _, a := range config.Auth {
candidateMethod := a.method()
if contains(tried, candidateMethod) {
continue
}
for _, meth := range methods {
if meth == candidateMethod {
auth = a
break findNext
}
}
}
if auth == nil && err != nil {
// We have an error and there are no other authentication methods to
// try, so we return it.
return err
}
}
return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", tried)
If there a way to control the auth to 'not' perform the none auth method
what are you trying to do? Why do you need this?
I am using the ssh module to connect and authenticate to an FTP server, using public key authentication method. The server is disallowing the none auth method, and also doesn't return the auth methods it allows, so the auth fails with only the none auth method attempted. The ssh.Dial call fails with this error, which shows that the public key auth was not even attempted ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
as a library, it is better to have flexibility to create a server and client does not follow RFC auth process,
for example:
client sends 3 * none in a row, server: welcome
it is scanner safe and passwordless 🤣
If no authentication is needed for the user, the server MUST return SSH_MSG_USERAUTH_SUCCESS. Otherwise, the server MUST return SSH_MSG_USERAUTH_FAILURE and MAY return with it a list of methods that may continue in its 'authentications that can continue' value.
This means that things should continue to work if the list of methods is not returned from the 'none' auth. I support this change, but it is different from the proposal that is discussed here. Open a new issue?
If there a way to control the auth to 'not' perform the none auth method
what are you trying to do? Why do you need this?
I am using the ssh module to connect and authenticate to an FTP server, using public key authentication method. The server is disallowing the none auth method, and also doesn't return the auth methods it allows, so the auth fails with only the none auth method attempted. The ssh.Dial call fails with this error, which shows that the public key auth was not even attempted ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
Here's the method which performs the auth :
Can OpenSSH connect to this server? If so, please post the output of ssh -vvvvv ..... Thank you
Thanks for offering to help. Upon further debugging I have found out the issue is not what I thought it was. I enabled the debug logs and found that the server was returning the allowed methods on the first none auth method attempt, and the public key authentication was attempted and successful. But the server required password auth as well along with public key auth, and since no password auth method was configured in the application, the dial call failed. The error log is misleading and led me to believe the server wasn't returning the methods along with the failure message on the non auth method attempt.
These are my application logs with debug logging enabled :
If no authentication is needed for the user, the server MUST return SSH_MSG_USERAUTH_SUCCESS. Otherwise, the server MUST return SSH_MSG_USERAUTH_FAILURE and MAY return with it a list of methods that may continue in its 'authentications that can continue' value.
This means that things should continue to work if the list of methods is not returned from the 'none' auth. I support this change, but it is different from the proposal that is discussed here. Open a new issue?
I believe my hypothesis was wrong, and the server is indeed working as per the RFC. Thanks for offering to help! I am not sure if a new issue needs to be opened for the misleading error log, will do if it seems that my understanding is right.
Activity
[-]proposal: x/crypto/ssh expose missing none authmethod[/-][+]proposal: x/crypto/ssh: expose missing none authmethod[/+]ianlancetaylor commentedon Sep 15, 2023
In https://go.dev/cl/528637 the suggested API is
tg123 commentedon Sep 15, 2023
golang/crypto#272
hanwen commentedon Sep 21, 2023
Can you explain why you want to expose the None authmethod?
TestClientAuthNone
shows how to use the None auth method; it doesn't need client-side configuration.tg123 commentedon Sep 23, 2023
@hanwen allow client side to send non-auth on their own like password or key
for example, send
non
afterpassword
. this is useful in special client impldrakkan commentedon Sep 24, 2023
@tg123 thanks for this proposal, can you please provide a real use case for this? For example a server that requires sending the none auth method after the password.
The
none
auth method is generally used initially just to list the authentication methods that can continue and this is what we already do in our client implementation. As you can see here,none
auth is implicitly added to the configured authentication methods.ShimantaKB-Tunnel commentedon Nov 4, 2024
If there a way to control the auth to 'not' perform the none auth method, if we already know the list of auth methods the server allows? If the server disallows none auth method, and also doesn't return the auth methods it allows, the auth fails with only the none auth method attempted.
hanwen commentedon Nov 5, 2024
what are you trying to do? Why do you need this?
ShimantaKB-Tunnel commentedon Nov 5, 2024
I am using the ssh module to connect and authenticate to an FTP server, using public key authentication method.
The server is disallowing the none auth method, and also doesn't return the auth methods it allows, so the auth fails with only the none auth method attempted.
The ssh.Dial call fails with this error, which shows that the public key auth was not even attempted
ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
Here's the method in my application which performs the auth :
Looking at the
clientAuthenticate
method in ssh.client_auth.go, the other auth methods passed in the config are not tried if there are no methods returned in the initial none auth attempt. Please advise if my understanding is incorrect:drakkan commentedon Nov 5, 2024
Can OpenSSH connect to this server? If so, please post the output of
ssh -vvvvv ....
. Thank youtg123 commentedon Nov 5, 2024
as a library, it is better to have flexibility to create a server and client does not follow RFC auth process,
for example:
client sends 3 * none in a row, server: welcome
it is scanner safe and passwordless 🤣
hanwen commentedon Nov 5, 2024
RFC 4252:
This means that things should continue to work if the list of methods is not returned from the 'none' auth. I support this change, but it is different from the proposal that is discussed here. Open a new issue?
ShimantaKB-Tunnel commentedon Nov 5, 2024
Thanks for offering to help. Upon further debugging I have found out the issue is not what I thought it was. I enabled the debug logs and found that the server was returning the allowed methods on the first none auth method attempt, and the public key authentication was attempted and successful. But the server required password auth as well along with public key auth, and since no password auth method was configured in the application, the dial call failed. The error log is misleading and led me to believe the server wasn't returning the methods along with the failure message on the non auth method attempt.
These are my application logs with debug logging enabled :
I believe my hypothesis was wrong, and the server is indeed working as per the RFC. Thanks for offering to help! I am not sure if a new issue needs to be opened for the misleading error log, will do if it seems that my understanding is right.