Skip to content

[v12] Integrations: AWS OIDC - ListDatabases action#24877

Merged
marcoandredinis merged 1 commit intobranch/v12from
marco/v12/backport24460
Apr 28, 2023
Merged

[v12] Integrations: AWS OIDC - ListDatabases action#24877
marcoandredinis merged 1 commit intobranch/v12from
marco/v12/backport24460

Conversation

@marcoandredinis
Copy link
Copy Markdown
Contributor

Backport of #24460

@github-actions github-actions Bot requested review from kimlisa and r0mant April 20, 2023 08:49
@public-teleport-github-review-bot
Copy link
Copy Markdown

@marcoandredinis - this PR will require admin approval to merge due to its size. Consider breaking it up into a series smaller changes.

@marcoandredinis marcoandredinis force-pushed the marco/v12/backport24460 branch from 102d101 to a74d423 Compare April 20, 2023 08:49
@marcoandredinis marcoandredinis force-pushed the marco/v12/backport24460 branch 4 times, most recently from 52f1f3d to ec35491 Compare April 24, 2023 10:56
This PR adds a new Action for the AWSOIDC Integration: ListDatabases
The goal of this action is to provide the User a list of RDS Databases
from which the User will pick one to be added as a Teleport Database
Resource.
This way, the user doesn't need to copy/paste DB name, endpoints and
labels.

Before being able to call this action, the User has to set up an AWS
OIDC integration.

How does it work:
```
                    Client (web app)
                     │     ▲
                     │     │4. Returns list of DBs
 1. List Databases   │     │   (name, tags, status, endpoint)
                     │     │
                     │     │
                     │     │
                     │     │
                     ▼     │       3. rds.DescribeDBInstances
               ┌───────────┴────┐     (auth: token)                ┌─────────┐
               │                ├─────────────────────────────────►│         │
               │ Teleport Proxy │                                  │   AWS   │
               │                │     3.1. Get OIDC Config         │         │
               │                │◄─────────────────────────────────┤         │
               │                │     3.2. Get RSA Public Key      │         │
               │                │◄─────────────────────────────────┤         ├─────────┐ 3.3.
               │                │                                  │         │         │Validates token signature
               │                │                                  │         │         │with received public key
               │                │   3.4 Returns list of DBs        │         │◄────────┘
               │                │◄─────────────────────────────────┤         │
               └─┬──────────────┘                                  └─────────┘
                 │
                 │  2. Sign Token
                 │
                 ▼
              ┌───────────────────┐
              │                   │
              │   Teleport Auth   │
              │  RSA Private Key  │
              └───────────────────┘

```

Eg of an HTTP response from `4.`
```json
{
   "databases":[
      {
         "name":"marcodb-test",
         "desc":"RDS instance in us-east-1",
         "protocol":"postgres",
         "type":"rds",
         "labels":[
            {
               "name":"account-id",
               "value":"123456789012"
            },
            {
               "name":"canBeDeleted",
               "value":"yes"
            },
            {
               "name":"endpoint-type",
               "value":"instance"
            },
            {
               "name":"engine",
               "value":"postgres"
            },
            {
               "name":"engine-version",
               "value":"14.6"
            },
            {
               "name":"env",
               "value":"test"
            },
            {
               "name":"project",
               "value":"discover"
            },
            {
               "name":"region",
               "value":"us-east-1"
            },
            {
               "name":"status",
               "value":"available"
            },
            {
               "name":"teleport.dev/origin",
               "value":"cloud"
            }
         ],
         "hostname":"marcodb-test.abcdef123456.us-east-1.rds.amazonaws.com",
         "uri":"marcodb-test.abcdef123456.us-east-1.rds.amazonaws.com:5432",
         "aws":{
            "region":"us-east-1",
            "rds":{
               "instance_id":"marcodb-test",
               "resource_id":"db-123456ABCEDF123456ABCEDF00",
               "iam_auth":false
            },
            "account_id":"123456789012",
            "status":"available"
         }
      }
   ]
}
```
@marcoandredinis marcoandredinis force-pushed the marco/v12/backport24460 branch from ec35491 to 974541f Compare April 27, 2023 15:53
@marcoandredinis
Copy link
Copy Markdown
Contributor Author

@kimlisa @r0mant Please take a look when you get a chance 🙏

@marcoandredinis marcoandredinis added this pull request to the merge queue Apr 28, 2023
Merged via the queue into branch/v12 with commit beb342f Apr 28, 2023
@marcoandredinis marcoandredinis deleted the marco/v12/backport24460 branch April 28, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants