Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cleanup flag to delete deactivated key if specified #6

Merged
merged 1 commit into from
Oct 15, 2018

Conversation

ymatsiuk
Copy link
Contributor

As requested in #4

@stefansundin
Copy link
Owner

Note that the key that is used to delete the key was deactivated just above the deletion. It is probably fine as I think it takes a couple of seconds for the key deletion to propagate. But should probably be tested a bunch of times to see that it works reliably.

@ymatsiuk
Copy link
Contributor Author

@stefansundin apparently if I re-read newly created .credentials file and create new session:

Error getting caller identity. Is the key disabled?

InvalidClientTokenId: The security token included in the request is invalid.
	status code: 403, request id: xx-xx-xx-xx

Will try to add the check + retry before doing this and see if it helps and how much time does it take for the new key to be available.

@stefansundin
Copy link
Owner

I think what you have is probably ok, just wanted to make sure it was tested thoroughly.

You could also just delete the old key and skip disabling it when -cleanup is used. If the key deletion failed, then it's probably ok to just print and error and not bother to fall back on disabling the key. In that case, the user should contact their AWS administrator to have the permissions updated to allow for that.

@ymatsiuk ymatsiuk force-pushed the master branch 2 times, most recently from fb76e65 to dadb849 Compare October 13, 2018 08:39
@ymatsiuk
Copy link
Contributor Author

@stefansundin I polished a bit previous solution according to what we discussed in this PR.

Copy link
Owner

@stefansundin stefansundin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have one last comment, but it's minor so I am also approving. :)

@@ -24,7 +24,10 @@ Usage of aws-rotate-key:
The profile to use. (default "default")
-version
Print version number (1.0.3)
-y Automatic "yes" to prompts.
-y
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only comment is that this text is the output from aws-rotate-key -help, which now will say:

  -d	Delete old key without deactivation.
  -profile string
    	The profile to use. (default "default")
  -version
    	Print version number (1.0.3)
  -y	Automatic "yes" to prompts.

It is not obvious that the text is from there. And I don't think we need to keep it exactly the same.

Copy link
Contributor

@boroivanov boroivanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ymatsiuk 👍

@boroivanov boroivanov merged commit 241f868 into stefansundin:master Oct 15, 2018
@boroivanov
Copy link
Contributor

@ymatsiuk your changes were released with https://github.com/Fullscreen/aws-rotate-key/releases/tag/v1.0.4

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

Successfully merging this pull request may close these issues.

None yet

3 participants