Commit Graph
342 Commits
Author SHA1 Message Date
rosstimothy b0dc78610e Migrate upserting CAs to gRPC (#23140)
Adds `UpsertCertAuthority` to the `teleport.v1.trust.TrustService`
and deprecates the HTTP api. The `services.Trust` interface was
also updated to include a `context.Context` in both
`CreateCertAuthority` and `UpsertCertAuthority.

To ensure backwards compatibility the `auth.Client` will first
attempt to use the gRPC client and if that fails with a not
implemented error it will fallback to using HTTP.

Part of #6394
2023-03-16 14:46:43 +00:00
Mike Jensen eafa23404e Update crypto fork to v0.6.0-1 tag (#22564)
This tag includes the most recent updates from the upstream in order to address recently fixed CVE's.
Changes included: https://github.com/gravitational/crypto/compare/903e65687e59...c3f983bc73dcf711908e49d91bda9cffbecb13cd

In addition this adds `utils/bcrypto.go` to restore the prior crypto behavior of truncating input > 72 chars.
This commit in Crypto breaks functionality with long passwords or more commonly our reset tokens which are > 72 characters: https://github.com/gravitational/crypto/commit/bc7d1d1eb54b3530da4f5ec31625c95d7df40231
As described in the commit message, the prior behavior was to ignore the extra data.  Since 72 bytes are plenty of data to prevent brute force attacks, there is not a significant need to report this error to the user.
2023-03-15 16:05:13 +00:00
rosstimothy f02468e9fb Migrate the delete ca api to gRPC (#23070)
Adds `DeleteCertAuthority` to the trust grpc service and deprecates
the legacy HTTP api. Additionally the `DeleteCertAuthority` method
in the `services.Trust` interface now takes a `context.Context` as
the first parameter. In order to plumb the context through from all
the call sites `DeleteRemoteCluster` from `services.Presence` was
also modified to take a `context.Context` as the first parameter.
2023-03-15 13:11:37 +00:00
Michael Wilson 8f628084d5 Introduce the Okta service. (#22899)
The Okta service and client have been introduced. This will allow for the
maintenance of Okta objects via our gRPC server and auth client. Some
additional improvements have been made so that the local okta service now
better reflects the gRPC definition.

Additionally, the gRPC authorization mechanism has been lifted out of
`lib/auth/grpcserver.go` and moved into a common authorizer. Finally, the
ability to check access to verbs has been lifted out of the `pluginsv1`
service into that same authorizer. This will hopefully provide a good base
for separate gRPC services in the future.
2023-03-14 16:25:22 +00:00
rosstimothy 9d066364a8 Migrate GetCertAuthorities to gRPC (#22985)
Adds a new `GetCertAuthorities` unary RPC to
`teleport.v1.trust.TrustService` and deprecates the equivalent
HTTP endpoint. All associated interfaces have been updated to remove
the marshal options as well.
2023-03-14 14:45:01 +00:00
Brian Joerger 51a511bcaf Headless Login: add headless authentication resource watcher (#22699)
* Add headless authentication resource watcher.

* Handle OpInit event and Watcher errors.
2023-03-13 19:44:25 +00:00
Tiago Silva 674a3a1ec1 Removes deprecated KindKubeService objects (#22663)
This PR removes the `types.KindKubeService` objects that were
deprecated in Teleport 11.

Teleport 12 removed the double heartbeat and for Teleport 13 we can
safely drop the support of the old hearbeat based on `types.Server`
objects.

Clients older than Teleport 12 connecting to a Teleport 13 server will
fail since they cannot heartbeat using the old mechanism.
2023-03-13 10:55:39 +00:00
rosstimothy 95d6d0fee1 Migrate GetCertAuthority to gRPC (#22624)
The HTTP client created by `auth.NewClient` has an idle timeout of
30s and each instance periodically gets cert authorities in
`TeleportProcess.syncRotationStateCycle`. If there has been no
activity when the ticker expires then the request will result in a
brand new connection to Auth to be established. This can cause a
spikes in open file descriptors on the Proxy when there are a large
number of instances connected via a tunnel.

To prevent periodic dialing when retrieving cert authorities the
endpoint has been migrated to the new Trust gRPC service. For now
only the get endpoint has been migrated but the rest of the CRUD
operations for cert authorities should be migrated from the HTTP
api to the gRPC service as well.
2023-03-10 14:32:34 +00:00
Brian Joerger a8e46a988c Add Headless Authn backend service. (#22553) 2023-03-07 18:56:11 +00:00
Michael Wilson 9331ef85a9 Okta local service. (#22434)
* Okta local service.

A new local service has been created for the Okta import rule and Okta
assignment objects.

* Test tweaks for easier readability and diagnosability.
2023-03-01 20:35:25 +00:00
MichaelandJeff Pihach d94fed7b0d Add static and dynamic web ui configuration options (#21945)
* Add UiConfig option to proxy service config

* Add uiConfig to GRV_CONFIG window object and use in terminal constructor

* Update configuration reference docs

* Remove extra structs and change property to scrollbackLines

* Update web/packages/teleport/src/config.ts

Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>

* Use a common struct and apply in applyProxyConfig

* Remove webclient dependency for fileconf

* Add missing doc comments

* Set individual properties of cfg.Proxy.UI

* Remove unneeded comment

* Add nolint rule

* Fix nolint

* Add test for UIConfig

* Cleanup tests

* Fix TestUIConfig context

* Allow dynamic config for web ui (#22097)

* Update protofiles

---------

Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>
2023-02-28 17:45:52 +00:00
Michael Wilsonandrosstimothy d530f33b5c Create a generic local backend service. (#21078)
* Create a generic local backend service.

Many of the local backend services have a very similar pattern in terms of how
objects are retrieved and stored. This PR introduces a generic backend which
implements backend retrieval and storage of objects and migrates the SAML
IdP service provider service to it. More services could easily be migrated
to this generic service implementation.

* Feedback, add in generic tests.

* Tim's feedback, added in a test for updating a resource that doesn't exist.

* Tim's feedback.

* Apply suggestions from code review

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

* Edoardo's feedback.

* Added in UpdateAndSwap.

* Edoardo's feedback, Tim's feedback.

* Use a default page size if the page limit is not specified.

* More of Edoardo's feedback.

* Propagate error instead of panic.

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2023-02-24 15:59:16 +00:00
d89879c2f5 Add gRPC service definition for Plugin resources (#21750)
* Add plugin exchange service

* Add Plugin methods to auth

* Add gRPC-layer methods for Plugin

* Add RBAC presets for Plugin

* Test GetPlugin()/NoSecrets access

* Make error assertions more correct in role test

* Deny setting credentials if user can not read them

* gofmt

* Apply minor suggestions from code review

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>

* Move dependency into an existing block in go.mod

* Improve error messages for failed type assertions

* DRY WithSecrets access checks for Plugins

* Run new tests in parallel

* Improve error assertions in auth_with_roles_test

* TestGetPluginWithSecrets: split cases to subtests

* Clean up test servers and clients

* Add proto for plugin service

* Remove Plugin methods from auth service

Moved to a dedicated service

* Remove plugin-related auth methods

Moved to a dedicated service in Enterprise

* Remove CreatePlugin test from auth_with_roles_test

Moved to a dedicated service in Enterprise

* Pass "backend getter" to local plugins service

This pattern is used in Enterprise to set up secondary services
before auth (and backend) are created.

* Rename InitialCredentials to BootstrapCredentials

* Add plugins service to genproto.sh

* Reformat generated proto

* Remove obsolete PluginExchangeService

The equivalent of this is now in Enterprise

* Add kube service to genproto.sh; regenerate

* Add ListPlugins to plugin backend service

* Reimplement GetPlugins on top of ListPlugins

This is a "convenience" implementation for the backend service layer.

* Replace GetPlugins with ListPlugins in gRPC schema

* Fix ListKubernetesResources unit test

* Simplify plugin pagination key to just the name

* Use existing constant for page size

* Make dummy clients return errors instead of panic

* Remove obsolete field

* Ensure go.mod is valid for corresponding e changes

* Fix passing mutex ref

* Move teleport-plugins import to e_imports

* Revert oauth change in go.mod

* Use limit+1 to look-ahead when paginating plugins

* Test plugin pagination with pageSize > numPlugins

* Add descriptive messages to gRPC dummy clients

* Plugin: add RW for editor; remove secrets from gRPC

* Make message more descriptive for dummy gRPC conn

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
2023-02-23 14:32:41 +00:00
Michael Wilson 9527b6518c User group API and cache. (#21956)
The user group has been added to the API and to the cache.
2023-02-22 18:45:11 +00:00
rosstimothy 920261cd1f Add DatabaseService KeepAlive type (#22042)
The DatabaseService was using the KeepAlive_Database type instead
of a new dedicated type. This caused the keepalive to fail because
the backend key that was created didn't actually exist which results
in #21454.

This adds the appropriate KeepAlive type and uses it in the appropriate
places.

Fixes #21454
2023-02-21 14:55:06 +00:00
rosstimothy 9f62e75cbd Ensure UpdateRemoteCluster updates all fields (#22024)
The ConnectionStatus of the RemoteCluster resource was never being
set in UpdateRemoteCluster causing the backend to always contain
the original value. GetRemoteCluster, unfortunately, does an update
of the resource, yet it always returned the correct information, which
made things very confusing since `tctl get` didn't reflect the
actual backend. To make matters worse the initial value was not
explicitly set which meant it defaulted to an empty string.

A call to SetConnectionStatus was added to UpdateRemoteCluster so
it's value is actually persisted. Trusted Clusters are also now
explicitly initialized with status offline to avoid ambiguity. The
actual status of the resource will be updated appropriately when
the tunnel connections are verified.

Additionally TestRemoteClustersCRUD was added to capture this issue
and prevent any regressions.

Fixes #22006
2023-02-17 21:10:19 +00:00
Michael WilsonandRoman Tkachenko 383ad7a5de SAML IdP session objects. (#21521)
* SAML IdP session objects.

The upcoming SAML IdP feature requires session storage in the backend. To
support that, the `WebSession` that has been adapted for app sessions and
Snowflake sessions has been adapted for SAML IdP sessions.

The SAML IdP will be encoding the session structure as JSON and packing it
into the new `data` field within the web session.

* Update api/types/session.go

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

* Use specific structure instead of a JSON blob.

* Update the create SAML session request.

* Make SAML session a pointer.

* Add in link to crewjam/saml object.

---------

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2023-02-13 19:52:33 +00:00
Michael Wilsonandrosstimothy 70833b6b3f Initial user group object. (#20848)
* Initial group object.

The group object has been added to support the Okta appaccess integration
feature. Please see https://github.com/gravitational/teleport.e/pull/609
for more information.

The local service for handling backend management of the group objects has
been added as well. This will be expanded upon in a later PR.

* Rename group to usergroup.

* Linting fixes.

* Remove unnecessary functions.

* Add user groups to test parse shortcut.

* Apply suggestions from code review

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

* Update lib/services/local/usergroup_test.go

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

* Fix AsResources in usergroup.

* Apply suggestions from code review

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

* Update lib/services/local/usergroup.go

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

* Fix return in usergroup service.

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2023-02-10 16:21:17 +00:00
Noah Stride 0181993047 Allow the creation and usage of expiryless ProvisionTokens (#21133)
* Allow the creation and usage of expiryless tokens

* Tidy up loose ends

* Fix imports

* Add tests for changes to expiryless behaviour

* Use new RPCs for new expiryless behaviour

* Add tests for new RPCs

* Remove unused import

* Recreate behaviour for tokens expiring in past

* Missing NoError check int ests

* Correctly americanize behavior
2023-02-10 13:45:36 +00:00
Michael WilsonandEdoardo Spadolini d29cc6e797 Extract entity ID when creating SAML service provider. (#21375)
* Extract entity ID when creating SAML service provider.

The entity ID will be parsed from the entity descriptor metadata when the
service provider's entity descriptor is set. The motivation of this PR is to
do the following:

* Extract the entity ID from the entity descriptor during the creation of the
  SAML IdP service provider.
* Prevent the creation of service providers in the backend that have an
  entity ID that does not match the entity ID represented in the entity
  descriptor.
* When reading or listing service providers, prevent the parsing of every
  entity descriptor during the listing.

The goal here is to make it performant to look up entity descriptors by their
entity ID without incurring the cost of parsing every single entity descriptor
to determine the entity ID.

* Feedback, eliminating the parsing from the object, pushing parsing verification into the local service.

* Fix up tests, e_imports.

* Fix comment in types.proto.

* Remove dead comment.

* Deduplicate entity ID in update as well.

* Small refactor to move parse out of lock.

* Remove XML parsing from type, fix grpcserver test, fix locking boundaries.

* Tim's and Edoardo's feedback.

* Fix cache test.

* Update lib/services/local/saml_idp_service_provider.go

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

* Expanding the comments on the EntityID field.

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2023-02-09 21:06:41 +00:00
Michael Wilsonandrosstimothy d619d303db Add SAML IdP service providers to the cache and CLI. (#21218)
* Add SAML IdP service providers to the cache and CLI.

SAML IdP service providers have been added to the cache and are now manageable
via the CLI. Some alterations to role permissions have occurred to ensure that
the system and users can manage these.

* Tiago's feedback.

* Update tool/tctl/common/collection.go

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

* Tim's feedback.

* Update lib/cache/collections.go

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

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2023-02-08 17:01:10 +00:00
Justinas Stankevičius 49dca5a706 Add service for "plugin" resources (#21210)
* Add Plugins service

* Add tests for local plugins service

* Remove validation calls from service

These are already invoked by MarshalPlugin

* Separate concerns of local Plugins service

Credentials will be exchanged by the auth server,
so there is no need to have proto.CreatePluginsRequest
in the service layer.

Proto types will be reintroduced in a later PR
covering the auth server changes.

* Rename method to better reflect purpose

* Run GCI
2023-02-07 15:34:20 +00:00
Marco André Dinis 2576781f78 DatabaseService: move Upsert op to DBServicesService (#20930) 2023-01-31 07:40:25 +00:00
Michael Wilsonandrosstimothy 0caf51d6b6 Initial SAML IdP service provider object. (#20774)
* Initial SAML IdP service provider object.

The SAML IdP service provider object has been added to support the use of
Teleport as a SAML identity provider. Please see
https://github.com/gravitational/teleport.e/pull/668 for more information.

The local service for handling backend management of the SAML IdP
service provider objects has been added as well. This will be expanded upon
in a later PR.

* Fix imports.

* Copy paste error.

* Update api/types/saml_idp_service_provider.go

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

* Update api/types/saml_idp_service_provider.go

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

* Update lib/services/local/saml_idp_service_provider.go

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

* Use errAssertionFunc, paginate service provider resources.

* Marco's and Tim's feedback.

* Update proto comments.

* Update NewSAMLIdPServiceProvider comment.

* Fix linting, test issues.

* Remove unnecessary functions already given by ResourceHeader.

* Apply suggestions from code review

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

* Fixes, removal of explict getter for service provider.

* Remove unnecessary functions.

* Update api/types/saml_idp_service_provider.go

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

* Linting fix.

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2023-01-30 20:04:21 +00:00
Brian Joerger ccff88c282 Fix key attestation error on tsh login (#20314) 2023-01-24 17:57:55 +00:00
Ryan ClarkandForrest Marshall 87abbb8e49 Alert ack API + CLI implementation (#19480)
Co-authored-by: Forrest Marshall <forrest@goteleport.com>
2023-01-24 17:30:07 +00:00
Edward Dowling 3cd847e3ff Allow updating of trusted cluster role maps (#18168) 2023-01-13 19:06:17 +00:00
Tiago Silva 40861809a6 Add RoleV6 resource type (#19324)
This PR includes a new Role resource version that is compatible with V5 spec.

The new resource introduces the `kubernetes_resources` definition that allows operators to limit the Kubernetes resources that each member can access. The `kubernetes_resources` entries must follow the following format: `{"kind":"<kind>", "namespace":"<namespace>","name":"<pod>"}`. Currently, it only supports objects of `kind` `pod`. Valid examples `<namespace>/<name>:
- `*/*`: matches all pods in all namespaces.
- `default/*`: matches all pods in the `default` namespace.
- `*/nginx-*`: matches every pod prefixed with `nginx-` in every namespace.

For older resource versions - V5, V4, V3 - `kubernetes_resources` is automatically populated with `{"kind":"pod","namespace":"*","name":"*"}` to keep compatibility. For the newest version, it's mandatory to define its value otherwise access to pods will be denied.

Part of #18434
2023-01-05 09:58:12 +00:00
Forrest Marshall ecef3465b6 instance heartbeats 2022-12-30 12:09:11 -08:00
Grzegorz Zdunek ea9530d3ad Make UsageReporter reusable (#19378) 2022-12-30 18:24:44 +01:00
Marco André Dinis adcdc2459f Add DatabaseService heartbeat (#19570)
n the context of Teleport Discover, we must be able to known if there's any DatabaseService available to proxy a given Database resource.
If there's none available, we will offer a script for the user to run and install a DatabaseService which proxies the desired Database resource.

By DatabaseService, we mean the process that Teleport binary manages when the `teleport.yaml` config has the following section:
```yaml
db_service:
  enabled: "yes"
```

To accomplish this we are creating a new resource: DatabaseService.
The UI will fetch all DatabaseServices and check if there's any ResourceMatcher that matches the DatabaseLabels.

Previous PRs created the DatabaseService resource and its CRUD methods.

This PR adds an heartbeat for DatabaseServices similar to what we have for Databases.
There's also a new command to list DatabaseServices using `tctl`:
```
$ tctl get db_service --format text
Name                                 Resource Matchers                      
------------------------------------ -------------------------------------- 
a6065ee9-d5ee-4555-8d47-94a78625277b (Labels: <all databases>)              
d4e13f2b-0a55-4e0a-b363-bacfb1a11294 (Labels: env=[prod],aws-tag=[xyz abc]) 
```


Test using Teleport Cloud
```
dinis@lenix ~/p/cloudagents> tctl get db_services
kind: db_service
metadata:
  expires: "2022-12-21T18:05:10Z"
  id: 1671645310983808522
  name: 2a28d394-900c-42ea-a120-eed918e4526b
spec:
  resources:
  - labels:
      aws-tag:
      - xyz
      - abc
      env: prod
version: v1
dinis@lenix ~/p/cloudagents> tctl status
Cluster  marcoacme.cloud.gravitational.io                                        
Version  12.0.0-dev 
```

Part of #19032
Related #19363 #19469
2022-12-22 09:19:02 +01:00
Marco André Dinis 69dc237fe2 DatabaseService resource: client and server CRUD (#19469)
* DatabaseService resource: client and server CRUD

In the context of Teleport Discover, we must be able to known if there's
any DatabaseService available to proxy a given Database resource.
If there's none available, we will offer a script for the user to run
and install a DatabaseService which proxies the desired Database
resource.

By DatabaseService, we mean the process that Teleport binary manages
when the `teleport.yaml` config has the following section:
```yaml
db_service:
  enabled: "yes"
```

To accomplish this we are creating a new resource: DatabaseService.
The UI will fetch all DatabaseServices and check if there's any
ResourceMatcher that matches the DatabaseLabels.

A previous PR created the DatabaseService resource.

This PR creates all the necessary CRUD operations:
- Add Service to manage DatabaseServices resources in the backend.
- Add GetAll, Upsert, Delete and DeleteAll operations to Client.
- Add DatabaseService support to ListResources.
- Add WebAPI endpoint to list DatabaseServices using ListResources.

The next PR will add the heartbeat mechanism to the DatabaseService
process.
2022-12-21 14:34:36 +01:00
Tobiasz Heller 77e10d6ff0 Replace deprecated duo-labs/webauthn with go-webauthn/webauthn (#19476) 2022-12-19 18:07:30 +00:00
Tim Buckley 86c568a475 Add GetEmitter() to allow proper emitter wrapping for PreHog (#19356)
* Add `GetEmitter()` to allow proper emitter wrapping for PreHog

This is part of a fix for the PreHog usage reporter to resolve a bug
where an improper emitter implementation was wrapped, potentially
replacing a valid set of emitters. A new `GetEmitter` function is
added to `Server` to allow fetching of the correct implementation
so it can be wrapped overwritten sensibly.

Additionally, this changes the signature of `UsageLogger.New()` to
require just an `events.Emitter` interface rather than an `IAuditLog`
specifically.

Finally, this fixes a small bug in the PreHog submitter where failed
events were accidentally dropped too early.

* Add godoc for GetEmitter/SetEmitter

* Add warnings to godoc for SetEmitter and SetUsageReporter
2022-12-14 18:03:44 +00:00
Lisa Kim f8e81e67b0 Remove use of legacy reset password token prefix (#19285)
* Sneak in grammar fix
2022-12-12 23:51:16 +00:00
Tim Buckley a453df4fc5 Drop usage events after too many retries (#19223)
* Drop usage events after too many retries

This change adds a retry counter to individual events (5) and drops
them after too many failures. If an event is malformed and can never
be submitted, or if the backend is down for an extended period of
time, events are dropped instead of generating excessive log spam.

Additionally, only failed events are resubmitted rather than entire
batches as some events may have submitted successfully.

Also, a few log messages are revised.

* Remove `dropped` since we can calculate all the info we need

* Fix lints
2022-12-09 03:29:10 +00:00
rosstimothy 1a172c6dd7 Add proto.AuthService/ListAppSessions (#19171) 2022-12-09 01:15:53 +00:00
fba02d9f9d Add a new usage reporter (#18142)
* [draft] Add a new usage reporter

This adds a new usage reporter service to the auth server. It's
disabled by default in OSS and can only be turned on via startup hook
in Cloud / Enterprise. In OSS, the audit log wrapper is never
configured and any usage events are sent to a no-op discard reporter.

Usage events are defined in prehog and can be sent to the new
UsageReporter Service on the auth server. An audit event wrapper is
used to capture certain events that are otherwise difficult to hook.
Events are anonymized before submission, then held in a non-blocking
queue for batching and submission purposes.

* Remove dead code

* Add SubmitUsageEvent RPC to Auth.

This adds a new SubmitUsageEvent RPC to the Auth API that external
clients (e.g. the UI) can use to submit usage events externally.

* Slight refactor for unit testing

* Add Prometheus metrics and add initial working prehog submitter

* Add more metrics, tweak prehog client, and add unit tests

* Further tweak http transport settings based on Teleport defaults

* Add missing metrics

* Fix goimports

* Add new UI usage events

* Update e ref

* Add prehog directly for now. Improve logging.

* update prehog

* Add new prehog events; use username from request identity

* add HTTP server for user events

* Add username back to pre-onboard events

* unauthenticated user events

* Fix userevent build error

* Use event-provided username where appropriate

* Move barebones prehog reqs to lib/prehog and generate here.

Also, use prod tunable values.

* Fix license lints

* De-flake tests by adding unfortunate amounts of synchronization.

* Add missing license header

* Misc PR cleanup for review

* Update lib/events/usageevents/usageevents.go

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

* Address a batch of review comments

Adds `anonymizer.AnonymizeString` and parent loggers

* Update e ref

* Clean up comments

* Remove onboard prefix from recovery code event

* Address another batch of feedback

* Use defaults.HTTPClient()

* Remove a noisy log message

* Demote noisy log message to debug

* Temporarily revert e ref for merge

Co-authored-by: Michelle Bergquist <michelle.bergquist@goteleport.com>
Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2022-12-05 17:13:54 +00:00
STeve (Xin) Huang 72b5a2f81f Add extra database validations to CreateDatabase (#18776) 2022-11-25 16:12:53 +00:00
Zac Bergquist da7680ad0b Use x/exp/slices instead of home grown utilities (#18524)
We were inconsistent throughout the codebase and would sometimes
use the slices package and other times use our own equivalents
in api/.

This removes our versions in favor of the golang.org/x package that
does the same, which has the added benefit of reducing the surface
area of the public API module.

Note: despite existing uses of the slices package, for some reason
it didn't show up in go.mod or go.sum. Fixed that too.
2022-11-17 15:25:46 +00:00
rosstimothy b5db7001f7 Prevent terminated types.SessionTracker from lingering (#17981)
Transitioning to terminated didn't have any impact on the TTL of
the resource or cause it to be deleted. This resulted in having
terminated `types.SessionTracker` resources exist up to an hour
after they had been terminated.

To remedy this and prune terminated `types.SessionTrackers` more
frequently, the TTL is reduced to 3m upon changing state to terminated.

Fixes #16644
2022-11-01 12:53:49 +00:00
Isaiah Becker-MayerandJoel Wejdenstål d2f5219106 Warn user when desktop is active (#17770)
Co-authored-by: Joel Wejdenstål <jwejdenstal@icloud.com>
2022-10-29 02:12:41 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Forrest Marshall 62ccbb6fd6 Revert "move to compare-and-swap node hbs"
revert compare-and-swap node hbs
2022-10-11 16:14:39 -07:00
rosstimothy e0ca6e6781 Fix ListResources for WindowsDesktops (#17093)
ListResources was adding the namespace to the backend key when
retrieving WindowsDesktopServices, however UpsertWindowsDesktopService
doesn't include the namespace in the prefix. This results in never
getting any items from the backend.

Removing the namespace in the prefix to match GetWindowsDesktopService
revealed that we were also trying to unmarshal the resource as a
types.Server. Switching the unmarshal function to use
`services.UnmarshalWindowsDesktopService` as GetWindowsDesktopService
allows ListResources to provide the correct resources.

A new test case for WindowsDesktops was added to `local.TestListResources` to
prevent any regressions.
2022-10-06 12:42:16 +00:00
Alan Parra 57508a9e58 Address U2F sunset TODOs (#17030)
Address TODOs, add deprecation warnings and remove as many U2F code references
as possible.

Existing behavior is kept unaltered: it's still possible to inform Teleport of
old U2F AppIDs and U2F configurations are still silently converted to WebAuthn.
There's no reason to break that, so we don't.

Most server-side references to SecondFactorU2F are removed, but client-side
references remain: this makes it possible to interop newer clients with old
clusters (something else may break, but hopefully not this part).

Closes #10375.
2022-10-05 13:13:09 +00:00
Lisa Kim 8bb0636863 Partial delete deprecated code for "DELETE IN 11.0.0" and lower (#16947)
* Deleted 
   - GetAppServers
   - GetApplicationServers 
   - GetDatabaseServers 
   - GetKubeService 
   - UpsertAppServer
   - DeleteAppServer
   - DeleteAllAppServers
   - RotateUserTokenSecrets
* Delete list nodes fallback
* Use AppServer type for heartbeat test
2022-10-04 17:58:30 +00:00
Forrest Marshall ae99259f41 begind namespace deprecation 2022-10-03 09:04:27 -07:00
Forrest Marshall 76f92ec9f3 move to compare-and-swap node hbs 2022-10-03 09:04:27 -07:00
Noah Stride eb42cabbea Revert "Introduce ProvisionTokenV3 (#16361)" (#16934)
This reverts commit 3fba50261f.
2022-10-03 14:14:01 +00:00