vault: limit token delay to not exceed token TTL #504
Merged
+17
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit fixes a bug in the Vault token renewal. When KES renews its current token
T1
and receives a new tokenT2
, KES waits a certain amount of time before usingT2
to account for replication lag between Vault nodes.Vault tokens are not signed but static secrets. Each Vault node in a dist. cluster needs to know the token before being able to verify it. Without the usage delay described above, KES might send a request to a Vault node that has not received the new token
T2
, yet.Now, KES must also not wait longer then the remaining TTL of the current token
T1
. Otherwise,T1
expires BEFORE KES starts usingT2
. This results in auth errors like the following:This commit limits the max. time KES waits before using the new token
T2
to either half the remaining TTL ofT1
or 30s - whatever is shorter. This ensures thatT1
is still valid once KES switches toT2
.