This repository was archived by the owner on Nov 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Add support for ephemeral SSH keys via EC2 Instance Connect #17
Open
zytek
wants to merge
6
commits into
zendesk:master
Choose a base branch
from
zytek:ec2-connect
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
47431ee
Vendor update
zytek 5ef90b1
Add support for EC2 Instance Connect
zytek 84dd471
Support pushKey on tunnel subcommand also
zytek 2a20bb7
Add -i option to ssh if using EC2 Push Key
zytek 4b018e0
add GetRegion to resources
zytek 2d1ed3f
clarify ssh key flag
zytek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "github.com/spf13/cobra" | ||
| "github.com/zendesk/goship/config" | ||
| "github.com/zendesk/goship/utils" | ||
| "os" | ||
| ) | ||
|
|
||
| var pushkeyCmd = &cobra.Command{ | ||
| Use: "push-key <search_keyword> [environment]", | ||
| Short: "Push key to instance via EC2 Instance Connect", | ||
| Long: "Push key to instance via EC2 Instance Connect", | ||
| PreRun: setSSHArgsFunc, | ||
| Args: cobra.MinimumNArgs(1), | ||
| Run: pushkeyCmdFunc, | ||
| } | ||
|
|
||
| func init() { | ||
| RootCmd.AddCommand(pushkeyCmd) | ||
| } | ||
|
|
||
| func pushkeyCmdFunc(cmd *cobra.Command, args []string) { | ||
|
|
||
| cacheList := getCacheList() | ||
|
|
||
| output := filterCacheList(&cacheList, cmd.Annotations) | ||
|
|
||
| if len(output) == 0 { | ||
| fmt.Printf("Could not find any matches for identifier %s", cmd.Annotations["resource"]) | ||
| os.Exit(1) | ||
| } | ||
|
|
||
| resource, err := utils.ChooseFromList(output) | ||
| if err != nil { | ||
| fmt.Printf("Error: %s", err) | ||
| os.Exit(1) | ||
| } | ||
|
|
||
| if config.GlobalConfig.UseEC2Connect { | ||
| err := pushSSHKey(resource) | ||
| if err != nil { | ||
| fmt.Printf("Failed to push SSH key: %v", err) | ||
| os.Exit(1) | ||
| } | ||
| } | ||
| } |
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.