Expiry date
andymac4182 opened this issue · comments
When getting some integration with Starship (starship/starship#2464) going we noticed a difference in the format between awsvault and awsume.
Not sure if this is an easy change or if this will impact on other people but it would be great if awsume could include the timezone information in the expiry.
Not sure which is the "right" answer here was just trying to get the extra info added if it isn't too hard.
It looks like it would require a few updates to the places where the expiration is written out and checked against for autoawsume.
Happy to give this a go and write up a PR if you are happy for that.
As a workaround I added this function to my bash environment:
awsume() {
source "$(pyenv which awsume)"
# Add the local time zone to AWSUME_EXPIRATION if it is missing
# See: https://github.com/trek10inc/awsume/issues/160
# If a time zone is not specified, add the local time zone
if [[ $AWSUME_EXPIRATION =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})$ ]]; then
# Calulate the local tz offset in hours and minutes separated by a colon
local tz_offset=$(date +%z | sed -E 's/([0-9]{2})([0-9]{2})/\1:\2/')
export AWSUME_EXPIRATION="${AWSUME_EXPIRATION}${tz_offset}"
fi
}
I ended up moving to http://granted.dev which handles this.