Description
After the asyncssh migration (#44), connecting via a regular OpenSSH private key (non-PPK) fails. The key path is set correctly but the connection does not authenticate.
Root Cause (suspected)
In protocols.py, when key_path is set, the password field is consumed as the key passphrase even if it's empty/None. asyncssh may also need client_key_passphrase set separately from password, and the two auth methods (key + password fallback) should not be mutually exclusive.
passphrase = self._info.password if self._info.password else None
connect_kwargs["client_keys"] = [key_path]
connect_kwargs["passphrase"] = passphrase # wrong — swallows password as passphrase
Fix
- Use
client_keys_passphrase (not passphrase) if the key is encrypted
- Allow password fallback alongside key auth
- Don't set passphrase=None when no passphrase is provided
Description
After the asyncssh migration (#44), connecting via a regular OpenSSH private key (non-PPK) fails. The key path is set correctly but the connection does not authenticate.
Root Cause (suspected)
In
protocols.py, whenkey_pathis set, thepasswordfield is consumed as the keypassphraseeven if it's empty/None. asyncssh may also needclient_key_passphraseset separately frompassword, and the two auth methods (key + password fallback) should not be mutually exclusive.Fix
client_keys_passphrase(notpassphrase) if the key is encrypted