Commit Graph
1254 Commits
Author SHA1 Message Date
Hugo ShakaandAlan Parra 9dc860d5fe Fix proto resource 153 marshalling for autoupdate_* resources (#50688)
* Fix proto resource 153 marshalling

* Update tool/tctl/common/collection_test.go

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

* Update tool/tctl/common/collection_test.go

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

* Address feedback

- Change from Resource153AdapterV2 to ProtoResource153Adapter
- fix test failures and unmarshal proto resources properly
- add a failing round-trip proto 153 test case
- bonus: fix the table tesst reosurce create that did not support
  running a single row

* Apply suggestions from code review

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

* lint

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2025-01-09 14:18:57 +00:00
Brian Joerger 3ebf26978c Document second_factors field (#49016)
* Document second_factors; Update test plan.

* Update proto comment; Update terraform docs.

* Clarify second_factors reference.

* Fix docs lint.

* Address comments.

* Address marco's comment.
2025-01-06 19:57:26 +00:00
Gabriel Corado dbf8fcd964 Add client metadata to PostgreSQL database session start event (#50711)
* feat: add client metadata to database session start event

* refactor(test): update option to WithUserAgent
2025-01-06 18:53:35 +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
Gabriel Corado 2dbdfd27a1 Determine session type on stream based on stream watcher events (#50395)
* refactor: determine session type on stream based on watcher

* refactor(auth): early return when is teleport server

* refactor: move to function and add tests

* chore(lib): fix lint

* refactor(events): make private function
2024-12-27 16:52:45 +00:00
Bernard Kim a221604dc5 Add UpsertTrustedClusterV2 RPC (#49789)
* Add UpsertTrustedClusterV2 rpc

This supersedes UpsertTrustedCluster rpc. V2 performs resource name
validation.

* Replace confusing UpsertValidationTrustedCluster name

* Use UpsertTrustedClusterV2 in tests

* Address feedback

- Remove unnecessary ping
- Update error messages
- Use skipNameValidation consts
- Validate cluster name before establishing trust
- Do not reveal cluster name in error message
- Use BadParameter instead of CompareFailed

* Use webclient.Find

* Fix test/lint

* Allow label updates

* Fix test

* Fix error handling

* Implement CreateTrustedClusterV2 and UpdateTrustedClusterV2

* Address feedback

* Minor fixes

* Move V2 RPCs to the trust service

* Update comment

* Drop V2 suffix

* Require matching revision

* Fix upsert/update revision

* Drop V2 from Create and Update APIs

* Lint: Fix typo
2024-12-21 04:24:29 +00:00
Tiago Silva 3fb3dc4453 netiq: Add NetIQ plugin boilerplate code (#50476)
This PR introduces the necessary protobuf changes to accomodate NetIQ
plugin.

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

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-12-20 13:31:57 +00:00
Matt Brock ef7a93fa3d Protobuf and configuration for Access Graph Azure Discovery (#50364)
* Protobuf and configuration for Access Graph Azure Discovery

* Adding godoc and removing Integration field from fileconf
2024-12-18 20:05:56 +00:00
Hugo Shaka 89a3d2a495 Add autoupdate_config and autoupdate_agent_rollout validation (#50181)
This commit removes the restrictions of the autoupdate_agent_rollout and autoupdate_config schedules but adds groups validation.

It also adds some optional server-side validation that should not be enforced at the resource level.
2024-12-17 17:12:42 +00:00
Noah Stride 1a4ba3ff0a Workload Identity: Add protos for issuance service and Attributes (#50163)
* Add protos for issuance service and attrs

* "expiry" -> "expires_at" rename

* Pull jwt/x509 svid out into own messages

* Add WorkloadIdentity/WorkloadIdentityRevision fields to SPIFFESVIDIssued

* Update package name
2024-12-17 11:40:28 +00:00
Marco Dinis c168172ddc Add debugging steps for DiscoverEC2 User Task issues (#47513)
* Add debugging steps for DiscoverEC2 User Task issues

This PR adds a new field when getting an User Task.
Description contains a markdown document that should be displayed to the
user which helps them fix the issue with the task.

* move descriptions from api to lib
2024-12-17 09:47:43 +00:00
Yassine Bounekhla 5047402502 skip access list if one of its roles is missing (#49456) 2024-12-16 19:06:40 +00:00
Alan Parra ec2d05f7e2 Add initial Decision (aka PDP) protos (#49875)
* Clone protos from fspmarshall/pdp-work-02

* Use decisionpb as the Go package alias

* Update DecisionService docs

* Split identity protos into separate files

* Update Metadata docs

* Split metadata into separate files

* Update Resource docs

* Update database access docs and fields

* Update SSH access docs and fields

* Ignore breaking changes on decision protos

* Update generated protos

* Use teleport.trait.v1.Trait

* Document mutual dependency between "ResourceID" types

* nit: s/ResourceID/ResourceId

* nit: Use the correct CamelCase field name in comments

* Update generated protos

* Add RouteToApp.target_port

* Update generated protos

* Update comments on TLSIdentity / tlsca.Identity

* Update generated protos
2024-12-16 18:02:29 +00:00
Trent ClarkeandRoman Tkachenko 86dc8b14d8 Adds Roles for IC resource access requests (#49565)
* Adds IC Account Assignments to preset `access` role

Adds the global-allow wildcards to the preset access role, allowing the `access`
role to participate in Resource Access Requests involving Identty Center
resources.

* Adds IC Account Assignments to preset `access` role

Adds the global-allow wildcards to the preset access role, allowing the `access`
role to participate in Resource Access Requests involving Identty Center
resources.

* Add default roles if not present

* Add reviewer role

* Update lib/services/presets.go

Co-authored-by: Roman Tkachenko <roman@goteleport.com>

* apply feedback

---------

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2024-12-16 02:06:46 +00:00
Marco Dinis d37da511c9 UserTasks for Discover EKS: create tasks when auto enrolling fails (#50024)
* UserTasks for Discover EKS: create tasks when auto enrolling fails

This PRs changes the DiscoveryService to ensure it creates UserTasks
when EKS Clusters fail to auto-enroll.

* simplify types
2024-12-13 11:47:12 +00:00
120163032e Automatially add IC Account to Account Assignments Access Requests (#50154)
* Automatially add IC Account to Account Assignments Access Requests

The UI needs access to the account associated with an Account Assignment
in order to display the enclosing Account, otherwise the user will not
be able to see their assogned permission sets.

This patch automatically adds the enclosing account for any account
assignments in a resource access request and allows the user to see
ther human-friendly names in the access request listing.

* Apply suggestions from code review

Co-authored-by: Sakshyam Shah <sshah@goteleport.com>
Co-authored-by: Marek Smoliński <marek@goteleport.com>

* Code review sugestions

---------

Co-authored-by: Sakshyam Shah <sshah@goteleport.com>
Co-authored-by: Marek Smoliński <marek@goteleport.com>
2024-12-12 23:47:51 +00:00
Trent ClarkeandMarek Smoliński b3fbbc2cf9 Filter IC Permission Sets based on access (#49936)
* Filter IC Permission Sets based on access

If a user is granted access to an IC Permission Set via an access request,
the UI treats the referenced account as if all Permission Sets are granted.
This hides the requestable Permission Sets from the user, making it
impossible for a user to requests more Permission Sets on that account.

This patch filters the Permission Sets delivered to the UI based on whether
the user already has access the Permission Sets and marks any requestable
Permission Sets on the account.

This provides the UI with enough information to decide how to display the
Permission Set list in order to get around the issue.

* Update lib/auth/auth_with_roles.go

Co-authored-by: Marek Smoliński <marek@goteleport.com>

* Update auth_with_roles.go

---------

Co-authored-by: Marek Smoliński <marek@goteleport.com>
2024-12-12 22:51:01 +00:00
Marco Dinis da6dfdc76f Fix UserTask deterministic name for DiscoverEC2 issues (#50051) 2024-12-12 14:10:38 +00:00
Noah Stride 49c30832f7 Add workload_identity_labels to RoleCondition (#50071)
* Add WorkloadIdentityLabels field to role

* Wire up access checker

* Add validation for new field

* Update CRDs

* Add to terraform provider

* Mispel some words to keep the republic happy

* Add WorkloadIdentityLabelsExpression

* Update Terraform provider

* Add to operator CRD

* PLS RUN CLA CHECK
2024-12-12 11:46:19 +00:00
Bartosz Leper e73e8aabf7 Fix unmarshalling of CreateDatabaseUserMode (#49995)
* Fix unmarshalling of CreateDatabaseUserMode

* Review
2024-12-11 17:55:57 +00:00
Rafał Cieślak 7eb25e4220 VNet: Refuse conn if local port doesn't match app spec (#49944)
* Add custom type for list of port ranges

* Verify local port before initializing local proxy

* Call AppResolver.OnInvalidLocalPort before refusing conn

* Fix how lib/vnet.TCPAppResolver sets leafClusterName

* Refactor CannotProxyVnetConnection

This allows more reasons to be specified.

* Improve how TshdNotificationsService gets cluster names

* Let notifications override auto-removability

* Send RPC to Electron app on invalid port

* Remove impl of sort.Interface from PortRanges

* Make GetTCPPorts return PortRanges

* Test clusterName only against RootClusterName

* Don't say "local port" in UI

* Show valid ports in Connect

* Show valid ports in tsh

* Fix fake app provider in tests
2024-12-11 16:20:58 +00:00
STeve (Xin) Huang 576192de20 GitHub proxy part 7: audit events (#49923)
* GitHub proxy part 7: audit events

* make Git Command consistent

* fix typo
2024-12-11 14:17:42 +00:00
STeve (Xin) Huang 80a58fc82c GitHub proxy part 5: OAuth flow to retrieve GitHub identity (#49849)
* GitHub proxy part 5: OAuth flow to retrieve GitHub identity

* review comments round1

* review comments round 2 and update tsh git list

* make -C integrations/operator crd

* make -C integrations/terraform docs

* fix flaky test
2024-12-10 17:31:32 +00:00
Erik Tate 5e08f56d03 adding more granular port forwarding access controls that allow for (#49417)
specifying within a role whether remote forwarding, local forwarding,
both, or none should be allowed
2024-12-10 16:35:16 +00:00
Noah Stride 904d4f99e6 Workload ID: Add WorkloadIdentity CRUD gRPC Service (#49639)
* Add WorkloadIdentity store and cache

* Add WorkloadIdentity CRUD service
2024-12-10 10:34:14 +00:00
Bartosz Leper 02141ca95c Add admin rule tab to the role editor (#49764)
* Add admin rule tab to the role editor

Also tightens some constraints about standard role editor conformance.

* Add a way to delete an admin rule

* Review
2024-12-09 17:48:38 +00:00
Trent Clarke 10925bbaae Add Identity Center Account Assignments to Unified Resource Cache (#49580)
Adds Identity Center Account Assignments to the Unified resource cache
so they can be requested in access requests.

Unfortunately we can't just include an `identitycenterv1.AccountAssignment`
directly in the resource cache ListResources output because the legacy
protobuf codegen used for the authservice and the new codegen used for
identitycenter/v1 produce incompatible serialization code, so resulting
generated code does not compile.

To get around this issue, this change introduces a parallel (and slightly
simplified) definition of an IdentityCenterAccountAssignment in the authservice
protobuf spec to act as the wire format for this type. The cached
`identitycenterv1.AccountAssignment` resources are copied into a
`proto.IdentityCenterAccountAssignment` on a cache read.

Includes:
 - adding resources to cache
 - adding account assignment paginated resource
 - account assignment role condition matching for RBAC
2024-12-09 12:02:36 +00:00
Hugo Shaka 58459199d9 autoupdate: reconcile rollout status and add strategy interface (#49735)
* autoupdate: reconcile rollout status and add strategy interface

* fix missing constants + add license

* lint

* fix proto field id
2024-12-06 22:00:01 +00:00
Guillaume J. Charmes 58a6fe7173 Emit port-forward event only the first time, add port-forward-end event. Include cluster and pod metadta in event. (#49109) 2024-12-06 17:31:54 +00:00
Noah Stride 7a3fce975a Workload ID: Add Protos for WorkloadIdentity resource, CRUD and events (#49650)
* Add protos for resource and resource svc

* Add field for encoding the created/updated workloadidentity in audit
events

* Remove redundant package qualifier

* Add UpsertWorkloadIdentity

* Appease linter

* Add TrimToMaxSize implementation
2024-12-06 11:42:44 +00:00
Marco Dinis 979418a1ae AWS OIDC: add aws account id as label to AWS App (#49693)
* AWS OIDC: add aws account id as label to AWS App

We were not setting any labels in the AWS App when using the Discover
Flow for a given AWS OIDC integration.

This is a bad practice because this means that users must have
`app_labels: *:*` in order to access this particular app.
This is not recommended because it grants access to every app.

This PR changes this so that the account id can be used to gate access.

* fix test
2024-12-06 08:43:03 +00:00
Alan Parra 8e723cc7ff Forbid custom namespaces in various resources (#49830)
* Forbid Database and App updates with custom namespaces

* Forbid custom namespaces on api/types.KeepAlive

* Forbid custom namespaces in api/types.Metadata

* Forbid custom namespaces in api/types.RoleV6

* Use a share validation helper, improve error message
2024-12-05 19:21:24 +00:00
STeve (Xin) Huang 8f50cf15e8 GitHub proxy part 4: tsh git ls with unified resource (#49596)
* GitHub proxy part 4: tsh git ls

* fix ut

* update username note

* fix
2024-12-05 17:40:03 +00:00
Trent Clarke e1be633ac0 Exposes Identity Center accounts as Apps in Unified Resource Cache (#49301)
* Exposes Identity Center accounts as Apps in Unified Resource Cache

    For the purposes of the UI, Identity Center accounts and account
    assignments are treated like special Apps. This patch exposes
    Account Assignments to the UI via the Unified Resource Cache.

    Includes:
    - Generating an App resource from an Identity Center Account resource
    - General plumbing from backend through to cache and UI

* lint
2024-12-05 12:23:56 +00:00
Trent Clarke 3fcbf16b9b Add Account Assignment IDs to IC Account & App Permission Set Lists (#49747)
* Add Account Assignment IDs to IC App Permission Set List

Account Assignment resources represent potential Identity Center
account assignments that will be created when a Teleport user is
granted access to them via an Access Request.

The UI needs to know which resources represent a given (Account,
Permission Set) pair when building an access request, so this change
allows Teleport to express this relationship in the enclosing
Idenitity Center and App resources, rather than have the UI try
and deduce it.

* doc
2024-12-05 06:19:56 +00:00
e2c803b9c7 Add Contacts Audit Events (#49755)
* Add Contact resource; include it in default editor permissions and web ACL

* Add contacts to ACL test

* Improve godocs

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

* Add `contact` to the web user context

* Add contact audit events

* Lint fix

* Use string interpolation

Co-authored-by: Grzegorz Zdunek <gzdunek@users.noreply.github.com>

* Comment ContactType enum

* make grpc

---------

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
Co-authored-by: Grzegorz Zdunek <gzdunek@users.noreply.github.com>
2024-12-04 17:03:11 +00:00
matheusandZac Bergquist 4f62286cd2 Add Contacts RBAC (#48885)
* Add Contact resource; include it in default editor permissions and web ACL

* Add contacts to ACL test

* Improve godocs

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

* Add `contact` to the web user context

---------

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2024-12-03 17:47:31 +00:00
Rafał Cieślak 0ade3a8f58 Add TargetPort to RouteToApp & use it to route connections to multi-port TCP apps (#49047)
* Add TargetPort to RouteToApp and AppMetadata proto messages

* Pass TargetPort during cert generation

* Refactor Pack.makeTLSConfig to accept struct

This will make it easier to add targetPort to it.

* Add labels to UUIDs used by appaccess test pack app servers

This makes them easier to distinguish when routing doesn't work as expected.

* Refactor Pack.CreateAppSession to accept a struct

* TestTCP: Create app session within test

If we kept the old code, we'd need to manually create a session for each
target port, which would create a lot of duplication.

* Prepare integration test fixtures for multi-port tests

* Add api/utils/net.IsPortInRange

* Use TargetPort when routing TCP connections

* Inline dialMultiPortTCPApp, centralize logic

* Check target port when connecting to single-port app

* Reorder check in IsPortInRange

* Use int instead of uint16

* Extract picking dialTarget to separate function

* addr → uriAddr

* Improve err msg for single-port apps when targetPort != uriPort

* Fix unnecessary conversion to int
2024-12-03 13:55:00 +00:00
Rafał Cieślak 87320df204 Add Ports field to app spec (#47706)
* Add Ports to AppSpecV3

* Validate ports of api/types.AppV3

* Add Ports to lib/config and lib/service/servicecfg

* lib/config TestApps: Improve error messages

* lib/service: Convert servicecfg.PortRange to types.PortRange

* Add multi-port TCP apps to config and tctl tests

* Rename Ports to TCPPorts

* Change port fields to uint16 where possible

* Update comments for Port and EndPort

* Extract port range validation to api/utils/net

* Replace custom check type with require.ErrorAssertionFunc

* Simplify validation of end port

* Fix expected message in api/types test

I forgot to update that one.
2024-12-03 12:41:12 +00:00
Grzegorz Zdunek 095b0a329a Show device trust status in Connect (#49508)
* Check if device is trusted

* Move `TrustedDeviceRequirement` enum to a separate file and generate TS definitions for it

Generating TS definitions for the entire legacy/types/types.proto would result in 50K lines of generated code, and the bundle size would increase by ~20% (around 1 MB).

* Extract function to calculate device trust requirement that can be used both by the server and the client

Important: it now uses `GetEnforcementMode` instead of `GetEffectiveMode`. The check for OSS module is performed on the server-side anyway.

* Check what is device trust requirement based on cluster config and user roles

* Show device trust status in UI

* Remove `types.` prefix

* Improve godocs

* Bring back `getRoles func() ([]types.Role, error)`

* Simplify `TestHasDeviceTrustExtensions`

* Clean up and improve `TestCalculateTrustedDeviceRequirement`

* Move `CalculateTrustedDeviceRequirement` and tests to a separate file

* Add colors to shield icons

* Declare variables where they are used

* Extract a component to display device trust status for better readability

* Correctly reference `lib/client.ProfileStatus.Extensions`

* Set group limit to 8

* Make `switch` exhaustive

* Regenerate protos

* `make fix-license`
2024-11-29 10:11:30 +00:00
Vadym Popov af6a6ea734 Add monitoring of the servers time drifting (#44489)
* Add monitoring of the servers time drifting

* Refactor monitor to use inventory stream

* Add command for inventory control stream for time reconciliation

* Reuse ping/pong logic for time reconciliation

* Add integration test to check if global notification is created

* Limits notification length, renaming

* Return system clock instead of time difference
Add parallel requests to ping the nodes
Fix issue with locking inventory store while making ping request

* Refactor to make time reconciliation part of the inventory control stream

* Fix tests

* Rewrite tests
Return inventory store iterator

* Naming adjustments

* Fix test

* Drop timeReconciliation in order to use direct handler functions

* Make time reconciliation with variable duration

* Replace with duration type in proto
Add test cleanup for possible goroutine leak
Add comment about half request duration

* Format notification message

* Add UpstreamInventoryPong.SystemClock check
2024-11-28 21:18:24 +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
Noah Stride 9cd5d79439 Add JoinMethodBitBucket to JoinMethods validation slice (#49454)
* Add "BitBucket" to "SupportedJoinMethods"

* Alphabetize slice
2024-11-26 16:05:56 +00:00
STeve (Xin) Huang 3c6df87061 GitHub Proxy part 1: github integration resource (#48999)
* github integration resource

* fix lib/web

* revert withSecrets

* use static credentials

* address review comments

* fix ut
2024-11-23 20:09:35 +00:00
Erik Tate a8bff10c86 adding SSHPortForwarding config to RoleOptions (#49165) 2024-11-22 20:20:12 +00:00
Pawel Kopiczko 1a6f8d4c8a Add request.reason.mode to role conditions (proto only) (#49256)
This changes the proto type (+validation) only to declutter the original PR https://github.com/gravitational/teleport/pull/49124

The real changes are in

- api/proto/teleport/legacy/types/types.proto
- api/types/access_request.go
- lib/auth/auth_with_roles.go
- lib/auth/auth_with_roles_test.go

The rest is all generated.
2024-11-22 12:33:03 +00:00
Tim Buckleyandrosstimothy dee7a6f981 Machine ID: Add bitbucket join method for Bitbucket Pipelines joining (#48724)
* Add `bitbucket` join method for Bitbucket Pipelines joining

This adds a new `bitbucket` join method that Machine ID bots can use
to authenticate to Teleport from Bitbucket Pipelines CI runs.

* Add unit tests for bitbucket joining

This also fully adds `deployment_environment_uuid` which was found to
be missing.

* Fix imports

* Update tf docs

* Docs update

* Update generated TF resources

* Attempt to work around docs linter

* Add provision token tests

* Remove pipeline_uuid and step_uuid from protos

Also, fix deploment_environment_uuid field name.

* Remove references to removed fields in tests

* Switch to go-oidc/v3 and remove now-redundant nbf check

* Fix go.mod imports for the TF provider

* Fix event-handler go.mod

* Address review feedback; add 15s timeout to fetch provider metadata

* Update lib/bitbucket/token_validator.go

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

* Fix build after constant rename

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-11-21 23:05:58 +00:00
Trent Clarke 9317c0ef2d Add IdentityCenter resources to App (#49170)
IdentityCenter accounts are exposed to the Teleport UI as applications,
with each app containing the list of AWS permission sets available on
the corresponding account.

This change adds the necessary additions to the App protobuf types
to carry the Identity Center information.
2024-11-21 00:01:18 +00:00
Marco Dinis ce92071cc4 Add Integration and DiscoveryConfig as labels to auto discovered RDS/EKS (#48986)
* Add Integration and DiscoveryConfig as labels to auto discovered RDS/EKS

This PR adds two new labels to RDS and EKS resources:
- Integration
- DiscoveryConfig

Those labels help identify which Integration and DiscoveryConfig were
used to auto enroll the resources.

* remove unused code

* add missing discovery config labels for GCP and Azure
2024-11-18 19:46:57 +00:00
Noah Stride c72a4f2be6 Support for joining Actions in un-reachable GitHub Enterprise Servers via Static JWKS (#48973)
* Add JWKS based validator for github tokens

* Extend proto

* Update auth srvr github join impl to support static jwks

* Ignore govet

* initialize with jwks validator

* Update docs

* Update terraform shizz

* Regenerate various things
2024-11-15 12:32:55 +00:00