fix: SSH only with the given credentials, quote the snippet path (#48, #47) #49

Merged
christianmanivong merged 2 commits from fix/bugs-2026-11-02b into main 2026-11-02 09:40:50 +00:00
3 changed files with 20 additions and 1 deletions
Showing only changes of commit b3fe5009c8 - Show all commits

No files matched your search

+3
View File
@@ -129,6 +129,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Only what a command prints on stdout is its output; stderr no longer stands in when
stdout is empty. Each command goes straight to SSH: the driver first posted it to
`/nodes/{node}/execute`, which runs API calls, not a shell, and always failed (#17).
- The SSH login to the node uses only the credentials it is given
(`ssh_private_key_str`, `ssh_password` or the API password): paramiko no longer also
tries the keys in the running process's `~/.ssh` or an SSH agent it can reach (#48).
## [0.8.0] - 2026-10-23
+4 -1
View File
@@ -337,10 +337,13 @@ class ProxmoxDriver(
import paramiko
if self._ssh_client is None:
# A key is tried first; paramiko falls back to the password.
# A key is tried first; paramiko falls back to the password. Only
# these: not the keys in the process's own ~/.ssh, nor an agent.
connect_kwargs: _JsonDict = {
"username": self._ssh_username or self.username,
"timeout": self.timeout,
"look_for_keys": False,
"allow_agent": False,
}
password = self._ssh_password or self.password
if password:
+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