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

Expiry date #160

Open
andymac4182 opened this issue May 31, 2021 · 2 comments
Open

Expiry date #160

andymac4182 opened this issue May 31, 2021 · 2 comments

Comments

@andymac4182
Copy link

andymac4182 commented May 31, 2021

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.

@felddy
Copy link

felddy commented Oct 27, 2022

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
}

@andymac4182
Copy link
Author

I ended up moving to http://granted.dev which handles this.

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

No branches or pull requests

3 participants