Add STS session tags support for DynamoDB access#35376
Conversation
greedy52
left a comment
There was a problem hiding this comment.
If agent's IAM role has a boundary policy, is sts:TagSession required in the boundary?
@smallinsky what are your thoughts on this appraoch? Thanks
I might be wrong but this should not be needed and the only proper trust relation setup is required but I it work to check and test. One improvement is tempting: Namely in current implementation a custom will need to create N teleport database resouce for each DynamoDB table I if session_tags can support simple expressions so customer will be able to configure database using session_tags template: By that we will support table rback for dynamoDB: and a user will be able to dynamically connect to dynamo-database tables using The cons is naming confusion db_name == DynamoDB table. |
If we were to support a "dynamo-table-as-database-name" mode, should we implement the access control properly on the Teleport side?
I think this would be more aligned with how access is controlled for other databases so that we don't have to rely on AWS IAM policy for permission management. What do you think? (if doing so, we can track it as a separate feature)
This was meant for @gabrielcorado to double check. It didn't work for me without |
Agree, Let's keep it out of scope and we can discuss this separately. |
|
@greedy52 Yes, if the agent role has a boundary set, it needs to get updated with the |
Could you update the AWS configurator as well? teleport/lib/configurators/aws/aws.go Lines 270 to 273 in f17ace0 Thanks! |
|
@smallinsky PTAL. thanks! |
|
@gabrielcorado See the table below for backport results.
|
* feat: dynamodb database access configuration for adding sts tags * refactor: apply code review suggestions * feat(configurators): add TagSession boundary permission dynamo * feat(config): session tags omitempty
Closes #33131.
This update adds support for specifying STS session tags on database configurations. The tags will be passed into the assume role call for DynamoDB database access, making them available on the IAM policies. This feature allows users to have one Teleport database configured per DynamoDB table (to have granular access) but share IAM roles used to connect.
changelog: Added support for STS session tags in the database configuration for granular DynamoDB access.
Usage example
Create/Update the IAM access role to include the tag session permissions on the trust policy. For this example, we're naming this role as
DynamoScanTableRole. Note: If the role used has a permission boundaries set, it will also need to get updated with the new STS permissions.Update the IAM role policy to use the session tag. Here is an example of a policy that gives access to describe the table:
Run proxy tunnel (same as regular DynamoDB access):
tsh proxy db --tunnel --port 8000 --db-user=DynamoScanTableRole dynamo-table-aExecute the DynamoDB queries:
Trying to describe any other table should return access denied error: