trek10inc / awsume

A utility for easily assuming AWS IAM roles from the command line.
https://awsu.me
MIT License
488 stars 90 forks source link

`autoawsume` leaves session with expired credentials for ~ 60s #91

Closed valdisrigdon closed 4 years ago

valdisrigdon commented 4 years ago

Why does https://github.com/trek10inc/awsume/blob/master/awsume/autoawsume/main.py#L69 add 60s to the sleep time? This is leaving the session with invalid credentials during that 60s.

mbarneyjr commented 4 years ago

This is a bug, it should be subtracting 60s, to make sure you always have valid credentials. Thanks for the bug report! This has been fixed in 4.2.2.

valdisrigdon commented 4 years ago

The fix doesn't quite work; what's happening now is that it wakes up 60s early, but then discovers that nothing is expired, then tries to sleep until something expires, which is usually just under 60s - 60s, so it's a negative sleep time.

main.py needs to refresh credentials if they are expired or will expire in less than or equal to 60s as well.

valdisrigdon commented 4 years ago

@mbarneyjr Should I open a new issue for this? With the fix that when in, auto-refresh is pretty much broken.