Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Add ssh option to explicitly used named key #107

Merged
merged 3 commits into from
Jul 3, 2020
Merged

Add ssh option to explicitly used named key #107

merged 3 commits into from
Jul 3, 2020

Conversation

rcj4747
Copy link
Contributor

@rcj4747 rcj4747 commented Apr 10, 2020

The ssh command will attempt to connect to the instance by offering each of the ssh keys registered with the ssh agent on the user's system and then offering the key provided explicitly on the command-line from the '-i' option. Arguably this order seems wrong, but that is the behavior of openssh. For users that have a number of keys registered with their agent the host may reject the connection attempt due to too many failed keys (default for this is 5) without ever trying the key specified on the command-line.

This patch adds the IdentitiesOnly ssh option which has ssh ignore the keys registered with the agent and only attempt a connection using the key specified by the '-i' option. This ensures that the correct key is used, and only that key. It provides a smoother, more consistent experience and helps with the support experience as failures with this command-line eliminate some additional debugging of the key exchange.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The ssh command will attempt to connect to the instance by offering each of the ssh keys registered with the ssh agent on the user's system and then offering the key provided explicitly on the command-line from the '-i' option.  Arguably this order seems wrong, but that is the behavior of openssh.  For users that have a number of keys registered with their agent the host may reject the connection attempt due to too many failed keys (default for this is 5) without ever trying the key specified on the command-line.

This patch adds the `IdentitiesOnly` ssh option which has ssh ignore the keys registered with the agent and only attempt a connection using the key specified by the '-i' option.  This ensures that the correct key is used, and only that key.  It provides a smoother, more consistent experience and helps with the support experience as failures with this command-line eliminate some additional debugging of the key exchange.
@rcj4747
Copy link
Contributor Author

rcj4747 commented Apr 10, 2020

This same change has been proposed for ec2instanceconnectcli @ aws/aws-ec2-instance-connect-cli#10

@julieso julieso merged commit cc172b1 into awsdocs:master Jul 3, 2020
@julieso
Copy link
Contributor

julieso commented Jul 3, 2020

Thanks for the contribution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants