Commit Graph
90 Commits
Author SHA1 Message Date
Gavin Frazar 6b16584c58 Add health check config to cache (#53879) 2025-04-09 22:10:41 +00:00
Brian Joerger 58f71101d8 feat: Hardware Key Agent - Add api/utils/keys/hardwarekey package (#53671)
* Move hardware key files into new hardwarekey package.

* Tidy up PIVSlot logic and remove its piv-go dependency.

* Add godoc comments to cliPrompt methods; Update cliprompt.go license year.

* Add godocs.
2025-04-07 19:31:11 +00:00
Gavin Frazar 635894b38b Add health check config API client (#53553) 2025-03-31 20:12:45 +00:00
Noah StrideandMarco Dinis 0586278cde Migrate GetClusterName to gRPC (#53164)
* Adjust GetClusterName method signature to include context.Context

* Start hacking on gRPC GetClusterName impl

* Fix test mocks to match signature

* Fix integration tests

* Fix integrations tests

* Missing ctx

* New GetClusterName RPC implementatin

* Add fallback cluster name

* Correct godoc comment

* Remove unused method

* Remove unused import

* Fix E2E test

* Fix tests

* Fix deferred context cancel in test conflicting with parallel subtests

* Fix import

* Fix imports

* Update lib/auth/auth_with_roles.go

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

---------

Co-authored-by: Marco Dinis <marco.dinis@goteleport.com>
2025-03-20 10:07:02 +00:00
Noah Stride f0f3e5c2a6 Remove deprecated ReverseTunnel functions (#53084)
* Remove deprecated ReverseTunnel functions

* Add notimplemented handler
2025-03-19 14:42:00 +00:00
Noah Stride cbf3f2b6de Remove unused SetClusterName HTTP RPC (#53146)
* Remove unused SetClusterName HTTP RPC

* Fix tests

* Fix spacing

* Fix suite test
2025-03-19 10:02:08 +00:00
Noah Stride bd4d7a44d4 Remove deprecated HTTP RegisterUsingToken Auth RPC (#53110) 2025-03-18 18:13:29 +00:00
Noah Stride df5bbfcce5 Remove deprecated ProcessKubeCSR HTTP RPC (#53111)
* Remove deprecated ProcessKubeCSR HTTP RPC

* Remove unused field
2025-03-18 16:26:21 +00:00
Bernard Kim bd8933ef51 access_monitoring_rule: Support spec.automatic_approval field (#52274)
* Support automatic_approval in AMR spec

* Support filter by automatic_approval_name

* Update AMR validation

* Update terraform schema

* Fix import

* Add additional test case

* Improve amr spec godocs

* make -C integrations/terraform docs
2025-02-27 19:04:24 +00:00
Marco Dinis 4fc9727324 WebAPI: Add state as filter for UserTasks listing endpoint (#52191)
* WebAPI: Add state as filter for UserTasks listing endpoint

* fix pagination bug

* Add filters param to ListUserTasks
2025-02-20 09:24:06 +00:00
Andrew LeFevre eecd072cc0 verify cluster name of TLS peer certificates (#52128) 2025-02-13 21:25:52 +00:00
Edoardo Spadolini cc77fcebdf Stable UNIX users: functionality (#51200)
* wiring the API client through

* tctl stable-unix-users ls

* stable UID fallback for Teleport SSHD

* stable_unix_user.create event

* fix-license

* Require and test audit log message

* Add stable_unix_user_config to fileconf

* Avoid saying "fallback UID" in logs

* Avoid saying "fallback UID" in error messages

* Avoid racing writes in the mock emitter

* pnpm lint-fix

* fix lib/auth tests that broken during rebase
2025-01-29 18:15:57 +00:00
Noah Stride b988e70e11 Introduce tsh workload-identity issue-x509 (#51492)
* Start hacking on tsh support for new RPCs

* Wire up to Run

* Add test over new CLI command
2025-01-29 14:56:33 +00:00
Yassine Bounekhla 100fddcb3e add unique notification identifier protos and crud methods (#51358) 2025-01-23 18:27:31 +00:00
Matt BrockandTiago Silva bc3a767f18 Adding OIDC auth functionality to the Azure integration (#51219)
* Protobuf and configuration for Access Graph Azure Discovery

* Fixing rebase after protobuf gen

* Updating to use existing msgraph client

* PR feedback

* Using variadic options

* Removing memberOf expansion

* Expanding memberships by calling memberOf on each user

* PR feedback

* Rebase go.sum stuff

* Go mod tidy

* Fixing go.mod

* Update lib/msgraph/paginated.go

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

* PR feedback

* Protobuf and configuration for Access Graph Azure Discovery

* Adding Azure sync functionality which can be called by the Azure fetcher

* Protobuf update

* Linting

* PR feedback

* PR feedback

* Updating to use existing msgraph client

* PR feedback

* Using variadic options

* Removing memberOf expansion

* Expanding memberships by calling memberOf on each user

* PR feedback

* Rebase go.sum stuff

* PR feedback

* Protobuf and configuration for Access Graph Azure Discovery

* Protobuf gen fix

* Rebase fixes

* More cleanup

* e ref update

* Invoking token generation and returning the response

* Quick test with a message to make sure RPC is invoked

* Skeleton of new Azure OIDC RPC call

* Fetching the Azure OIDC token during fetcher creation and establishing a credential assertion approach

* PR feedback; restricting token requests to auth, discovery, and proxy roles.

* Lint

* Fixing mocks

* Fix imports

* Fix test

* Rebase fxes

* Adding back OIDC fetching, accidentally removed it during rebase

* e ref

* Lint

* Fix imports

---------

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
2025-01-23 18:03:16 +00:00
rosstimothy efaec73e21 Remove the auth namespaces REST API (#50999)
Eliminates the namespace CRUD API as part of
https://github.com/gravitational/teleport/issues/49509.

The most notable change introduce here is with flushCache in the
auth helpers. It was ironically using namespaces because they
were deprecated, however, it has since been updated to use a role
instead. The helpers.go file was also updated not to rely on testify
in attempt to prevent it from being included in production builds.

Updates https://github.com/gravitational/teleport/issues/6394.
2025-01-15 14:21:23 +00:00
STeve (Xin) Huang f0abbce0fd GitHub proxy part 6: proxing Git using SSH transport (#49980)
* GitHub proxy part 6: proxing Git using SSH transport

* better command parsing and update suite

* refactor

* revert unnecearrty files

* address review comments

* ut fix

* revert localsite_test.go

* change special suffix to teleport-github-org for routing

* fix routing ut

* minor typo edit

* fix ut after sshca change

* add UT to sshutils

* minor review comments

* fix api ut because of special suffix change

* GitServerReadOnlyClient

* downgrade error to warning

* run go mod tidy. not sure why it's needed

* rename mock.go to mock_test.go
2025-01-14 21:48:04 +00:00
Edward Dowling f93eca5656 Add initial expiry service (#49267)
* Add initial expiry service

* Fix incorrect listAccessRequest options

* Fix linting

* Fix import order

* Check if context is done if sem aquisition fails in main loop

* Use gracefull exit context when starting expiry service
2025-01-06 15:06:17 +00:00
rosstimothy c61461b4fd Improve client tools host resolution (#50175)
Host resolution performed because labels, fuzzy search, or predicate
expressions were supplied to commands that establish connections to
a single host has historically been performed client side in tsh.
While that works in most cases, it can prevent correctly
resolving hosts in some situations, i.e. when there are ambiguous
hosts and tsh is unaware that the cluster routing strategy is set
to ROUTE_TO_MOST_RECENT.

To improve the experience, a new ResolveSSHTarget was added to
Auth to allow host resolution to be performed server side. The
resolution works in a similar manner to, and was inspired by
GetSSHTargets. In the event that the new RPC is not implemented,
because the client is newer than Auth, tsh has also been updated
to pull the cluster networking config and address any host
ambiguity if allowed.

As a result tsh scp and tsh proxy ssh should be much more
tolerant to, and still permit access in situations where
ambiguous hosts are present for some amount of time. Prior to
this the only way to connect in these situations was to find
the UUID of the correct target instance and try again after
seeing an ambiguous host error.
2024-12-20 15:57:26 +00:00
rosstimothy 41bae13c2f Convert lib/srv/alpnproxy to use slog (#50018) 2024-12-12 14:25:57 +00:00
c6e46e3262 Workload ID: Add WorkloadIdentity local service and cache config (#49942)
* Add WorkloadIdentity store and cache

* Update lib/services/local/workload_identity.go

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

* Update lib/services/local/workload_identity.go

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

* Update lib/cache/resource_workload_identity.go

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

---------

Co-authored-by: Edward Dowling <EdwardDowling@users.noreply.github.com>
Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2024-12-10 09:22:09 +00:00
STeve (Xin) Huang c4d0dc4f00 GitHub proxy part 2.5: git_server cache (#49564)
* GitHub proxy part 2.5: git_server cache

* revert event

* fix getAll

* review comments
2024-12-05 03:18:50 +00:00
STeve (Xin) Huang 903fee053f GitHub Proxy part 3: gen github user cert and export CA (#49396)
* GitHub Proxy part 3: gen github user cert and export CA

* address pr comment

* minor refactor

* use cache

* fix build and cache
2024-12-03 18:17:21 +00:00
Trent Clarke 088580668a Expose Account Assignmnets via cache (#49567)
Extends cache to allow consumers to fetch a specific Identity Center account
assignment, rather than just listing them.
2024-12-02 02:11:46 +00:00
STeve (Xin) Huang fae535b3df GitHub Proxy part 2: git_server resource, service, and RBAC (#49393)
* git_server resource and role.allow.github_permissions

* implicit RO on KindGitServer

* review comments

* fix ut

* make -C integrations/operator crd

* fix ut again

* make crds-up-to-date and make -C integrations/terraform docs
2024-11-27 16:12:30 +00:00
Sakshyam Shah 3757080c6d feat: identity center and provisioning service gRPC client with deleteAllxxx methods (#48714)
* feat: identity center and provisioning service gRPC client with deleteAllxxx methods

* DeleteAllPermissionSets

* run make fix-imports
2024-11-12 16:57:47 +00:00
Trent Clarke 81e4152cb5 Exposes Identity Center Account Assignment listing on Cache interface (#48655) 2024-11-10 23:20:33 +00:00
Alex McGrathandMaxim Dietz fa97b8f90d feat: Allow including Access Lists as nested members and owners (#38738)
- Recursively check for accesslist membership

- Allow adding/removing/listing included access lists in acl commands

- Add a recursive test

- Use dynamic access lists structure from RFD

- Resolve proto changes

- Exclude 'list' members from Access List memberCount

- Calc Access List member count with members of type 'list' excluded,
  return seperately to front end

- Update examples/integrations

- Update crd docs

- Update tf docs

- Perform calculation of inherited roles/traits to AccessList service in
  order to utilize cache and minimize number of requests.

- Grant Okta integration RO for Access Lists

- Update AccessListMember-* events

- Include count for inherited grants

- Include MembershipKind of affected member(s)

- Emit inherited grants / members' MembershipKind for AccessListMember-*
  events

- Update notified owners for Access Requests

- Ensure dynamic owners are notified for Access Requests

- Ensure dynamic owners are notified via Slack integration

- Optionally pass an AbortSignal to `fetchAccessLists` in Web UI

- Replace usages of `services.IsAccessListOwner/IsAccessListMember` with
  equivelant funcs from `Hierarchy`

- Remove final references to AccessListMembershipChecker

- Don't allow ACL deletion when member/owner in other lists

- Guard Access List deletion behind membership/ownership checks for List

- Expose Hierarchy func to recursively get all members

- Tidy UserLoginStateGenerator logic involving ACL Membership/Ownership

Co-authored-by: Maxim Dietz <maxim.dietz@goteleport.com>
2024-11-01 22:07:36 +00:00
Trent Clarke 57daeced9d Expose Provisioning States via Cache interface (#48115) 2024-10-30 09:42:21 +00:00
Hugo Shaka fbbcb5fe39 Add AutoUpdateAgentRollout service and cache (#47833) 2024-10-24 12:08:07 +00:00
Noah Stride bad3497d70 Convert RegisterUsingToken RPC from HTTP to gRPC (#47853)
* Add proto changews for shifting RegisterUsingToken to gRPC

* Implement RegisterUsingToken RPC and client fallback

* Add methods to `api/client`

* Adjust join/register code to try new API first and fallback to old

* Rejig JoinServerGRPCServer to invoke auth.Server

* Tidy up some code duplication

* Fix broken build

* Fix TestRegisterBot_RemoteAddr

* Fix TestServer_RegisterUsingTPMMethod

* Add test for new RegisterUsingToken gRPC RPC

* Remove unused helper function

* Fix test

* Walk back switch to gRPC endpoint for registration via proxy

* Remove unused code
2024-10-24 10:54:22 +00:00
Przemko Robakowskiandrosstimothy f651ab19cd Create WindowsDesktops for matching DynamicWindowsDesktops (#46991)
* Add DynamicWindowsDesktop to proto

* Add resource matchers to Windows desktop service config

* Implement API and backend for DynamicWindowsDesktop

* Cache and watcher support for DynamicWindowsDesktop

* Create WindowsDesktops for matching DynamicWindowsDesktops

* Fix imports

* fix test

* lint

* review comments

* move rpc to separate server

* rework api and grpc more towards 153-style

* e

* remove dynamic windows from paginated resource

* add tests

* add tests

* Update api/proto/teleport/legacy/types/types.proto

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

* lint

* gci

* cleanup

* cleanup

* use generic service

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* gci

* rework cache

* rework cache

* add admin action checks

* move service

* add service test

* gci

* update discovery

* add discovery test

* review comments

* review comments

* review comments

* update interfaces

* gci

* gci

* review comments

* review comments

* fix loggers

* fix tctl

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-10-23 20:33:58 +00:00
Przemko Robakowskiandrosstimothy ee09328cc4 Cache and watcher support for DynamicWindowsDesktop (#46989)
* Add DynamicWindowsDesktop to proto

* Add resource matchers to Windows desktop service config

* Implement API and backend for DynamicWindowsDesktop

* Cache and watcher support for DynamicWindowsDesktop

* Fix imports

* fix test

* move rpc to separate server

* rework api and grpc more towards 153-style

* e

* remove dynamic windows from paginated resource

* add tests

* add tests

* Update api/proto/teleport/legacy/types/types.proto

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

* lint

* gci

* cleanup

* cleanup

* use generic service

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* gci

* rework cache

* rework cache

* add admin action checks

* move service

* add service test

* gci

* review comments

* review comments

* review comments

* update interfaces

* gci

* review comments

* review comments

* fix loggers

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-10-22 21:22:03 +00:00
Brian Joerger 22edf09261 feat: SSO MFA - Add MFAToken to SSO Callback flow (#47648)
* Add MFA token to SSO callback response.

* Add MFA token to auth response validation endpoints.

* Cleanup.
2024-10-17 17:35:18 +00:00
Marco Dinis 34f9bb7a30 Create DiscoverEC2 User Tasks when Auto Discover fails on EC2 instances (#47064)
* Create DiscoverEC2 User Tasks for failed EC2 enrollments

This PR changes the DiscoveryService to start creating and updating
Discover EC2 User Tasks.

So, what are Discover EC2 User Tasks?
When users set up Auto Discover for EC2 Instances, they don't have a
good way of checking for issues on their configured matchers.

We created User Tasks as a way to warn Users that something's wrong.
Each User Task should describe an issue that happened and a way to fix
it.
This has potential to be used to report unexpected events trough the
whole system, which are not errors per se, but something the user should
take action in order to improve the situation.
In this case, we are creating a sub type of those tasks: DiscoverEC2.

From now on, when the DiscoveryService fails to auto-enroll an instance,
it will create a DiscoverEC2 User Task grouping all the failed instances
by the following props:
- integration
- issue type
- account id
- region

A follow up PR will also create notifications so that the user can
actually be notified on those User Tasks and take action.

* improve naming and split function into multiple methods

* rename task issues variable name

* fix context early cancelation
2024-10-16 10:15:09 +00:00
rosstimothy 185988f449 Clean up code marked for deletion in v17 (#47364)
* Clean up code marked for deletion in v17

Removes legacy PIVSlot and App SessionID marked for deletion in v17

* fix: remove missed todo delete comment

* fix: restore comment about caching routeToApp

* fix: validate scope and restore username retrieval

* fix: setting scopes in requests

* fix: update TF docs
2024-10-10 15:36:53 +00:00
Marco Dinis 5477077da8 UserTasks: List by Integration service method (#47327)
This PR adds a new method that allows users to list UserTasks by
Integration.
Given this is our main use case when showing the UserTasks in the UI
(we'll be always showing UserTasks for a given integration), we created
a dedicated method in the gRPC.
We'll probably add more filters but they will always include the
integration (at least for the uses cases we have currently).
2024-10-09 08:46:06 +00:00
rosstimothy 0486c0935a Update backend.Key to be its own distinct type (#46701)
Converts the backend.Key from a slice of bytes to a concrete struct.
The main motivation behind this change is to be able to better
distinguish individual components of a key. The textual representation
of a backend key is constructed by joining all components of the key
with a /. By representing the entire key as a single textual object
it prevented resources containing a / in their name from being
properly identified. There was a lot of code that interpolated keys
in various manners and expected only a specific number of
subcomponents for a particular resource. This lead to most,
if not all, of the RPCs used to create a resource to permit a name
containing /, (i.e. a user named test/llama/1), but any RPCs used
to retrieve the resources would fail to retrieve them from the
backend.

Every backend.Key now carries a slice of all the individual
components in addition to the textual representation. This permits
more fine grained inspection per component, while also not having
to construct the textual representation for a group of components
more than once.

The backend.Sanitizer was updated to only validate keys for backend
writes. Retrieving and deleting invalid of malformed keys is now
permitted. This will allow any existing resources that were created
with / in one of the components to become retrievable and deletable.
However, any new resources with  / in their name are explicitly
prevented.

Closes #6088
Closes #9107
Closes #10576
Closes #42823
2024-10-04 14:02:00 +00:00
Noah Stride 8a8534260a Migrate ReverseTunnel Resource APIs from HTTP to gRPC (#46761)
* Start hacking on migrating reversetunnel

* Migrate ReverseTunnel HTTP API to gRPC

* Wire Cache into Presence GRPC service

* Add TestPresenceService_ListReverseTunnels

* Add UpsertReverseTunnelV2 store method which returns upserted resource

* Make API client return reversetunnel on upsert

* Add TestListReverseTunnels

* Add TestDeleteReverseTunnel

* Add TestUpsertReverseTunnel

* Missing err check

* Remove presenceService from gRPCServer struct

* Add deprecations on GetReverseTunnels
2024-10-02 08:44:01 +00:00
Noah StrideandZac Bergquist d4bea8c154 Remove deprecated GetSessionChunk and GetSessionEvents APIs (#46797)
* Start hacking on removing deprecated session api

* Start clearing out unused methods

* Remove a bunch of unused helpers

* Switch integration tests to use new StreamSessionEvents API

* Add helper for draining events/stream

* Fix dodgy comparison in helper

* Remove more unused fields/types

* Update integration/integration_test.go

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

* Remove SSHPlaybackWriter

* Remove more unused helpers

* Remove unused constants

* Simplify how integration test checks for audit log presence

* Remove outdated comment

---------

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2024-09-23 10:57:11 +00:00
Yassine Bounekhla 73df51c767 add periodic cleanup for notifications (#40941) 2024-09-20 10:56:41 +00:00
Tiago Silva cbbc830103 [kube] Drop usage of ProcessKubeCSR (#46779)
* [kube] Drop usage of `ProcessKubeCSR`

This PR drops the usage of `ProcessKubeCSR` to ask Auth to sign a certificate on behalf of a user when running `tsh request search --kind=pod,...`.
Previously, we used `ProcessKubeCSR` to sign a new certificate but given that Kubernetes Access supports impersonation, this PR levarages it.

This also allows reusing the same kubernetes client for multiple calls.

* add deprecation notices to ProcessKubeCSR

* don't enforce kube api to be enabled
2024-09-20 09:56:04 +00:00
Noah Stride 6cfd49cb8b Replace more Logrus usage with Slog (#46757)
* Remove logrus from lib/auth/machineid

* Switch authclient.Config.Log and TunnelAuthDialerConfig.Log to Slog

* Add *slog.Logger to auth.Server

* Remove logrus usage in `lib/auth/access.go`

* Replace logrus with slog in lib/auth/accountrecovery.go

* Replace logrus with slog in `lib/auth/apiserver.go`

* Add missing logger to auth.Server

* Fix test
2024-09-19 18:37:51 +00:00
Noah Stride 5a7e73c91a Remove deprecated HTTP RemoteCluster endpoints (#46756)
* Remove deprecated HTTP RemoteCluster endpoints

* Remove redundant test
2024-09-19 16:08:23 +00:00
Marco Dinis 77d28b2b34 User Tasks: services and clients implementation (#46131)
This PR adds the implementation for the User Tasks:
- services (backend+cache)
- clients (API + tctl)
- light validation to set up the path for later PRs
2024-09-19 09:56:41 +00:00
Vadym Popov f4fc673e45 Add AutoUpdate Client/Cache implementation (#46661)
* Add AutoUpdate Client/Cache implementation

* CR changes

* Add permission for proxy to access resources

* Rename all occurrences auto update to camelcase

* Remove auto update client wrapper

* Drop AutoUpdateServiceClient helper
Rename comments for consistency
2024-09-19 02:44:02 +00:00
2175b3bf3c update mfa missing error (#46437)
* update mfa add error

* docs: update verbiage for missing MFA

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

---------

Co-authored-by: Steven Martin <stevenmartin@stevens-mbp.lan>
Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-09-17 15:36:47 +00:00
Edoardo Spadolini 4957735a31 Get rid of internal reloads (#44882)
* disable tls client resumption

* avoid redundant verification in TLSDial

* fix wrong use of InsecureSkipVerify in HTTP auth client

* avoid overwriting GetClientCertificate in api client

* Use a getter function for CAs in TunnelAuthDialer

* Use dynamic connector data for the agent's auth client

* Make getPROXYSigner dynamic

* WIP: the thing (reloadless)

* Fix TestInstanceCertReissue

* Fix TestIntegrations/RotateFoo

* get rid of the whole reload mechanism

* Update most tests to not check for reloads

* Get rid of TestDatabaseAccess/RotateTrustedCluster

The test has been unconditionally skipped for two years now.

* avoid clobbering the auth connector

* overwrite clientState in update_servers anyway

* fix integration/hsm tests

* Document ListenForNewEvent

* fix RunWithSignalChannel godoc

* simplify ListenForNewEvents

* Remove forgotten commented code

* Explain the t.Setenv trick for non-parallelism

* explain waitingForNewEvent in integration/hsm
2024-09-11 21:13:09 +00:00
Nic Klaassen 81cb68a8bc deprecate references removed from teleport.e (#45937)
* deprecate references removed from teleport.e

* update e ref
2024-09-05 17:43:28 +00:00
Andrew Burke 564c245eca Add StaticHostUserV2 (#46038)
This change adds the v2 static host user resource.
2024-09-04 21:16:11 +00:00