Commit Graph
103 Commits
Author SHA1 Message Date
Justinas StankevičiusandJakub Nyckowski 6fbfadc230 Access Graph: sync AWS identity providers (#41368)
* Add AWSSAMLProviderV1 to access graph proto

* Access Graph: sync AWS SAML Providers

* Parse SAML entity descriptor before sending to TAG

* Add protos for AWS OIDC providers

* Fetch AWS OIDC providers

* Fetch signing certificates for AWS SAML providers

* Deflake identity provider fetch test

The concrete implementation of IAM mock uses a map,
resulting in non-deterministic iteration order.
Sort the results before comparing to alleviate.

* Update lib/srv/discovery/fetchers/aws-sync/iam_test.go

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>

---------

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>
2024-05-14 16:20:36 +00:00
Edoardo Spadolini 33e80cd8f2 Support dynamic SSH host signers (#41227)
* Add a host signers callback to sshutils.Server

* Lift host signers callback into regular.Server

* Lift host signers callback into reversetunnel.Server
2024-05-13 13:11:44 +00:00
Marco DinisandEdward Dowling 0aaf1b21c3 AWS OIDC: Script to configure EC2 Auto Discover with SSM (#41053)
* AWS OIDC: Script to configure EC2 Auto Discover with SSM

There's a new teleport command that adds an inline policy which enables
the AWS OIDC Integration to handle EC2 Auto Discover using the script
mode (SSM).
It also adds the SSM Document used in the teleport installation.

There's also a new endpoint which returns the one off script that uses
that command.

* Update lib/integrations/awsoidc/ec2_ssm_iam_config.go

Co-authored-by: Edward Dowling <EdwardDowling@users.noreply.github.com>

---------

Co-authored-by: Edward Dowling <EdwardDowling@users.noreply.github.com>
2024-05-09 17:20:27 +00:00
Tiago Silva cf20bc282d Fix missing permission to describe access entries (#40940)
This PR fixes a missing permission when describing access entries for
eks clusters

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-04-26 12:11:20 +00:00
Zac Bergquist 8cd1c429f5 Fix up some poor wording (#40832)
Closes #40294
Closes #39172
2024-04-23 22:01:41 +00:00
Tiago Silva 4f7c085d71 Reduce parallelism when polling from AWS APIs (#40775)
Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-04-23 08:48:16 +00:00
Marco André Dinis dc5975ea37 AWS OIDC: IAM set up for AWS App Access (#40575)
* AWS OIDC: IAM set up for AWS App Access

AWS App Access using AWS OIDC Integration requires a new policy in the
AWS OIDC Role.
This PR adds a one-off script that executes the configuration command
that adds said policy.

* improved comments, remove dead code, improve logging

* improve comment and http client var name

* move back to interface

* remove default client

* rename role to rolename

* enable fips endpoint support

* restrict target roles by their tags

* use true for tag value
2024-04-19 14:56:44 +00:00
STeve (Xin) Huang 8978ab34f7 Support Azure CLI Access on AKS with workload identity (#40142)
* Support Azure CLI Access on AKS with workload identity

* fix lint and properly pass along a logger

* fix typos

* reverse error check and fix typo

* fix terraform go.mod

* fix event handler go.mod
2024-04-17 15:00:38 +00:00
dependabot[bot]andAlan Parra d2d490d88f Bump the go group with 3 updates (#40594)
* Bump the go group with 3 updates

Bumps the go group with 3 updates: [cloud.google.com/go/compute/metadata](https://github.com/googleapis/google-cloud-go), [github.com/ClickHouse/clickhouse-go/v2](https://github.com/ClickHouse/clickhouse-go) and [github.com/go-ldap/ldap/v3](https://github.com/go-ldap/ldap).


Updates `cloud.google.com/go/compute/metadata` from 0.2.3 to 0.3.0
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/netapp/v0.2.3...v0.3.0)

Updates `github.com/ClickHouse/clickhouse-go/v2` from 2.23.0 to 2.23.1
- [Release notes](https://github.com/ClickHouse/clickhouse-go/releases)
- [Changelog](https://github.com/ClickHouse/clickhouse-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ClickHouse/clickhouse-go/compare/v2.23.0...v2.23.1)

Updates `github.com/go-ldap/ldap/v3` from 3.4.7 to 3.4.8
- [Release notes](https://github.com/go-ldap/ldap/releases)
- [Commits](https://github.com/go-ldap/ldap/compare/v3.4.7...v3.4.8)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/compute/metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go
- dependency-name: github.com/ClickHouse/clickhouse-go/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go
- dependency-name: github.com/go-ldap/ldap/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go
...

Signed-off-by: dependabot[bot] <support@github.com>

* Tidy all modules

* Address go/compute/metadata deprecations

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2024-04-17 13:37:25 +00:00
Marco André Dinis 455632e28a EC2 Auto-Discovery: EICE support (#35504)
* AutoDiscover: add support for EICE nodes

* ignore openssh nodes when updating labels from serverinfo

* downcase imports

* improve comment on why we need account/instance and subkind

* add applyovertime method

* skip nodes that wont expire in the near future

* create helper functions
2024-03-26 16:16:20 +00:00
Marco André Dinis 64ad6ba632 AWS OIDC IdP Configuration: support S3 buckets as provider (#39026)
This PR adds support for setting the AWS OIDC Integration with an S3
bucket as issuer.
2024-03-15 22:11:25 +00:00
Reed Loden 23c67d4c16 Re-enable AWS IMDSv1 fallback (#39363)
It was discovered that some customers' EKS clusters did not have their IMDSv2 hop limits
set correctly, causing requests for key functionality to attempt IMDSv1 fallback and failing.

For now, re-enable IMDSv1 fallback by way of removing the explicit disabling of
`EC2MetadataEnableFallback` until better documentation, error handling, and other work
can be done to inform customers that they need to correctly set their IMDSv2 hop limits.
2024-03-14 18:12:50 +00:00
Tiago Silva 58ebf54854 TAG: Poll AWS EKS clusters fom AWS (#38984)
This PR polls the AWS EKS clusters and their AssociatedAccessPolicies
and AccessEntries and syncs them into TAG.

Part of https://github.com/gravitational/access-graph/issues/459

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-03-07 19:16:24 +00:00
Marco André Dinis 62933c4f3a AWS OIDC - DeployService: Add ecs:TagResource policy (#39066)
If the Resource Tagging Authorization setting is enabled, the client
must hold the `ecs:TagResource` policy in order to create resources with
Tags.
2024-03-07 16:03:50 +00:00
STeve (Xin) Huang d2052894ba GCP MySQL IAM Auth support (#38240)
* GCP MySQL IAM Auth support

* convert no permission

* fix mock

* add UT

* minor refactoring

* fix lint

* return an error for postgres username format

* make user not found error more readable

* add a debug log when falling back to password auth
2024-03-06 15:43:25 +00:00
Tiago Silva 8f357eb432 AWS-OIDC: add ListRolePolicies and ListAttachedRolePolicies (#38926)
* AWS-OIDC: add ListRolePolicies and ListRoleAttachedPolicies

This PR adds missing  iam:ListAttachedRolePolicies and iam:ListRolePolicies IAM permissions to TAG setup wizard.

This complements PR https://github.com/gravitational/teleport/pull/38071

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* fix typo

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-03-05 11:02:50 +00:00
Tiago SilvaandAnton Miniailo 2eef6d7d2c Discovery: Allow configuring AWS TAG IAM integration (#38071)
* Disovery: Allow configuring AWS TAG IAM integration

This PR allows the configuration of IAM permissions required for Access
Graph AWS Sync using Teleport OIDC integration.

Part of https://github.com/gravitational/access-graph/issues/458

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* handle code review suggestions

* Update lib/web/integrations_awsoidc.go

Co-authored-by: Anton Miniailo <anton@goteleport.com>

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
Co-authored-by: Anton Miniailo <anton@goteleport.com>
2024-02-14 19:16:40 +00:00
Tiago Silva 784c28cae9 TAG: Poll AWS EC2, S3 and Policies (#37900)
This PR adds the code required for Teleport Discovery Service to be able to poll AWS resources in preparation to send them to TAG.

It only retrieves the resources and doesn't push them yet to TAG.

Part of https://github.com/gravitational/access-graph/issues/458
Depends on #37899
Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-02-12 10:04:26 +00:00
rosstimothy b7318b5c7e Enable errorlint via golangci-lint (#37669)
Adds the new linter and configures it to prevent direct error
comparisions and type assertions in favor of errors.Is and errors.As.
All current violations caught by the linter have been updated
accordingly.
2024-02-02 15:59:24 +00:00
Anton MiniailoandMarco André Dinis 134e26e778 Add command for configuring EKS IAM access for Discover (#36417)
* Add command for configuring EKS IAM access for Discover

* Remove redundant dot.

Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>

* Simplify test cases

* Fix typo.

* Fix imports

---------

Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>
2024-01-08 22:49:08 +00:00
Marco André DinisandLisa Kim 2cc0d62c03 AWS OIDC: DeployDatabaseService per VPC (#35899)
* AWS OIDC: Deploy Database Service to multiple VPCs

* Update lib/web/apiserver.go

Co-authored-by: Lisa Kim <lisa@goteleport.com>

* Update lib/web/ui/integration.go

Co-authored-by: Lisa Kim <lisa@goteleport.com>

---------

Co-authored-by: Lisa Kim <lisa@goteleport.com>
2024-01-08 16:46:35 +00:00
Nic Klaassen 0161397479 feat: AWS KMS keystore backend (#36238)
* feat: AWS KMS keystore backend

This commit adds backend support for AWS KMS as a keystore backend for
Teleport CAs.
It is similar to the existing GCP KMS support.

This PR was getting a bit large, so it does not yet expose the
configuration parameters to enable this in a real cluster, which will
come in a following PR, along with docs.

* simplify string concat

* fix lint
2024-01-06 01:26:03 +00:00
Zac Bergquist 44a6bb1933 Use pkg slices from the standard library (#35905)
Prefer the stdlib version of the experimental package.
Includes a depguard update to prevent future regressions,
as well as an e-ref update to appease depguard.

Generated with:

    $ gofmt -w -r '"golang.org/x/exp/slices" -> "slices"' . && \
        make fix-imports
2023-12-19 23:06:53 +00:00
Marco André Dinis 3306899762 Add vpc-id label to RDS Auto-Discover converter (#35775)
This PR adds a new label to RDS Instances and RDS Clusters to identify
its VPC ID.

For Clusters, an additional fetch was necessary because RDS
DescribeDBCluster does not return its VPC. So, a DescribeDBInstance must
be performed to obtain that information from one of its members.

This will allow us to deploy a DatabaseService in a specific VPC and
only proxy the Databases that also belong to that VPC.
2023-12-19 11:24:14 +00:00
Andrew Burke 7221745bf8 Fix gcp ssh always using external IP (#35151)
This change fixes a bug where the discovery service would always try
to SSH into a GCP instance with its external IP address, which may
not exist.
2023-12-07 20:11:01 +00:00
Gavin Frazar 0562ce0a0d use rds proxy port instead of proxy target port (#35347)
* use rds proxy port instead of proxy target port

* remove unused func and IAM permissions
2023-12-05 20:21:44 +00:00
fheinecke b178b8b732 Updated Teleport codebase to AGPL3 license (#35259)
Signed-off-by: Fred Heinecke <fred.heinecke@goteleport.com>
2023-12-01 17:48:14 +00:00
STeve (Xin) Huangandroot d8ce3697a3 Added IAM Authentication with IAM role support for Amazon Redshift (#34723)
* Added IAM Authentication with IAM role support for Amazon Redshift

* add auth UT

* update configurator

* remove fixtures

---------

Co-authored-by: root <root@ip-10-0-0-211.ca-central-1.compute.internal>
2023-11-29 21:31:02 +00:00
Nic Klaassen a3318979ed External Audit Storage: rename from ExternalCloudAudit (part 1) (#34961)
* External Audit Storage: rename from ExternalCloudAudit (part 1)

* fix buf-breaking lint

* remove unused event
2023-11-27 19:02:52 +00:00
Marco André Dinis 0ab79442ce Discovery: Use Integration credentials for fetchers (#34582)
* Discovery: Use Integration credentials for fetchers

* fix typos, improve docs, add clients.closer

* be explicit about using ambient or integration credentials

* remove integration assignment when using ambient credentials

* be explicit about using ambient credentials in db service

* fix cache key for region only sessions

* re-trigger license/cla check
2023-11-24 13:42:02 +00:00
Zac Bergquist 3d69ad9c03 Prevent AKS discovery from panicking if group claim is missing (#34609)
Looks like we were depending on the golang-jwt library to catch
this case rather than checking explicitly, and an update to the
library broke us.

Fixes #34514
2023-11-16 17:35:37 +00:00
Nic Klaassen c92fe24f7a fix: correct IAM policies for BYOB (#34484)
This commit fixes the IAM policies generated by the oneoff
externalcloudaudit bootstrap command based on manual testing, and brings
them more in line with the original RFD
https://github.com/gravitational/cloud/blob/master/rfd/0077-Bring-your-own-bucket.md
2023-11-14 17:38:10 +00:00
Reed Loden b72d4e1032 Disable AWS IMDSv1 fallback and enforce use of FIPS endpoints (#34170)
Two changes to AWS SDK usage:

Teleport should never use AWS IMDSv1 for requests, so disable the
ability to fallback to it, as it could be a malicious attempt to
downgrade security.

Teleport generally prefers FIPS endpoints when in FIPS mode, but
there were a few places that were not selecting the FIPS endpoints.
Ensure that the FIPS endpoints if BoringCrypto is being used.
2023-11-09 21:53:25 +00:00
rosstimothy d5a796c056 Enable testify lint (#34222)
Updates our golangci-lint configuration to enable testifylint and
fixes all issues found.

Bump e ref to include gravitational/teleport.e#2567
2023-11-06 20:38:38 +00:00
Lisa Kim 6fce85e299 Web: Ease AWS integration with Discover Flow (#33777)
* Delete aws oidc old flow

* Account for http prefixes for proxy addr and print role arn value

* Clean up aws related rules

* Add new script endpoint and clean up naming

* Create configure iam perm component

* Extract common error and use ConfigureIamPerm comp

* Extract finish dialog, shown after creating integration

* Refactor aws integration enroll screen

* Clarify aws oidc integration uses

* Fix iam config test

* Add ec2:DescribeSecurityGroups to StatementForListRDSDatabases

* Address CR

* Remove region selector

* Fix test
2023-11-02 16:53:16 +00:00
Tiago Silva b5696c059e Fix Azure Identity federated Application ID (#33953)
A recent change on Azure Side forces the server id to include the
`.default` suffix.

Fixes #33920

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2023-10-27 01:08:37 +00:00
Brian Joerger 2ed1538e40 Ignore shared aws config not found error (#33651)
* Ignore shared aws config not found error.

* Move error conversion to lib/cloud/aws/errors.go
2023-10-25 01:56:46 +00:00
Nic Klaassen 215f968842 feat: IAM permissions for BYOBucket (#33416)
This commit adds a one-off teleport command that configures the
necessary IAM permissions for the upcoming External Cloud Audit
(BYOBucket) feature.

An example command invocation looks like:
```
$ teleport integration configure externalcloudaudit-iam \
  --aws-region us-west-2 --role nic-byob-test --policy nic-byob \
  --session-recordings s3://nic-byob/sess-rec-v2 \
  --audit-events s3://nic-byob/events --athena-results s3://nic-byob/results \
  --athena-workgroup primary --glue-database nic_byob --glue-table nic_byob_table
```

In normal usage this command will be generated for the user so that they
can just copy a command from the Web UI and run it in AWS CloudShell.

The permissions generated here are based on
https://github.com/gravitational/cloud/blob/rfd/77-bring-your-own-bucket/rfd/0077-Bring-your-own-bucket.md,
but only include the permissions necessary for using the feature at
runtime and not any permissions necessary to bootstrap/create the
resources.
2023-10-17 19:42:41 +00:00
Bernard Kim 27fae1a28a Add support for deploy service agent auto updates (#31982)
* Add support for ecs agent auto updates

* fix unit test

* Remove unused var

* Addres feedback

* Use list of available AWS database regions

* Run update task on proxy instances

* Revert GenerateAWSOIDCToken

* Move const to start of file

* Address feedback

* Create separate DeployServiceUpdater struct

* Address feedback

- Perform updates in parallel
- Add additional logging
- Add additional documentation

* debug

* Address feedback

- Check OwnershipTags
- Use semaphore pkg
- Release semaphore lease on success

* Make OwnershipTags explicitly required

* Add cluster alert

* Fix typo and update message

* Revert cluster alert

* Update err messages

* Check minimum compatible server version

* Update log msg
2023-10-10 22:00:09 +00:00
Andrew Burke 5f8a8fa953 Fix bugs with GCP project ID + default installer (#31853)
This change fixes a few bugs with GCP auto-discovery:
- Fix project ID not propagating to the GCP client, causing
  failed API calls.
- Fix the default installer not recognizing when it was running
  on GCP.
- Fix newlines in instance metadata breaking `jq` in default installer.
- Fix zone parsing from instance metadata in default installer.
2023-09-21 00:27:17 +00:00
Marco André Dinis 4d9adbd75a AWS OIDC: command to configure IAM for listing databases (#31656)
* AWS OIDC: command to configure IAM for listing databases

Previously we were guiding users in a series of screens and copy/paste
so that the user could configure the AWS OIDC Integration.
This guide also included adding the first feature: enroll an RDS
Database.

We created a new command that sets up the OIDC IdP, but decoupled from
the enroll rds feature.

After updating the guide to use the new command and remove the guide, we
must provide a way for users to set up the required policy for Enrolling
RDS Databases.
This PR adds that command

* review pt1

* rename to ConfigureIAMListDatabasesRequest

* removed wrapper

* fix command description

* move aws client setup to common

* use logrus instead of log
2023-09-15 18:17:48 +00:00
Marco André Dinis 069cd24368 AWS OIDC: Set up integration with a single command (#31521)
* AWS OIDC: Set up integration with a single command

Creating an AWS OIDC Integration requires a lot of clicks, copy/paste,
navigation between tabs.

This PR adds a single teleport command that creates all the required
resources in AWS:
- AWS OIDC Identity Provider that uses Teleport as source
- AWS IAM Role that can be used by this Identity Provider

This role, will then have inline policies allowing multiple features in
Teleport.
Example: a policy must be added to this role that has
`rds:DescribeInstances` and `rds:DescribeClusters` so that the user can
use the integration to enroll RDS Databases.

* improve docs

* improve godoc
2023-09-13 07:21:00 +00:00
Marco André Dinis 630db38cff AWS OIDC - DeployService: add optional Security Groups (#30968)
When deploying a Teleport service using the AWS OIDC DeployService, we
can provide the SecurityGroups to be applied to the network
configuration of the service.

Using the default SG for the VPC (vpc is inferred from the used subnets)
might not always be the best one (it is usually locked down).

This PR adds an optional new field that clients can use to be explicit
about the SGs they want.

We also added a new permission when configuring the IAM Permissions for
the DeployService, to allow the usage of the ListSecurityGroups action.
Users can see the list of SG and then pick which ones they want.
2023-08-31 07:16:05 +00:00
Andrew Burke ebf69b6a6b Periodically refresh Azure cloud credentials (#31004)
This change lets Teleport periodically refresh Azure cloud credentials,
allowing Teleport to get updated credentials without a restart.
2023-08-28 23:59:01 +00:00
Marco André Dinis 33185f953a AWS OIDC: Configure IAM for EC2 Instance Connect Endpoint (#30851)
* AWS OIDC: Configure IAM for EC2 Instance Connect Endpoint

This PR adds a new teleport command that sets up the required
permissions to use EC2 Instance Connect Endpoint to connect to an EC2
instance.

It also adds a oneoff script that runs this command.
The goal is to give a user a script for them to run, the script then
downloads teleport and calls AWS APIs to create the inline policy.

* add const and lowercase error

* use correct client
2023-08-24 11:33:56 +00:00
STeve (Xin) Huang 116d88063c Database Service to validate URL of database resources from Discovery Service (#30054)
* url checker

* add ut

* add comment in test plan

* warnOnError only when err is not nil

* fix typos etc.

* enable metadata service permission for discovered databases

* add a debug log when azure db url is validated
2023-08-10 16:48:08 +00:00
STeve (Xin) Huang e2320d7950 Fix AccessDenied not recognized for MemoryDB/RSSL API calls (#30226) 2023-08-10 13:04:47 +00:00
Marco André Dinis e32248c312 EC2 Instance Connect Endpoint: List EC2 Instances (#29366)
* EC2 Instance Connect Endpoint: List EC2 Instances

We must list the EC2 instances to the user, so they can pick one and
then add them as a Node.

This PR adds EC2 Instance Listing.
To do this, we convert the EC2 Instance into Teleport Server with a
special subkind: SubKindOpenSSHEC2InstanceConnectEndpointNode

This is similar to the ListDatabases endpoint.

* review pt1

* fix const and add test

* use any instead of interface{}
2023-08-10 11:26:10 +00:00
STeve (Xin) Huang d9d12cc615 Refactor AWS db mocks (#30086)
* Refactor AWS db mocks

* removew lib/services dependency

* fix rds instance url, add elasticache reader endpoint
2023-08-08 12:07:34 +00:00
Gavin Frazar 5c1d8d665b differentiate discovered resource names (#28845)
* implement RFD 129 cloud resource renaming

* rename assumeRoler to stsClient

[skip ci]

* unit test makeDiscoverySuffix

[skip ci]

* rename validator funcs

[skip ci]

* subtype redis and RDS matchers for unique naming

* fix check for rds cluster vs instance
2023-07-31 17:49:43 +00:00