mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-28 22:21:30 +01:00
Honor mount-tuned ttl/max ttl for database credential generatoin (#4053)
This commit is contained in:
parent
d349f5b0a7
commit
f51a7dad65
@ -74,9 +74,16 @@ func (b *databaseBackend) pathCredsCreateRead() framework.OperationFunc {
|
||||
}
|
||||
}
|
||||
|
||||
ttl := role.DefaultTTL
|
||||
if ttl == 0 || (role.MaxTTL > 0 && ttl > role.MaxTTL) {
|
||||
ttl = role.MaxTTL
|
||||
ttl := b.System().DefaultLeaseTTL()
|
||||
if role.DefaultTTL != 0 {
|
||||
ttl = role.DefaultTTL
|
||||
}
|
||||
maxTTL := b.System().MaxLeaseTTL()
|
||||
if role.MaxTTL != 0 && role.MaxTTL < maxTTL {
|
||||
maxTTL = role.MaxTTL
|
||||
}
|
||||
if ttl > maxTTL {
|
||||
ttl = maxTTL
|
||||
}
|
||||
|
||||
expiration := time.Now().Add(ttl)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user