Skip to content

Commit

Permalink
Add warning when generate_lease=true (#16398)
Browse files Browse the repository at this point in the history
This option is known to cause problems with large numbers of issued
certificates. Ensure admins are warned about the impact of this field
and encourage them to disable it.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
  • Loading branch information
cipherboy committed Aug 8, 2022
1 parent 4afd49b commit a736c12
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions builtin/logical/pki/path_roles.go
Expand Up @@ -735,6 +735,9 @@ func (b *backend) pathRoleCreate(ctx context.Context, req *logical.Request, data
}
} else {
*entry.GenerateLease = data.Get("generate_lease").(bool)
if *entry.GenerateLease {
warning = "it is encouraged to disable generate_lease and rely on PKI's native capabilities when possible; this option can cause Vault-wide issues with large numbers of issued certificates"
}
}

resp, err := validateRole(b, entry, ctx, req.Storage)
Expand Down Expand Up @@ -939,6 +942,10 @@ func (b *backend) pathRolePatch(ctx context.Context, req *logical.Request, data
} else {
entry.GenerateLease = oldEntry.GenerateLease
}

if *entry.GenerateLease {
warning = "it is encouraged to disable generate_lease and rely on PKI's native capabilities when possible; this option can cause Vault-wide issues with large numbers of issued certificates"
}
}

resp, err := validateRole(b, entry, ctx, req.Storage)
Expand Down

0 comments on commit a736c12

Please sign in to comment.