fix(gluekube_ssh): use ProxyJump instead of SSH agent forwarding - #562
Open
venkatamutyala wants to merge 2 commits into
Open
fix(gluekube_ssh): use ProxyJump instead of SSH agent forwarding#562venkatamutyala wants to merge 2 commits into
venkatamutyala wants to merge 2 commits into
Conversation
…ent forwarding The bastion's sshd now sets `AllowAgentForwarding no` (AllowTcpForwarding is still yes). Every double-hop in gluekube_ssh relied on `ssh -A` + a nested `ssh` on the bastion, so the forwarded agent was stripped and the second hop failed with "Permission denied (publickey)" — the kubeconfig fetch, the port-forwards, and interactive SSH to non-bastion nodes all broke. Switch all bastion hops to a `-W` ProxyCommand and authenticate both hops from the LOCAL ssh-agent (keys are already loaded by load_connection_keys). The agent is never exposed to the bastion and no private key is written to disk, so this is both functional again and more secure than agent forwarding. Because the tunnel now terminates on the master, the port-forwards only bind 6443 locally — nothing on the bastion — so the random mid-port workaround that existed to dodge a stale bastion-side 6443 bind is removed. Verified end-to-end against nonprod.jupiter.onglueops.rocks: fresh kubeconfig fetched and the forwarded API answered kubectl (v1.34.5). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
gluekube_ssh --profile <p> --cluster <fqdn> --kubectl(and the interactive SSH / kubeconfig / port-forward paths) fail with:Root cause is not the AutoGlue API — cluster resolution,
/clusters/<id>, and/ssh/<id>?reveal=trueall return correct data. The bastion's sshd has been hardened to:Every bastion hop in the script used
ssh -A+ a nestedsshon the bastion and relied on the forwarded agent to authenticate the second hop. With agent forwarding disabled, the forwarded agent is stripped and the master rejects the connection:Permission denied (publickey).Fix
Reach cluster nodes through the bastion with a
-WProxyCommand instead of agent forwarding. Both hops authenticate from the local ssh-agent (keys are already loaded byload_connection_keys):AllowAgentForwarding no.AllowTcpForwarding yes, which is enabled.Converted call sites: headless quick-connect fetch + port-forward (
kubeconfig_and_port_forward), interactive port-forward (kubectl_mode), kubeconfig copy (kubeconfig_mode), and non-bastion SSH (connect_ssh). Added a sharedbastion_proxyhelper +SSH_OPTS.Because the tunnel now terminates on the master, the port-forwards bind
6443locally only — nothing on the bastion — so the random mid-port workaround (previously needed to dodge a stale bastion-side6443bind) is removed.Testing
Verified end-to-end against
nonprod.jupiter.onglueops.rocks:kubectl get --raw=/versionthrough the tunnel returnedv1.34.5.bash -nsyntax check passes.🤖 Generated with Claude Code