Commit Graph
85 Commits
Author SHA1 Message Date
Zac Bergquist 7c92500164 Fix TELEPORT_ALLOW_NO_SECOND_FACTOR (#51676)
Some parts of Teleport required this env var to be set to "true"
while other parts required a value of "yes" - this made it
impossible to pass all of the checks.

Use ParseBool instead to be more generous in what values are allowed.
2025-01-31 22:36:29 +00:00
rosstimothy 02864066ae Revert "Remove 2FA bypass (#47288)" (#49671)
This reverts commit 1952dd8d24.
2024-12-03 13:53:10 +00:00
rosstimothy 56d85facba Restore S3 FIPS and custom endpoint capabilities (#48684)
When migrating the S3 events handler to use aws-sdk-go-v2 applying
the FIPS settings and custom endpoint were inadvertently dropped.
This restores the functionality, while also adding tests to ensure
that they are always respected going forward.

A similar test was added to the dynamodb events handler as well to
prevent any regressions with FIPS settings there.
2024-11-12 16:45:53 +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
Michelle Bergquist 6e1189da89 Use cloud anonymization key (#46819)
- When present, is used to anonymize events
2024-10-30 03:11:23 +00:00
Nic Klaassen 0a0d4137db eliminate rsa.GenerateKey and lib/auth/native (#47768) 2024-10-21 20:55:22 +00:00
Brian Joerger dbe08e0430 Add second_factors (#47233)
* Add proto.

* Add decoding logic for SecondFactorType.

* Update auth preference methods to use and prefer SecondFactors.

* Add fileconf and warning logs.

* Fix tests.

* Address comments.

* Address comments.

* Validate SecondFactor; Disallow SecondFactor and SecondFactors to both be set.

* Address comments.

* Treat second factor SSO as SecondFactor=on; Prevent local user lockout when SSO is the only enabled MFA method; Ensure SecondFactors=[] is disallowed.

* Upate terraform schema, docs, crds.

* Address comments.

* Address comments.

* Fix lint, fix test.
2024-10-11 00:02:39 +00:00
rosstimothy 1952dd8d24 Remove 2FA bypass (#47288)
v16 removed the ability to disable second factor authentication,
however, a bypass was left around to allow users to transition.
Starting in v17, the bypass will no longer work and all clusters
_must_ be configured with 2FA.
2024-10-08 15:15:21 +00:00
Yassine Bounekhla b30e1ace06 update support page (#46911) 2024-10-03 18:45:08 +00:00
matheus 6204578b68 Add LicenseAutoUpdate entitlement (#46959)
* Add LicenseAutoUpdate entitlement

* Update tests
2024-10-01 11:42:31 +00:00
Trent Clarke 736c86f88f Update AccessList Entitlement Enforcement to handle infinite limit (#44318)
* Update AccessList Entitlement Enforcement to handle infinite limit

The AccessList service was not correctly handling a zero-value limit
(i.e. an infinite limit) when checking to see if creating an
AccessList would breach the cluster Access List entitlement.

This patch:
 * Adds a centralized implementation of a limit check, so that we
   only have to get the calculation right once.
 * Tests for same
 * Updates the AccessList limit check to use the new limit check
 * Adds table-driven tests to exercise the limit check in various
   scenarios, replacing several almost identical tests.

* Review feedback
2024-07-18 06:40:46 +00:00
Michelle Bergquist c97533ed22 Surface entitlements to auth (#42932) 2024-07-09 16:04:48 +00:00
Michelle Bergquist 70b95e385d Surface Cloud Entitlements (#42394)
- Cloud entitlements are now available on Features
- Legacy logic applies if entitlements are not present
2024-06-28 00:22:13 +00:00
Jakub Nyckowski bfaa3340e8 Remove Assist (#42657)
* Remove assist feature

* Fix some tests

* Remove unused functions

* Fix ut

Remove more stuff
2024-06-10 20:57:05 +00:00
Alex McGrath 72f4a10366 Log information about second_factors removal at startup (#41416)
* Log information on second_factors removal at startup

* include upgrade instructions as a usermessage

* resolve comments
2024-06-05 20:56:07 +00:00
Michael b85d1a6e0e Include BuildCommunity in built type checks (#42391)
* Include BuildCommunity in built type checks

This commit will add two new methods to the modules interface,
IsEnterprise and IsOSS. This is to help alieviate any pain around the
code base that used to look specifically for BuildOSS. Now that we have
two "oss types" (oss and community), we can use these methods to do
enterprise/oss checks, rather than specifically looking at the build
type. This also will allow any future build types to not affect these
checks again in the future.

* Update e
2024-06-04 20:10:38 +00:00
Michael 265b58cb7e Apply new logos based on license (#41294) 2024-05-15 19:09:33 +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
ddbd9eefed Replace isTeam with new flags (#39794)
* Add new flags to modules

* Add deprecated comments to isTeam

* Make support flag an enum

* Add a TODO instead of deprecating flag right away

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

* Add gogoproto.jsontag to new fields

* remove meaning from enum zero value

* Reuse proto.SupportType instead of suping

* Replace isTeam for new flags in web app

* Update proto file: rename enum 0 value to unspecified;fix json tag casing

* Reuse proto file instead of aliasing it

* undo removing method by accident

* Add MobileDeviceManagement field to web config struct

* Improve comments

* Fix tests

* Simplify lockedFeatures object

* Include JoinActiveSessions in the web config object

* Remove more instances of isTeam

* Apply suggestions from code review - improve comments

Co-authored-by: Michelle Bergquist <11967646+michellescripts@users.noreply.github.com>

* Use consistent comments to remove isTeam

* Update godocs comments

* Revert removign `isTeam` from stories it still should

* Fix godoc typo

Co-authored-by: Michelle Bergquist <11967646+michellescripts@users.noreply.github.com>

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
Co-authored-by: Michelle Bergquist <11967646+michellescripts@users.noreply.github.com>
2024-04-30 11:54:17 +00:00
matheusandAlan Parra fad473a236 Add new flags to modules to replace isTeam (#39695)
* Add new flags to modules

* Add deprecated comments to isTeam

* Make support flag an enum

* Add a TODO instead of deprecating flag right away

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

* Add gogoproto.jsontag to new fields

* remove meaning from enum zero value

* Reuse proto.SupportType instead of suping

* Update proto file: rename enum 0 value to unspecified;fix json tag casing

* Reuse proto file instead of aliasing it

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2024-03-22 17:27:59 +00:00
rosstimothy 9734fcbdbd Convert SetSessionRecordingConfig usages to new Create/Update/Upsert API (#39249)
Migrates callers off the deprecated API and onto the new API so
that SessionRecordingConfig can be protected via optimistic locking
when appropriate.
2024-03-15 19:55:57 +00:00
rosstimothy 20888bf130 Convert SetAuthPreferences usages to new Create/Update/Upsert API (#38895)
Migrates callers off the deprecated API and onto the new API so that
AuthPreferences can be protected via optimistic locking when appropriate.
2024-03-14 22:05:20 +00:00
Brian Joerger 5577bdad45 Add e2e tests for Hardware Key support (#38994)
* Add fake yubikey private key implementation for tests.

* Add TestHardwareKeyLogin.

* Simplify Hardware Key support test plan.

* Enable piv test package in tests.

* Add TestMarshalAndParsePrivateKey.

* Address simple comments.

* Remove *testing.T from mockSSOLogin in; Add and use better helper methods for mocking sso login.

* Refactor test to dynamically set mock attestation data; revert related changes.
2024-03-07 21:37:21 +00:00
Brian Joerger 328986789e Hardware key serial number attestation (#37728)
* Add support for hardware key serial number attestation through user
trait.

* Modify AttestHardwareKey interface to return full attestation data

* Add serial number to attestation data and verify it

* Add unit test.

* Address comments.

* Don't accept partial matches.

* Fix build and test errors.
2024-02-10 01:07:58 +00:00
Justinas Stankevičius 9bcde33d49 Add Teleport Policy feature (#37013)
* Add Teleport Policy feature flag

* Add Policy feature to License

* Make `Policy` field a structure

To accomodate potential future parameters
2024-01-24 17:03:42 +00:00
Lisa Kim 36b3deab6e Lift legacy check for Access List and Access Monitoring (#35702)
* Revert "Restrict IGS flag check to usage based plans only (#35431)"

This reverts commit 31e1715532.

* Update test

* Pass access request monthly limit to webconfig

* Fix typo
2023-12-21 01:45:16 +00:00
Grzegorz ZdunekandJakub Nyckowski 32e87b2779 Expose GetSuggestedAccessLists in AccessListClient (#35714)
* Expose `GetSuggestedAccessLists` in `AccessListClient`

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

* Fix typo

---------

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>
2023-12-18 15:33:23 +00:00
Lisa Kim b7b1e13eab Audit use of usageBased flag in backend (#35341)
* Audit use of usageBased flag in backend

* Remove IsTrialProduct from feature object

* Address cr
2023-12-06 23:02:47 +00:00
Lisa Kim 31e1715532 Restrict IGS flag check to usage based plans only (#35431)
* Restrict IGS flag check to usage based plans only

* Remove unused func
2023-12-06 17:40:07 +00:00
Lisa Kim ba2bdb9d66 Define access monitoring max range limit field (#35241)
* Define max report range limit fields

* Add feature limits to web ui config
2023-12-05 20:28:55 +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
Lisa Kim ee32982679 Add ProductType to features and add IGS checks with access request verify limit (#35075)
* Add product type to features and define feature limit helpers

* Add IGS check with access request monhtly verify

* Move limit getters to enterprise

* Simplify product type conversion

* Add clarifying comment
2023-11-30 22:04:48 +00:00
Lisa Kim 6ade117e9a Adds IGS related fields to feature, module, and license objects (#34868)
* Revert "Deprecate field AdvancedAccessWorkflows to AccessRequest.Enabled (#34792)"

This reverts commit 79d1a5d16e.

* Add IGS related fields to features and modules

* Boiler plate for enabling access monitoring through modules

* Add IGS related license fields

* Use access monitoring feature flag instead

* Fix test

* Add backwards comp without deprecating field

* Address CR

* Address CR
2023-11-27 18:22:49 +00:00
Lisa Kim 79d1a5d16e Deprecate field AdvancedAccessWorkflows to AccessRequest.Enabled (#34792)
* Deprecate AdvancedAccessWorkflows proto field

* Remove AdvancedAccessWorkflows feature module field

* Rename fields

* Rename fields for all plugins

* Test ping proto response

* Address CR
2023-11-21 18:59:02 +00:00
Jakub Nyckowski af817583ad Proxy TAG requests through Auth (#34642)
* Proxy TAG requests through Auth

* Integrate Access Graph feature and optimize services

This commit entails the integration of the Access Graph feature into the existing service configuration. This feature is manifested through an 'IsEnabled' method that checks the state of the access graph. Additionally, the auth service logic now includes a flag for enabling access graph. The services have been further optimized with adjustments geared towards improving performance and readability of the code.

* Move TAG enabled flag from proxy to user setting/auth context

* Swap a pointer to AccessGraph config with a value.

* Add 'TestNewAccessGraph' function to 'useracl_test.go' file.

The function 'TestNewAccessGraph' has been added to run tests checking the configuration of Access Graph. Furthermore, a small change is made for the 'KindAccessGraph' comment in 'constants.go' to provide more accurate information.

* Implement Access Graph feature across various files

The Access Graph feature has been incorporated in 'module.go', 'authservice.proto', 'auth.go', and 'plugin.go' files. A method 'EnableAccessGraph' is also introduced in 'module.go' to allow the usage of this feature. Descriptions of Access Graph have been adjusted across files to explicitly state the feature's enablement.

* Fix tests

* Remove unused access graph feature code

This commit removes all references and uses of the access graph feature from the codebase. It also updates corresponding tests to reflect this removal. It also adds EnableAccessGraph() method to testing module to fix test compilation.
2023-11-16 18:08:37 +00:00
Michael Wilson 590435c1e2 Allow user locks to affect access list membership. (#34354)
* Allow locks to deny access to access lists.

Access list membership will now be impacted by active user locks. If a user
is locked, they will not be considered a part of an access list. This, in turn
will be used for things like Okta assignments to ensure that Okta access can be
rescinded while a lock is active.

* Access list membership checker is its own struct now.

* Rebase and fix tests.
2023-11-15 15:24:07 +00:00
Marek Smoliński f3545eba3f Security Reports (#30853) 2023-10-16 10:11:54 +00:00
rosstimothy 84e1be110a Complete services.Users interface refactoring (#33233)
* Update e ref

* Complete services.Users interface refactoring

Removes temporary functions required to migrate the interface
without breaking e.

Closes #32949.
2023-10-10 19:56:42 +00:00
rosstimothy b60ea81d54 Update users interface (#32987)
services.UsersService now takes a context and returns the user
from write operations as shown in the diff below. The bulk of the
changes are from modifying code to account for the additional
parameter and/or return value. Functional changes to better make
use of the new API will come in follow up PRs.

```diff
// UserGetter is responsible for getting users
type UserGetter interface {
	// GetUser returns a user by name
-	GetUser(user string, withSecrets bool) (types.User, error)
+	GetUser(ctx context.Context, user string, withSecrets bool) (types.User, error)
}

// UsersService is responsible for basic user management
type UsersService interface {
	UserGetter
	// CreateUser creates user, only if the user entry does not exist
-	CreateUser(user types.User) error
+	CreateUser(ctx context.Context, user types.User) (types.User, error)
	// UpdateUser updates an existing user.
-	UpdateUser(ctx context.Context, user types.User) error
+	UpdateUser(ctx context.Context, user types.User) (types.User, error)
	// UpdateAndSwapUser reads an existing user, runs `fn` against it and writes
	// the result to storage. Return `false` from `fn` to avoid storage changes.
	// Roughly equivalent to [GetUser] followed by [CompareAndSwapUser].
	// Returns the storage user.
	UpdateAndSwapUser(ctx context.Context, user string, withSecrets bool, fn func(types.User) (changed bool, err error)) (types.User, error)
	// UpsertUser updates parameters about user
-	UpsertUser(user types.User) error
+	UpsertUser(ctx context.Context, user types.User) (types.User, error)
	// CompareAndSwapUser updates an existing user, but fails if the user does
	// not match an expected backend value.
	CompareAndSwapUser(ctx context.Context, new, existing types.User) error
	// DeleteUser deletes a user with all the keys from the backend
	DeleteUser(ctx context.Context, user string) error
	// GetUsers returns a list of users registered with the local auth server
-	GetUsers(withSecrets bool) ([]types.User, error)
+	GetUsers(ctx context.Context, withSecrets bool) ([]types.User, error)
	// DeleteAllUsers deletes all users
-	DeleteAllUsers() error
+	DeleteAllUsers(ctx context.Context) error
}
```

Depends on gravitational/teleport.e#2346
Implements step 3 of #32949
2023-10-10 14:07:46 +00:00
rosstimothyandEdoardo Spadolini 6874bc1844 Start migrating services.UserService to use context and return users (#32920)
* Start migrating services.Identity to use context and return users

Adds new variants of existing methods that are going to be updated
to support propagating context and return users from create, update
and upsert. This is an unfortunate step required because e utilizes
the interface for various functionality. In order to prevent breaking
builds, the temporary methods were added so that e can be converted
to them first, then oss can be updated to the new version of the
interface. Once that is done e will be converted and then the temp
methods will be removed.

* fix typos in comment

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

* fix: don't set metadata on existing item in CAS

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

* fix: gci

* fix: set resource id on update

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2023-10-09 17:11:39 +00:00
Jakub Nyckowski 21772c6c9c Add new methods to AccessResourcesGetter interface (#32805) 2023-10-02 16:08:59 +00:00
Jakub Nyckowski f9c419674c Generate access list allowed promotions on access request creation (#31768)
* Generate access list suggestions on access request creation

* Add test
Cleanup code

* Add comment

* Fix typo and refactor access suggestion in services library

Fixed a typo in a comment in `access_list.go`. Refactored `accessrequest/suggestion.go` for enhanced code structure. The old model had all methods related to access request in a single interface, `accessRequestAPIGetter`, which had been divided among multiple interfaces for better division of responsibilities. A new function `GetSuggestedAccessLists` was created to narrow down the single duty for each function. These changes ensure more convenient unit testing and better accountability.

* Improve access request suggestions logic

This commit improves the logic for generating access request suggestions. It includes the requester's roles and traits as well as those from the access list and provides suggestions only for resource-based requests. A new method was also introduced for initializing AccessRequestSuggestions to avoid nil error.

* Refactor access list suggestions to promotions

The concept of 'suggestions' was updated to 'promotions' in different files (auth.go, client.go, auth_service_test.go, auth_service.proto among others) to make it more intuitive and align with the business context. This implies changing the wording, the functions called and the variable names. The feature itself hasn't changed, just the way it is referred.

* This commit changes the method name "GenerateAccessListSuggestions" to "GenerateAccessRequestPromotions" in multiple files. The naming is changed to reflect the actual function of the method, which is generating promotions for given access requests, rather than generating list suggestions. All relevant mentions and usages of this method are updated to reflect the name change. Modification also includes adjustments to the comments and interfaces related to the updated function for better code clarity.

* Refactor "GenerateAccessListSuggestions" to "GenerateAccessRequestPromotions"

Renamed method "GenerateAccessListSuggestions" to "GenerateAccessRequestPromotions" across the codebase. This change reflects the actual functionality of the method, which is to generate promotions for access requests, not suggestions. This aligns the method name with its purpose, and offers better code readability. Comments related to this function were also updated to maintain consistency.

* Update method handling access requests promotions

Revised the method of handling failures when generating access requests promotions. Now, even if promotions fail to generate, the request will not fail entirely. Instead, the request can still be approved but without promotions. Also, changed the UpsertAccessRequestAllowedPromotions method to CreateAccessRequestAllowedPromotions to clearly indicate its purpose, while revising related test cases and comments.
2023-09-22 19:34:32 +00:00
Marco André Dinis 859898635f Use Amazon EICE to connect into EC2 instances (#30632)
* Use Amazon EICE to connect into EC2 instances

This PR adds a new method to SSH into EC2 instances.
It uses the Amazon EC2 Instance Connect Endpoint to do so.

You can read more about the capabilities/limitations of this feature
here
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-using-eice.html

From the Teleport point of view, this uses the AWS OIDC Integration to
call the AWS APIs.
This connection mode is similar to the Agentless mode, where Teleport
connects to the OpenSSH daemon on the target server.
Except, that with this mode there's no required set up on the target
machine (no CAs are being used).

An overview of the flow when the user tries to SSH into a node:
- an SSH Public Key is sent to the target EC2 Instance
- a connection is made to the EC2 Instance Connect Endpoint using
  websockets, which in turn pipes the connection to the Private IP of
  the EC2 Instance

* review pt1

* pass CA for tests

* add godocs to OpenTunnelEC2

* fetch proxy public address jit

* add docs and move key generation to native package

* remove tcp socket
2023-08-24 16:38:51 +00:00
Yassine Bounekhla 62e910c2c5 add custom theme and logos (#30823) 2023-08-23 18:17:11 +00:00
Justinas Stankevičius 96f3df96b1 Enable limited Access Requests feature for the Team plan (#29866)
* Add access request monthly limit to Features

* Add a method to retrieve usage of Access Requests

* Verify access request limit when creating

* Remove AccessRequestsFeature.Enabled

Feature is always enabled now, the flag serves no purpose

* Expose usage of access requests in auth server

* Reimplement access request usage using audit log

* Disallow unauthenticated access to resource usage

* Tidy proto structures

* Start enforcing access request limit in auth

* Run GCI

* Add a license header to usage_test.go

* Add missing godoc

* Restructure usage proto per PR comments

* Construct proto.AccessRequestUsage in getARMU

* Reduce log level when encountering an unexpected event

* Simplify return

* Add godoc to GetResourcesUsage in client

* Fix merge mess-ups

* Count all requests, no matter their review state

* Factor out GetAccessRequestMonthlyUsage

* Move out resource usage to its own service

* Validate the limit after dry run is done

Unbreak UI when the limit is up

* Fix imports

* Remove Limit

SearchEvents will default to defaults.EventsIterationLimit

* Rename the service proto

* Add godocs to the gRPC service

* Move resource usage to a dedicated package

* Define single GetUsage rpc for all resource types

* Additions for limited access requests UI rework

* Add a test for GetAccessRequestMonthlyUsage

* Address lint

* Run GCI

* Add licenses where missing

* Expect CTA_UNSPEICIFED rather than `undefined`

* Expect CTA_UNSPECIFIED instead of undefined
2023-08-16 17:20:34 +00:00
Yassine Bounekhla c9a8288920 add feature hiding license flag (#30083) 2023-08-15 20:56:33 +00:00
Alan Parra 9d7f553bf3 Add usage-based feature values for Device Trust (#28919)
* Add DeviceTrustFeature to Auth protos

* Update generated protos

* Add DeviceTrustFeature to modules.Features
2023-07-11 17:25:00 +00:00
Jakub Nyckowski ae8f2fa929 Assist - Configuration and usage (#25953)
* Assist - Configuration and usage

* Add network config test

* Add config test

* Run GCI

* Address review comments
2023-05-11 01:56:55 +00:00
matheus e5c0992809 Add SetFeatures method to modules (#24729)
* Add SetCloudFeatures method to modules

* Implement missing method on test module

* Small refactors to adress code review

* Lint fix
2023-05-04 15:04:47 +00:00
matheus 57690ee961 Add IsUsageBased to features and send it to web UI (#25465)
* Add IsUsageBased to features and send to web UI

* Update flag name

* Improve comment

* Add comments and improve field name

* Remove duplicated property
2023-05-04 14:57:48 +00:00