Commit Graph
2288 Commits
Author SHA1 Message Date
Yassine Bounekhla f2c8833cea implement listing notifications for a user with matching (#39942) 2024-05-15 19:26:58 +00:00
rosstimothy 2df9aeafd0 Convert App heartbeats to use the inventory control stream (#41164)
Updates app server heartbeats to use srv.Heartbeatv2 in order to
leverage the inventory control stream instead of the legacy mechanism.
The new srv.heartbeatV2Driver implementation for app servers detects
the version of Auth and falls back appropriately if the Auth server
is too old to know about the new field added to the InventoryHeartbeat
message. The connected_resources metric should be accurate if the
auth and app service are on the same version or if the auth service
is on a more recent version. If the app service is newer than auth
and the new app server driver kicks into fall back mode then the
connected resource metric will not be updated.

Partially addresses #40917
2024-05-15 17:59:30 +00:00
rosstimothy e95f3d3ed5 Start using authclient.Client/ClientI/NewClient (#41539)
Consumes the new auth client created in #41460. The changes introduced
were performed with a series of gofmt rewrite rules.

```bash
$ find ./lib/auth -type f -name '*.go' -exec gofmt -w -l -r "ClientI -> authclient.ClientI" {} \;
$ find ./lib/auth -type f -name '*.go' -exec gofmt -w -l -r "Client -> authclient.Client" {} \;
$ find ./lib/auth -type f -name '*.go' -exec gofmt -w -l -r "NewClient -> authclient.NewClientI" {} \;
$ find . -type f -name '*.go' -exec gofmt -w -l -r "auth.ClientI -> authclient.ClientI" {} \;
$ find . -type f -name '*.go' -exec gofmt -w -l -r "auth.Client -> authclient.Client" {} \;
$ find . -type f -name '*.go' -exec gofmt -w -l -r "auth.NewClient -> authclient.NewClient" {} \;
```
2024-05-15 14:09:14 +00:00
rosstimothy 67f499a457 Refactor auth client code into lib/auth/authclient (#41460)
This starts separating the lib/auth client and server code into
distinct packages to reduce the dependency tree of client tools.
For the time being aliases were left to all things moved into
lib/auth/authclient to reduce the changeset and ensure code still
compiles. Future changes will be built off this to convert code
to use lib/auth/authclient where applicable, this was intentionally
left to a minimum amount of changes to facilitate backports.
2024-05-14 13:28:06 +00:00
rosstimothy d573e460f7 Cleanup code relegated for deletion in v16 (#41462)
Deletes the client fallback logic for users and auth connectors.
The server side cleanup was punted to v17 to prevent any v14 clients
from being unable to interact with a v16 control plane when trying
to interact with users and auth connectors.
2024-05-13 16:02:28 +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
rosstimothy ffa3dba509 Reject unsupported clients by default (#41239)
#38026 made rejecting client running unusupported major versions an
opt-in behavior. Moving forward(v16 and beyond) this is now going
to be an opt-out behavior(TELEPORT_UNSTABLE_ALLOW_OLD_CLIENTS=yes).
In addition, a cluster alert is now being emitted once for the life
of an Auth process if it rejects an unsupported client - with
visibility limited to users with token:create permissions.
2024-05-13 13:09:14 +00:00
Alan Parra 41b60a0848 fix: Emit login failure event in the /mfa/login/begin step (#41419)
* Test failed user/pass audit on CreateAuthenticateChallenge

* Emit login failure event in the /mfa/login/begin step

* nit: Remove final stop from logging statements

* nit: Remove seemingly outdated comment
2024-05-10 21:39:01 +00:00
Alex McGrath 65459e872e Remove support for disabling second factor authentication (#40956)
* dont allow disabling second factor

* update docs for 2fa change

* add environmental variable to work around disabled 2fa

* check if its cloud

* update todos

* add a test

* introduce insecure test mode

* fixes for tests
2024-05-10 11:57:34 +00:00
Gavin Frazar 9723fd096f cleanup after db ca split (#41351)
* remove database client CA event filter injection

* remove tctl database client CA fetch fallback

* remove sqlserver database client CA fetch fallback

* remove database client CA migration

* cleanup tests and mocks
2024-05-09 19:51:27 +00:00
Zac Bergquist 19a89bc6cd Remove role downgrade logic for insecure drop mode (#41371)
This logic was necessary in Teleport 15 and earlier, because some v14
(and earlier) clients did not support the insecure-drop mode.

Teleport 16 no longer needs to downgrade roles, as the minimum supported
client version is 15, and all v15 versions support insecure-drop.
2024-05-09 19:00:15 +00:00
Edoardo Spadolini 384654a2e0 Use proquints for recovery codes (#41379) 2024-05-09 18:02:32 +00:00
Zac Bergquist 708dac8e0d Remove unnecessary version checks (#41343)
The OpenSSH CA is supported in all supported versions of Teleport,
so we no longer need these checks that were added for backwards
compatibility.
2024-05-09 00:07:06 +00:00
Grzegorz Zdunek 117fa0fe52 Prevent deprecation of AppServerOrSAMLIdPServiceProvider from being a breaking change (#41047)
* Prevent deprecation of `AppServerOrSAMLIdPServiceProvider` from being a breaking change

* Improve version check
2024-05-08 15:42:24 +00:00
Alan Parra 5671fbfaa2 Reduce recovery codes bcrypt cost when testing (#41279) 2024-05-07 18:28:11 +00:00
Jakub NyckowskiandTiago Silva bc53a8235c Add Crown Jewel resource (#40914)
* Update labels datatype in Teleport crownjewel proto

This commit modifies the labels from a map to repeated TeleportLabel in CrownJewel proto, and accordingly updates the getter function in proto generated code. The newly introduced TeleportLabel type contains a Key and repeated values for improved flexibility.

Clean up

Update and restructure CrownJewel service proto

The code modifications include renaming and restructuring several types and altering various functions in the CrownJewel service proto. Major changes involve renaming DeleteCrownJewel

Rename 'kind' to 'kinds' in crownjewel API

This commit changes the 'kind' field to 'kinds' in the crownjewel API to better reflect its purpose of holding multiple resource types. Changes are made across several files - 'crownjewel.go', 'crownjewel.pb.go' and 'crownjewel.proto'.

After rebase fixes

Remove CrownJewel type from several files

This commit represents the removal of the CrownJewel type from several files. CrownJewel type references are deleted in certain Go files, and imports of CrownJewel in multiple files are being adjusted. The specifics of why this type is removed is not evident from the diffs, but the deletions will affect the related functionalities.

Add CrownJewel update functionality

This update enables the 'UpdateCrownJewel' functionality. If a 'CrownJewel' resource already exists, it can now be updated instead of returning an error. This enhances flexibility when dealing with resource management. It also introduces the ARN field into the 'AWSMatcher' service.

Update CrownJewel service with pagination and improve matchers

This update adds pagination to the CrownJewel service for more efficient data handling. It also improves the matching capabilities with the inclusion of Teleport and AWS matchers and allows for selective querying with these matchers. Additionally, it includes various changes to structure and naming for better clarity and ease of use.

Refactor CrownJewel protos to use ResourceHeader

This refactoring replaces the previous structure of CrownJewel proto's fields Kind, Sub_kind, Version, and Metadata with a single object called Header (ResourceHeader). It simplifies the code structure and harmonizes it with other protos. Now, Header contains the essential attributes that were previously distributed across multiple separate fields.

Add GetCrownJewels method to cache and accessgraph

The function GetCrownJewels has been added to the cache and the accessgraph. It retrieves all CrownJewel instances from the cache. Additionally, CrownJewel retrieval functionality has been removed from auth server and existing usages have been refactored.

Implement Crown Jewel creation feature

Updated the method `createCrownJewel` in the resources command to handle Crown Jewel creation. Introduced a new gRPC service `crownjewelv1` to handle client-server interactions for Crown Jewel objects. Crown Jewel expiry configuration has now also been enabled.

Add missing files

I have no words...

Update authentication and event handling

Refactored the argument from 'auth.ClientI' to '*auth.Client' in 'createCrownJewel' function in 'resource_command.go'. Removed unused import 'durationpb' in 'auth_with_roles.go'. Added a new event code 'AccessGraphAccessPathChangedCode' in 'codes.go' and 'AccessGraphAccessPathChanged' in 'api.go' for better monitoring and logging of access path changes.

Add access path changed event and relevant changes.

 update api

add grpc

update api

add cache support

add protos

* Fixes after rebase

* Refactor Crown Jewel resource methods

Updated API methods related to the Crown Jewel resource to improve clarity and consistency. Renamed `GetCrownJewels` to `ListCrownJewels`, added pagination parameters, and ensured uniform handling of the Crown Jewel resource across different parts of the codebase. Updated relevant comments for better code understanding.

* Removed CrownJewel converter, updated CrownJewel references

This commit removes the CrownJewel converter and updates references from the old CrownJewel type to the new protobuf-defined CrownJewel type, streamlining the codebase. The commit also disables CrownJewel deletion since it is not supported yet. Some minor errors were fixed regarding CrownJewel resource names.

* Implement Crown Jewel deletion functionality

The crown jewel deletion feature has been enabled by uncommenting and simplifying the code block. Now, the delete action is directly performed on the specific 'crown jewel' mentioned based on its name. The previously unsupported action returns an informative success message after the deletion.

* Refactored function 'allCombinations' and added authorization checks

Moved 'allCombinations' function into 'utils' package, renamed it to 'Combinations', and updated its references in 'dbobjectimportrulev1' and 'dbobjectv1' tests. Additionally, introduced admin authorization checks to 'CreateCrownJewels', 'UpdateCrownJewels', and 'DeleteCrownJewels'. Created corresponding tests for these changes.

* Add CrownJewel service to cache tests

The CrownJewel service has been added to the cache test file. The service creation is implemented and assigned to new fields in multiple methods within the cache tests. A new test function `TestCrownJewel` has also been added to validate CRUD operations for the service.

* Add access path changed event and update Crown Jewel tests

Added a new event code for when an access path changes in the access graph, and introduced new API calls to handle these situations. Also, updated crown jewel related tests and fixed copyright year in several files.

* Update protobuf import path

The protobuf import path was updated from "github.com/golang/protobuf/proto" to "google.golang.org/protobuf/proto" to ensure correct use and to prevent potential issues, while maintaining functionality in crown_jewels.go.

* Refactor CrownJewel and AccessGraph services

This commit optimizes the ListCrownJewelsResponse in the CrownJewel service by directly assigning the response instead of using an extra loop. Additionally, the EventsStream in the AccessGraph service and related tests have been updated to EventsStreamV2, reflecting the implementation of new versions of these methods.

* Add CrownJewel resource in access controls and tests

In both the cache test and access control files, CrownJewel resource has been included. This provides the system's ability to manage and test CrownJewel resources. Additionally, it allows the handling of CrownJewel resources in client events.

* Simplify implementation

* Update copyright dates and add license headers

Updated the copyright dates in several files to reflect the new year. Additionally, license headers have been added to some files where they were previously missing, ensuring the proper copyrights and GPL notice are visible.

* Refactor CrownJewel codebase for better readability

Fixed various typographical errors in CrownJewel's related functions and removed a TODO comment. Improved function and function calls' names that were incorrectly referring to different modules, making the code easier to read and understand across different CrownJewel services.

* Add validation for Teleport and AWS matchers in service

The validation has been added for Teleport and AWS matchers in the service layer to ensure that essential details are not missed when setting matchers. This includes checks to ensure that kinds and labels for Teleport, and types and tags for AWS matchers are properly set.

* gci

* Add CrownJewel update functionality and refactor related services

This commit adds the ability to update a CrownJewel resource within the ResourceCommand. It also includes refactoring of related services, condensed code logic, and improved utilization of existing methods for marshaling/unmarshaling CrownJewel. Specific changes in service.go and crown_jewels.go files have reduced code redundancy and enhanced the code structure.

* Relocate and update crown_jewels_test file

This commit moves the crown_jewels_test from the local to the services library and adds test cases for unmarshalling Crown Jewels data. Also, import statements for labelv1 and utils were introduced to support these changes.

* Update crown jewels test with AWS matchers

Revised the crown jewels test file by including AWS matchers section in the CrownJewel object. The change ensures to specifically match AWS infrastructure following certain parameters, thus enhancing the specificity and flexibility of our matchers. Apart from this, minor reordering of objects has also been done for better code organization.

* Added upsertCrownJewel function and related proto message

The commit adds the UpsertCrownJewel function in the service.go file, which enables upsert operations on crown jewel resources. Alongside, the UpsertCrownJewelRequest proto message is added to the crownjewel_service.pb.go file to handle such requests.

* Refactor CrownJewelsClient to use upsert

This change refactors the CrownJewelsClient to use the upsert method when the force flag is on. The code has been streamlined by eliminating the need for 'already exist' error checking and separate create and update methods.

* Add GetCrownJewel functionality and refactor validation

A GetCrownJewel function has been added to the Service, which retrieves a specific CrownJewel resource. Also, the CrownJewel validation process has been refactored, moving the validateCrownJewel function from service.go into the crownjewel library and renaming it to ValidateCrownJewel. These changes improve modularity and code organization.

* Add VerbCreate check and test for CrownJewel validation

The checkAccessToKind function now also checks for the VerbCreate permission. Additionally, a new test file, object_test.go, was added to validate the functionality of the CrownJewel object. This includes various validation checks such as "NilCrownJewel", "ValidCrownJewel", "MissingMatchers", among others.

* Refactor CrownJewel resource handling and validation

The codebase was updated to improve CrownJewel resources handling. This includes modifications to list, get, create, update, upsert, and delete functions in several files. Additionally, a validation function has been implemented for CrownJewel objects, ensuring required fields are present. Depreciated logger service has also been removed.

* Add cache implementation to CrownJewel service

The CrownJewel service has been enhanced by integrating it with cache. The main changes include adding "Cache" as part of ServiceConfig and using cache to fetch crown jewels instead of directly using the backend services. The cache interface with the methods "ListCrownJewels" and "GetCrownJewel" has been added to handle these operations.

* Add Cache to service configuration in crownjewelv1 tests

In this commit, we added the Cache field to the service configuration used in the tests for the crownjewelv1 service. This ensures that the service configuration used in the tests matches the expected real-world configuration.

* Update CrownJewelsService to use ConditionalUpdateResource

This commit changes the CrownJewelsService's `UpdateCrownJewel` method to use the `ConditionalUpdateResource` method instead of the `UpdateResource` method. This change will provide a more appropriate update strategy for the specific needs of the CrownJewelsService.

* Replace 'Cache' with 'Reader' in crownjewel service & remove DeleteAllCrownJewelsRequest

The 'Cache' in crownjewel service has been replaced with 'Reader' to improve code readability and to match with its functionality. Also, the DeleteAllCrownJewelsRequest functionality was removed as it posed a high risk potential for data loss and it wasn

* Update tests for Crown Jewel service

This commit updates the test suite of the Crown Jewel service. An object is fetched from the backend before updating its expiry time, ensuring the revision is populated. In addition, a new test is introduced to handle the scenario where the revision is missing when updating a Crown Jewel.

* Refactor protobuf marshaling with utils

This commit replaces the usage of the `protojson` method for marshaling and unmarshaling protobuf objects in `crown_jewel.go` with the `FastMarshal` and `FastUnmarshal` methods from `utils`.
protojson is failing to unmarshal resources.

* Update CrownJewel test and serialization methods

Updated the test condition in crown_jewels_test.go to use Proto.Equal for object comparisons. Also, swapped out the FastMarshal and FastUnmarshal methods with protojson's Marshal and Unmarshal in the CrownJewels service.

* Add missing license

---------

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
2024-05-07 15:48:24 +00:00
Alan Parra 89baab7429 Hide a couple of sensitive auth.Server methods (#41242)
* Make Server.AuthenticateUser private

* Make Server.ResetPassword private
2024-05-07 14:24:35 +00:00
Alan Parra bdca7b957c fix: Forbid SSO users from local logins or password changes (#41196)
* Test that an SSO user cannot use local logins

* Lock down local logins

* Lock down CreateResetPasswordToken

* Lock down account recovery

* Tweak a few existing tests

* Document new RPC limitations

* Update generated protos
2024-05-07 14:02:59 +00:00
Bartosz Leper 5532b885d6 Mark users that have passwords as soon as they sign in (#40911)
* Mark users that have passwords as soon as they sign in

* Review

* Review

* Review
2024-05-07 13:16:16 +00:00
Nic KlaassenandAlex McGrath e044795b05 Dont allow cloud tenants to update certain cluster networking config fields (#41197)
* Dont allow cloud tenants to update certain cluster networking config fields

I'm bringing #28634 back from the dead, looks like it got nuked from
orbit in a bad merge conflict resolution in #27873

Dont allow cloud tenants to update certain cluster networking fields

* share validate impl

* add godoc comment

---------

Co-authored-by: Alex McGrath <alex.mcgrath@goteleport.com>
2024-05-07 00:02:07 +00:00
Brian Joerger 8c328a880b MFA for App Access - tsh proxy app and Teleport Connect (#40857)
* Add key.DBTLSCert and key.AppTLSCert helper methods.

* Add TSH_APP_LOCAL_PROXY user certs requester option.

* Break up app login into multiple methods.

* Generalize cert checker local proxy middleware and add an app cert implementation.

* Use AppCertChecker for tsh proxy app.

* Add test check for proxy mfa certs being kept off disk.

* Apply changes to Teleport Connect.

* Addressed bl-nero's comments.

* Address comments from ravicious.

* Add proxy app cert ttl test.

* Restore v15 fallback for tsh proxy app session creation; Minor naming refactors.

* Add cluster flag to app logout.

* Refactor teleterm test to cleanup session MFA requirement.

* Address comments.
2024-05-06 19:29:53 +00:00
Marco Dinis 0d515ec020 Use slog in lib/integration/awsoidc package (#41210)
* Use slog in `lib/integration/awsoidc` package

* fix type field
2024-05-06 15:44:42 +00:00
Brian Joerger 27af30be04 Fix IsMFARequired for app access (#41124)
* Use app servers to check MFA requirement.

* Address comments.

* Add test.
2024-05-02 23:40:20 +00:00
Brian Joerger ac4870cacd MFA for App Access - tsh app login (#40846)
* Generate MFA verified certs with tsh app login.

* Add TestAppCommands with per-session MFA tests.

* Add --cluster flag to tsh proxy app; Add tsh proxy app tests with per session MFA subtests.

* Clean up test cases.

* Fix unit tests.

* Disable session recording and use shorter poll_stream_period by default for tests.

* Resolve comments; Fix tsh app config --cluster=leaf.

* Resolve comment.

* Fix TestFormatAppConfig.
2024-05-02 20:20:44 +00:00
Andrew LeFevre cdb227b59c add the new/changed SAML connector to create and update audit events (#40062) 2024-05-02 17:51:05 +00:00
Forrest 2684949d8c fix racy use of tls configs (#41114) 2024-05-01 19:38:16 +00:00
Andrew LeFevre 06b15b28fb add lock target to lock deletion audit events (#40057) 2024-04-30 22:56:49 +00:00
Alan Parra 72780dce68 fix: Forbid SSO users from logging in using passwordless (#41062)
* Save the WebAuthn UserHandle in the mock Key

* Simplify passwordless tests

* fix: Forbid SSO users from logging in using passwordless

* Rename tests to TestPasswordlessProhibitedForSSO
2024-04-30 19:07:57 +00:00
Alan Parra 15354e196e fix: Enforce allow_passwordless server-side (#41023) 2024-04-30 14:39:19 +00:00
ForrestandTrent Clarke c6408c8ea3 tls handshake perf improvements (#40626)
* improve tls handshakes

* Update client_tls_config_generator.go

Co-authored-by: Trent Clarke <trent@goteleport.com>

---------

Co-authored-by: Trent Clarke <trent@goteleport.com>
2024-04-30 05:37:11 +00:00
Michael d129b1d3c7 Include requiresRequest flag for searchAsRoles requests (#40328) 2024-04-29 17:21:43 +00:00
Brian Joerger ce242ae40d Support agentless connections with hardware key support (#39267) 2024-04-25 22:45:00 +00:00
Bernard Kim b40e1a28eb Add automatic_updates label (#40563) 2024-04-25 18:43:50 +00:00
Brian Joerger 12c7689df5 Refactor GenerateUserCerts to create App Sessions (#39970)
* Add CreateAppSessionFromReq.

* Deprecate passing route_to_app.session_id in cert requests.

* Automatically create app sessions for app cert requests.

* Deprecate client use of CreateAppSession for app cert requests.

* Fix affected tests.

* Use traits and roles from existing user certificate for app sessions.

* Fix app access integration tests.

* go mod tidy.

* Fix TestTCP.

* Fix TestALPNSNIProxyAppAccess.

* Revert "go mod tidy."

This reverts commit cc6caa2485.
2024-04-25 05:13:55 +00:00
Alan Parra 80140bebbd Issue cert.create events during device authentication (#40848)
* Add DeviceExtensions to the events.Identity proto

* Update generated protos

* Issue cert.create events during device authentication
2024-04-24 14:19:21 +00:00
Zac Bergquist 8cd1c429f5 Fix up some poor wording (#40832)
Closes #40294
Closes #39172
2024-04-23 22:01:41 +00:00
Nic Klaassen ef0f92d010 fix: prevent deleting AWS OIDC integration used by EAS (#40630)
* fix: prevent deleting AWS OIDC integration used by EAS

The External Audit Storage feature for Teleport Cloud depends on an AWS
OIDC integration to exist in order to get credentials for the customer
AWS account.
It's currently possible for a customer to delete the AWS OIDC
integration referenced by the EAS configuration, leading to the EAS
integration breaking and the Auth service crashing the next time it's
started up.

This commit prevents deleting an AWS OIDC integration currently
referenced by and EAS integration, and prevents creating an EAS
integration referencing an unknown AWS OIDC integration.

* use PreDeleteCheck instead of calling EAS service

* reorder tests and add missing cleanup

* create integrations svc on the fly

* switch to AtomicWrite

* set revision of returned resources

* deprecate gRPC DeleteAllIntegrations and use more general cacheMode
2024-04-23 21:22:16 +00:00
Noah StrideandAlan Parra d56ed2c5f8 Add server-side tpm joining implementation (#40512)
* Add clientside elements of TPM joining

* Update lib/auth/register.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update api/client/joinservice.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/auth/register.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Tidy up RegisterUsingTPMMethod method

* Add default case

* Rename CheckAndSetDefaults to validate

* Add basic success test for JoinServiceClient_RegisterUsingTPMMethod

* Add final touches to client joinservice test

* Add license header to joinservice_test.go

* Add server-side elements of TPM joining

* Turn SAN extension code into helper func

* Add `ok` check to provision token casting

* Improve test name

* Update lib/auth/join_tpm.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/auth/join_tpm.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Unexported registerUsingTPMMethod

* Refactor enterprise error

* tidy up test

* Update lib/tpm/validate.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/auth/join_tpm.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/auth/join_tpm_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Fix StripSANExtensionOIDs and add test

* Improve joinserver.go, use simpler proto getter methods and use slog

* Tidy up join_tpm_test.go

* Tidy up joinserver_test

* Add join failure audit event

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2024-04-23 12:29:47 +00:00
Noah StrideandAlan Parra 038bff1d64 Add clientside elements of TPM joining (#40647)
* Add clientside elements of TPM joining

* Update lib/auth/register.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update api/client/joinservice.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update lib/auth/register.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Tidy up RegisterUsingTPMMethod method

* Add default case

* Rename CheckAndSetDefaults to validate

* Add basic success test for JoinServiceClient_RegisterUsingTPMMethod

* Add final touches to client joinservice test

* Add license header to joinservice_test.go

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2024-04-23 11:19:15 +00:00
Tiago Silva 4c337d1a7f Add AccessGraphPlugin system role (#40714)
This PR introduces the `AccessGraphPlugin` system role used by Access
Graph plugins to access the Auth server API and Access Graph api.

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

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-04-23 09:43:45 +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
Noah Stride cea1425a13 Emit an Audit log event when a Bot or Instance fails to join (#40329)
* Emit audit event on instance/bot join failure

* Add audit log on failure to azure and iam join methods

* Tidy up a lil bit

* Add missing icon to EventTypeCell.tsx

* Regenerate snapshot

* Correct status code

* Add host_id and node_name to the join audit log

* Remove "unknown" default values
2024-04-23 08:23:53 +00:00
Brian Joerger 19f85b1343 Don't let users watch Web Sessions with secrets (#39588)
* Don't watch web sessions with secrets by default; Deny users from watching web session secrets.

* Add backwards compatibility logic for old proxies

Fallback to web session permissions for users watching with secrets

Fix uncaught merge conflict

* CopyWithoutSecrets without proto.Clone to avoid gogoproto issue.

* Revert WebSession.CopyWithoutSecrets rename and instead add special case in fanoutv2.go since WebSessions can not implement ResourceWithSecrets without affecting upstream consumers negatively.

* Address slice iteration comment.
2024-04-22 22:45:05 +00:00
Marco André Dinis db726c0025 Allow dynamic AWS Session provider (#40553)
* Allow dynamic AWS Session provider

Up until now, all the AWS Sessions were generated using the ambient
credentials.

This PRs changes this and allows for custom AWS Session Providers.
This will allow the Session to be created from an Integration.

Another PR will be created where this is used to allow AWS OIDC to be
used as an AWS Session Provider.

* typo
2024-04-22 09:36:02 +00:00
Edoardo Spadolini 52bc80b0c8 Connector circuit breaker metrics (#40729)
* Fix time.After in joinserver

* Log failed cluster joins

* Instrument teleport instance connector breakers

* Address comments, fix nil panic
2024-04-22 09:11:58 +00:00
Anton Miniailo 487721e83c Remove header manipulation after request has been completed. (#40718)
It could lead to panic (concurrent map write and read) in case of
request cancelation.
2024-04-19 17:27:33 +00:00
Noah Stride 0bd99702a1 Switch existing error reporting for tracing to use new helper (#40662)
* Switch existing trace error reporting to use `apitracing.EndSpan`

* Add deferred trace error reports to tbot

* Optimize for @espadolini limited horizontal editor length
2024-04-19 14:45:39 +00:00
Nic Klaassenandrosstimothy 680ac535ce fix: return OpaqueAccessDenied for NotFound remote cluster errors (#40571)
* fix: return OpaqueAccessDenied for NotFound errors

This commit modifies OpaqueAccessDenied to return an identical generic
NotFound error whether the input error is NotFound or AccessDenied.
The commit also updates all call sites of OpaqueAccessDenied to use it in
the paths where there is any error fetching the resource as well as when
access is denied.

It doesn't do much good to return AccessDenied errors as NotFound, if
they don't match the NotFound error you would get if the resource really
didn't exist.
It's trivial to tell the errors apart and discover the existence of a
resource you shouldn't be allowed to access.
The commit attempts to mitigate that issue and properly hide the
existence of resources the user should not be allowed to list.

* remove changes unrelated to remote clusters

* improve doc comment

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

* make sure gRPC errors match

* fix integration test

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-04-18 19:01:01 +00:00
Marco André Dinis 389f7a9b9a Remove unused Integration Service (#40266)
The Integrations Service is not used in ServerWithRoles.
It is only used in `lib/auth.NewGRPCServer`

This PR removes this service instance in order to remove dead code.
2024-04-18 07:05:26 +00:00
Brian Joerger 9479f7fa53 Remove extraneous App Session watch logic (#40092)
* Remove WaitforAppSession logic.

* Remove WaitForSnowflakeSession logic.

* Decrease log severity of web session cache readthrough to debug.
2024-04-17 19:03:59 +00:00