Commit Graph
347 Commits
Author SHA1 Message Date
Forrest 2bc7f8cbbd port core CA ops to use revisions/atomics (#39845)
* port core CA ops to use revisions/atomics

* allow atomicwrite in mirror mode
2024-04-10 21:15:09 +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
rosstimothy 1aec5414f1 Replace constants from trace with equivalents defined in teleport (#39307)
* Remove logging from circuit breaker

The logging is never output, and if it was would be very verbose.
Instead of dropping the level down to trace the logger is removed
entirely.

* Add constants from trace library

The logging functionality in trace is being removed in an upcoming
release. To prepare the logging component keys are copied from trace
into teleport.

* Convert trace.ComponentFields to teleport.ComponentFields

* Replace trace.Component with teleport.ComponentKey

* Replace trace logging constants
2024-03-14 13:04:29 +00:00
Marek Smoliński 8be29eecb0 Fix DynamoDB BatchWriteItemInput items limit (#38743) 2024-02-28 21:39:01 +00:00
Forrestandrosstimothy 754b94a48f add atomicwrite to backend interface (#38163)
* add atomicwrite to backend interface

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* fix lint

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-02-16 21:40:14 +00:00
Forrest 12f6baa530 fix iterate range (#36363) 2024-02-07 19:57:37 +00:00
Forrest a2dc868543 memory backend atomic write impl (#37499) 2024-02-07 19:57:29 +00:00
Forrest bdafcd35e5 sqlite atomic write impl (#37500) 2024-02-07 19:57:19 +00:00
Forrest ee2e72bf22 postgres atomic write impl (#37599)
* postgres atomic write impl

* precalculate batch items & fix nits
2024-02-07 19:57:06 +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
David BosleeandEdoardo Spadolini 30fd53c05c backend: add option to extend test suite ttl delete timeout (#36362)
* backend: add synchronous ttl deletion to test suite

* fix typo

* Revert "backend: add synchronous ttl deletion to test suite"

This reverts commit be8469e121.

* move ttl delete timeout to testEvents func

* parse time duration and add comment

* log timeout override

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2024-01-29 23:06:13 +00:00
Forrest d91e2693a4 firestore atomic write impl (#37144) 2024-01-26 21:57:27 +00:00
Forrest b2ad882275 dynamodb atomic write impl (#36530) 2024-01-24 05:01:01 +00:00
Forrest df5b106feb atomic write api & etcd implementation (#36086)
* atomic write api & suite

* etcd atomic write impl
2024-01-23 16:32:05 +00:00
Reed Loden 47630371b2 Remove TODOs related to use of FIPS endpoints with DynamoDB (#36160)
Decided to keep the current code as-is, so removing the TODOs
2024-01-16 22:23:28 +00:00
Forrest 03039b89f9 switch to uuid-like revisions for firestore (#36587)
* fix firestore ttl

* revision v2
2024-01-12 22:47:16 +00:00
Michael Wilson 78569f9e5c Sanitize backend keys with .. in them. (#36303)
* Sanitize backend keys with .. in them.

Backend keys with .. in them have been added to the regex for patterns in
keys that are denied.

* Deny ., .., use regexes.
2024-01-08 14:11:38 +00:00
rosstimothy 39268f0e64 Convert the generic backend service to work with all resource types (#36006)
Modifies the type constraint on the generic backend service so
that it can be used with legacy and new resource variants. A few
additional helper methods were added to types to pull resource
information from the correct location depending on the resource
type.
2024-01-04 19:08:31 +00:00
9da4d6bec0 backend: support enterprise backends (#35973)
* wip

* Move to globally registered backends

* remove zeronull

* revert changes to pgbk Get/GetRange

* update panic message

* bring back reporter

* Revert pgbk changes, move to another pr

* Move backend registration

* Fix backend error

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>

* move backend registry store

* fix typo

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Simplify backend registry removing generics

* add rwmutex for registry

* revert backend test suite

* fix comment typo

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

---------

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-01-04 17:37:22 +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
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
Reed Loden 6cd68f0be6 Don't force the use of FIPS endpoints for DynamoDB Streams and Application Auto Scaling (#34876)
DynamoDB Streams and Application Auto Scaling do not currently have FIPS endpoints in
non-GovCloud, leading to invalid endpoints for FIPS users running in AWS Standard.

See also: https://aws.amazon.com/compliance/fips/#FIPS_Endpoints_by_Service

Regression from #34170.

Fixes #34804.

Additionally, clean-up a few more AWS session initiations to be consistent and clear.
2023-11-29 21:18:04 +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
Zac Bergquist 9911bae334 Use maps.{Clone,Copy} instead of manual loops (#34318) 2023-11-08 14:41:31 +00:00
rosstimothy 7767bf5e0f Allow resources to be migrated to optimistic locking with dynamo backend (#34272)
After upgrading Auth to include support for revisions when using
dynamo as the backend, updates to any pre-existing resources would
result in an error. The conditional expression provided to the
dynamo query would always fail because the item did not yet
contain a Revision attribute. We can achieve the same conditional
update by altering the conditional expression to assert that the
revision attribute does not exist if the item being updated does
not contain a revision.
2023-11-07 15:37:13 +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
Forrest 54a05b2ca4 event fanout rework (#32978) 2023-10-23 18:59:12 +00:00
rosstimothy 4f569a4a63 Prevent blank revisions from being read from the backend (#32871)
* Prevent blank revisions from being read from the backend

Overwrites any empty resource revisions with a placeholder value to
prevent any blank revisions from being provided to users.

* Prevent backend items with empty revisions

All resource revisions are now being set on a backend.Item before
persisting the item to the backend.
2023-10-10 16:56:34 +00:00
Michael WilsonandEdoardo Spadolini e93d165ed1 Redundant event prefix check before event watcher is created. (#32748)
* Revert "Error when redundant prefixes are detected in events. (#32652)"

This reverts commit 84dbc45e1d.

* Error when redundant prefixes are detected in events.

When creating a new events watcher, redundant prefixes will be detected
and produce an error. This should prevent developer mistakes where watched
prefixes overlap, causing subsets of events not to be parsed. This has been
verified manually.

* Fix buffer_test.go

* Update lib/services/local/events.go

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2023-09-29 01:22:08 +00:00
Forrest e3b574a797 allow teleport to start when some etcd nodes are unreachable (#32438) 2023-09-28 22:34:44 +00:00
Michael Wilson 84dbc45e1d Error when redundant prefixes are detected in events. (#32652)
* Error when redundant prefixes are detected in events.

When creaeting a new events watcher, redundant prefixes will be detected
and produce an error. This should prevent developer mistakes where watched
prefixes overlap, causing subsets of events not to be parsed. This has been
verified manually.

* Add in test for event watcher verification.

* Run GCI.
2023-09-27 20:05:04 +00:00
Edoardo Spadolini 650e31acb2 pgbk: remove CREATE PUBLICATION (#32464) 2023-09-25 12:17:17 +00:00
rosstimothy 4335536b22 Add optimistic locking to backend.Backend (#32409)
Updates the reporting and sanitzer backends to implement the
conditional backend interface. With these two now supporting
optimistic locking the `conditionalBackend` interface used by the
backend test suite can now be promoted into `backend.Backend`.

Contributes to #30416.
2023-09-22 18:21:55 +00:00
rosstimothy 04b775d705 Add optimistic locking support to sqlite backend (#31984)
A new revision column is added to the kv table to accomodate
storing the resource revision. A schema migration for the table
was added to ensure any existing databases have the table added.
Additionaly the meta table and its associated import functionality
was removed since it was unused. Various other small clean up
operations were also done to eliminate warnings and remove unused
functionality.

Contributes to #30416.
2023-09-22 17:01:55 +00:00
rosstimothy d83410491d Add optimistic locking support to etcd backend (#31987)
Contributes to #30416.
2023-09-22 16:55:57 +00:00
rosstimothy 206e8327f2 Add optimistic locking support to dynamo backend (#31989)
The dynamo test was also updated to allow the table name to be
overridden via an environment variable.

Contributes to #30416.
2023-09-22 16:46:58 +00:00
rosstimothy fdc4d7143e Add optimistic locking support to firestore backend (#31991)
Contributes to #30416.
2023-09-21 20:56:34 +00:00
Steven MartinandZac Bergquist 2778be9e11 Provide error message if process file is unavailable due to permissions for teleport start (#24924)
* Provide error message if process file is unavailable due to permissions

* update verbiage

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>

---------

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2023-09-21 20:06:24 +00:00
Edoardo Spadolini 97a8526168 pgbk: specify the schema name in wal2json's add-tables (#32197)
* Ignore schema and table from wal2json

* Qualify add-tables with the correct schema
2023-09-20 18:17:54 +00:00
Edoardo Spadolini a79d70459f pgbk: conditional operations and revisions (#32043)
* pgbk: conditional operations and revisions

* Fix tests

* Fix ConditionalUpdate error return
2023-09-20 00:19:49 +00:00
rosstimothy 1c38e1db31 Add optimistic locking support to the memory backend (#31886)
Implements ConditionalUpdate and ConditionalDelete for the
memory backend and extends existing backend methods to take
the revision into account. The backend test suite has also been
updated to run optimisitic locking tests on any backends that
support it.

Contributes to #30416
2023-09-15 18:55:43 +00:00
rosstimothy 4aa7470a74 Remove unused backend.Batch interface (#31941)
Only two backends implemented the interface and it was only being
used by tests.
2023-09-15 13:34:26 +00:00
Edoardo Spadolini 83d4007cc1 pgbk: add change_feed_conn_string option (#31918)
* pgbk: add change_feed_conn_string option

* Add timeout on pg_create_logical_replication_slot
2023-09-15 11:36:53 +00:00
rosstimothy 36c6156fe5 Increase lock release timeout in RunWhileLocked (#31729)
The default release timeout is now a minute to allow slow/distant
connections to the backend to complete releasing the lock.

Closes #31690
2023-09-11 22:52:24 +00:00
Edoardo Spadolini be73e7a623 pgbk: derive ID from revision (#31657)
* pgbk: derive ID from revision

* fix TestMessage
2023-09-11 08:19:13 +00:00
Edoardo Spadolini 005dcb16ba pgbk: parse wal2json messages on the client side (#31426)
* Parse wal2json messages on the auth side

* Don't send NULL bytea in queries

* Add wal2json parsing test
2023-09-05 19:28:15 +00:00
Edoardo Spadolini 3d0f70c21a pgbk: schema version 2, more robust change feed parsing (#31358)
* Use pgx.Identifier whenever possible

* always qualify column names

* pgbk schema 2, more robust change feed

* Convert events' expiry to UTC for consistency

* Add comments on COALESCE and how we parse the data
2023-09-04 13:21:08 +00:00
Brian Joerger cf6473feb9 Add gRPC error interceptors to API client (#30578)
* Move gRPC error intercetpors to api/utils/grpc/interceptors.

* Use error interceptors in api client and mock server.

* Apply suggestions from CR.

* Unwrap FromGRPC errors in middleware.

* Use gRPC auth service in tests instead of external example service.

* It's gRPC!!!

* Fix unit test.

* Add error interceptor to proxy client.

* Fix merge conflict.
2023-08-24 23:27:06 +00:00
Zac Bergquist 380c284e56 Fix flaky TestResizeTerminal (#30970)
This test starts a session and then immediately tries to join it.
Sometimes we're too fast, and the session tracker doesn't yet exist
so the join fails.

Fix by waiting for the session tracker to show up before attempting
the join.

Closes #13607
2023-08-24 16:56:49 +00:00
Alan Parra 36442777cb Update the etcd_test.go comment (#30709) 2023-08-21 19:11:56 +00:00