gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
17.22k stars 1.73k forks source link

Update Discovery and Database Service IAM permission setup #43829

Open GavinFrazar opened 1 month ago

GavinFrazar commented 1 month ago

The machinery for auto-configuring “connect” permissions is used for: RDS, RDS Proxy, Redshift, and ElastiCache.

For all of these, our auto-configuration tools like teleport db configure aws and teleport discovery bootstrap follow the same pattern:

  1. setup a policy statement attached to <db service role> like this:
        {
            "Action": [
                "iam:PutRolePolicy",
                "iam:GetRolePolicy",
                "iam:DeleteRolePolicy"
            ],
            "Effect": "Allow",
            "Resource": "<db service role arn>",
            "Sid": "AllowDynamicDatabaseIAMAuth"
        }
  2. attach a permissions boundary to <db service role> that limits, but does not grant, permissions. This is to prevent privilege escalation via PutRolePolicy. For example:
        {
            "Action": "rds-db:connect",
            "Effect": "Allow",
            "Resource": "*",
            "Sid": "AllowDatabaseIAMAuth"
        }

Then, the db service will monitor and modify its own permissions dynamically and add connect permission just in time for a connection.

This is complicated, grants the same effective permissions as the limits in the boundary policy, and makes a lot of customers ask questions. They ask questions because at first glance, granting an identity permissions to modify its own permissions is the same as granting all permissions in an AWS account. If the boundary policy is ever detached, then that is exactly what it means actually. The boundary policy also complicates permissions because we have to effectively name every permission twice: once in the permission policy and once in the permissions boundary.

We can eliminate the complicated permissions boundary, improve security posture, and simplify IAM setup for customers by eliminating the dynamic policy configuration. The db service works already without this dynamic policy setup by the way.

Therefore, this issue will be to track updates to our docs, auto configuration tools, and web ui integrations, with a focus to simplify IAM configuration for the Teleport Database Service and Teleport Discovery Service.

The migration for dynamic permissions is simple: in the next major release the database service will attempt to grant itself the required static permissions as a migration. In next major+1, database service will no longer monitor/update its own permissions.

Related

GavinFrazar commented 1 month ago

@ptgott the docs work for this issue is all in https://github.com/gravitational/teleport/pull/44042 so I don't think there's any additional actions that the docs team needs to take for this