For me the solution was to ensure that my local ssh-agent
had both keys to the bastion host AND the target node. Once that was the case, a command like this worked. In other words:
Given I am using a bastion host
And I have 2 distinct ssh key pairs; 1 to get from workstation to the bastion host and another to get from the bastion host into the target nodes
And the output of ssh-agent -l
from my workstation is
2048 SHA256:yyyyy /Users/me/.ssh/id_rsa (RSA)
2048 SHA256:zzzzz /Users/me/.ssh/internal-vpc-private-rsa-key (RSA)
When I run a command like:
knife ssh "$CHEF_SEARCH_QUERY" interactive \
--config knife.rb \
--ssh-gateway $JUMPBOX_IP \
--ssh-user $SSH_USER \
--attribute 'cloud.public_ipv4'
Then N interactive ssh sessions are established with the target hosts