fix(ssh): log in only with the credentials the driver is given

paramiko's look_for_keys and allow_agent stayed at their default True,
so the node login also tried every key in the running process's own
~/.ssh and any SSH agent it could reach. The driver standard lets a
driver authenticate only with what it was handed; both are now False
on every connect.

Closes #48
This commit is contained in:
Christian Manivong committed 2026-11-02 09:25:04 +01:00
1 parent b368ad9856
commit b3fe5009c8
3 files changed
+20 -1

No files matched your search

+13
View File
@@ -77,3 +77,16 @@ def test_a_token_only_login_sends_no_empty_password(client): # noqa: F811
)._node_ssh()
assert "password" not in client.connected_with
@pytest.mark.parametrize(
"args",
[{"ssh_private_key_str": _ed25519_pem()}, {"ssh_password": "ssh-pw"}, {}],
ids=["key", "ssh-password", "api-password"],
)
def test_only_the_given_credentials_log_in(client, args): # noqa: F811
"""Neither the keys in the worker's own ~/.ssh nor an SSH agent it reaches (#48)."""
ProxmoxDriver("10.0.0.9", "root", "api-s3cret", optional_args=args)._node_ssh()
assert client.connected_with["look_for_keys"] is False
assert client.connected_with["allow_agent"] is False