Skip to content

Commit

Permalink
vault: reset token TTL to 0 when renewing token
Browse files Browse the repository at this point in the history
This commit resets the token TTL to zero once we start
another re-authentication attempt. The reason is that if
we fail to re-authenticate, we should not wait again for 80%
of the prev. token TTL but instead re-authenticate right
away.

Signed-off-by: Andreas Auernhammer <[email protected]>
  • Loading branch information
aead committed Jan 13, 2025
1 parent 4945c09 commit 1b15621
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions internal/keystore/vault/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func (c *client) RenewToken(ctx context.Context, authenticate authFunc, secret *
}

renewIn := 80 * (ttl / 100) // Renew token after 80% of its TTL has passed
ttl = 0 // Set TTL to zero to trigger an immediate re-authentication in case of auth failure
select {
case <-ctx.Done():
return
Expand Down
Binary file added kes-linux-amd64
Binary file not shown.

0 comments on commit 1b15621

Please sign in to comment.