Allow users impersonating database service generate database certs #7024
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 PR fixes the issue with users not being able to produce database certificates using
tctl auth sign --format=db
with remote proxy: #6937. The effect of this issue is that it is basically impossible to connect self-hosted databases to the Cloud currently.Note: Here "database certificate" refers to the certificate that cluster admin uses to configure their self-hosted database instance with (signed with Teleport's host CA), not the client certificate issued during
tsh db login
.Previously, we would only check for built-in roles
Admin
andDatabase
which is both inflexible and, arguably, less secure. With this change I introduced a separatedb_cert
resource kind we're checking for "create" permission on: rather than checking for "create" ondb_server
as proposed in the linked ticket, I decided that having a separate resource makes more sense and also this is in-line with how host certificates RBAC is checked - which is conceptually similar.Consequentially, I've updated our default
admin
andeditor
user roles and built-inDatabase
role (used by database service agent) to include permission to generate these certificates.Closes #6937. Needs backport to v6.