Repository navigation
security: enable SSH host key verification for remote collection - #22
Merged
OkiriGabriel merged 2 commits intoJul 16, 2026
Merged
OkiriGabriel merged 2 commits into
OkiriGabriel merged 2 commits into
Conversation
Remove StrictHostKeyChecking=no from collectors/server.py and tools/executor.py. Default to OpenSSH's strict host-key checking and add support for: - SSH_KNOWN_HOSTS (sets UserKnownHostsFile) - SSH_REMOTE_USER (prepends user@ when host has no user prefix) Document known_hosts mounting in .env.example and docs/CENTRALIZED_DEPLOYMENT.md. Add tests asserting the SSH argv no longer contains StrictHostKeyChecking=no, and that the new env vars are wired correctly for both call sites. Closes open-devops-agent#12 Co-Authored-By: Kimi K2.7 Code <[email protected]>
Collaborator
|
Thanks @Nitjsefnie! SSH host key verification is already covered in PR #20 (merged on feat/add-mcp). Closing as duplicate — appreciate the contribution. |
OkiriGabriel
added a commit
that referenced
this pull request
Jul 16, 2026
Consolidate SSH argv construction in tools/ssh_utils.build_ssh_argv and wire collectors/server.py and tools/executor.py to create_subprocess_exec instead of shell strings. Removes duplicate unused _build_ssh_args helpers. Fixes 7 failing tests from Nitjsefnie PR #22 merge on main. Co-authored-by: Cursor <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the man-in-the-middle exposure caused by
StrictHostKeyChecking=noin remote SSH collection.What changed
collectors/server.pyStrictHostKeyChecking=nofrom the SSH command used to collect remote server diagnostics.asyncio.create_subprocess_shelltoasyncio.create_subprocess_execfor the SSH argv, removing local shell injection risk for the remote path.tools/executor.pyStrictHostKeyChecking=nofrom the SSH command used byrun_shell_commandagainst remote hosts.create_subprocess_execchange as above..env.exampleSSH_KNOWN_HOSTSand the requirement to mount aknown_hostsfile.SSH_REMOTE_USERusage.docs/CENTRALIZED_DEPLOYMENT.md.envchecklist to reflect strict host-key verification andknown_hostsmounting.tests/test_ssh_remote.pyStrictHostKeyChecking=no.SSH_KNOWN_HOSTSis passed asUserKnownHostsFile.SSH_REMOTE_USERproduces theuser@hostform and does not override an explicituser@host.collectors/server.pyandtools/executor.pywithout opening real SSH connections.Operational consequence (by design)
Remote SSH collection now relies on OpenSSH's default strict host-key checking. Deployments that previously depended on the insecure
StrictHostKeyChecking=nobehavior must mount or populate aknown_hostsfile and setSSH_KNOWN_HOSTS, or SSH connections to remote servers will fail. This is intentional — it prevents MITM attacks.Tests / gates
Result:
80 passed, 1 warning in 1.13sCloses #12
Prepared with AI assistance (Kimi K2.7 Code), human-reviewed before submission.