Refactor ssh known hosts - #310
Merged
Merged
Conversation
Collaborator
Pipeline
|
| Status | Task | Duration |
|---|---|---|
| ✅ | github-set-pending-status | 6s |
| ✅ | fetch-repository | 10s |
| ✅ | init-values | 4s |
| ✅ | get-cache | 2m6s |
| ✅ | commit-validate | 5s |
| ✅ | dockerfile-lint | 7s |
| ✅ | helm-lint | 5s |
| ✅ | helm-docs | 10s |
| ✅ | build | 1m5s |
| ✅ | sonar | 1m8s |
| ✅ | save-cache | 1m8s |
| ✅ | buildkit-build | 29s |
| ✅ | github-report-pipeline-status | 8s |
…errit connections Every outbound SSH connection accepted any host key: the git provider used InsecureIgnoreHostKey for all repository traffic including the packless transport, the GitServer connectivity check did the same for every provider, and the Gerrit client used a callback that unconditionally returned nil. A network-position attacker could impersonate a git server to intercept pushed source or serve falsified refs. Host keys are now verified against a known_hosts file shipped by the chart as a ConfigMap and mounted as a directory rather than with subPath, so the kubelet refreshes it in place and added entries take effect without restarting the operator. The file is seeded with keys for github.com, gitlab.com and bitbucket.org. In the go-git paths the host key callback is left unset rather than replaced: go-git then derives HostKeyAlgorithms from known_hosts as well, which avoids spurious key-mismatch failures when a server offers a key type that is absent from the file. Failures name the host, the port and the remediation command through GitServer .status.error. A key mismatch is reported distinctly from an unknown host and never suggests re-scanning, since that would trust whatever key was just presented. BREAKING CHANGE: GitServers authenticating over SSH to a host outside the seeded providers must have their host keys added to knownHosts.entries before upgrading. GitServers using token authentication are unaffected. Note: git operations for the github, gitlab and bitbucket providers connect on port 22 regardless of spec.sshPort, so a server on another port needs both entry forms pinned. Design decisions, recorded here rather than as comments describing what the code does not do: - No switch disables verification. An operator-wide opt-out would be turned on once and never turned off. - The go-git paths leave AuthMethod.HostKeyCallback unset instead of supplying one, so go-git also derives HostKeyAlgorithms from known_hosts; supplying a callback suppresses that and turns a missing entry into a reported key mismatch. - The chart mounts the ConfigMap as a directory rather than with subPath, because the kubelet only refreshes in-place directory mounts, so a host key can be added without restarting the operator. - The Dockerfile's SSH_KNOWN_HOSTS moves onto the chart's path so the image default and the chart agree on one file instead of two. Signed-off-by: Sergiy Kulanov <[email protected]>
SergK
force-pushed
the
refactor-ssh-known-hosts
branch
from
August 4, 2026 13:00
7ff524a to
7a0f20f
Compare
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.
EPMDEDP-17256: fix: Verify SSH host keys for all git, GitServer and Gerrit connections