Commit Graph
793 Commits
Author SHA1 Message Date
Lisa Kim 7a7502bd2f Allow deleting/listing MFA devices with recovery tokens (#8197)
- Implemented `DeleteMFADeviceSynce`, which takes in a token 
  that allows users to delete devices during the recovery process
- Refactored `GetMFADevices` to take in recovery token
- Pulled out deleting MFA device (from stream version) into helper func to be re-used
- Added delete MFA web handler
2021-09-14 13:28:22 -07:00
Alan Parra 79b10f3bb5 Introduce WebauthnDevice proto and registration messages (#8201)
WebauthnDevice is a prerequisite for registration, as are the message changes in
AuthService.

This lays the groundwork for registration and ensures only valid devices may
enter storage.

* Add WebauthnDevice to MFADevice
* Add Webauthn to AuthService registration messages
* Validate WebauthnDevice on upsert
2021-09-14 10:16:37 -07:00
Joel 48077e168f Fix firestore (#8181) 2021-09-14 11:32:53 +02:00
Zac Bergquist 839cdcfa97 Convert GenerateServerKeys to GRPC (#8193)
This commit contains 2 changes:

1. Rename GenerateServerKeys to GenerateHostCerts.
   This is a more accurate name and consistent with the existing
   GenerateUserCerts endpoint.
2. Change the request type to include a single role, rather than a
   list of roles. We only ever allowed a single role in the list
   anyway, so this change will prevent future mis-use of the API.

Note: a side effect of this change is we now have two similar endpoints:
- GenerateHostCert: old API that generates SSH cert only
- GenerateHostCerts: a newer API that generates SSH and TLS certs

To avoid making this change too big, we'll aim to deprecate
GenerateHostCert in the future.
2021-09-13 14:37:28 -07:00
Marek Smoliński c142b656c8 ALPN SNI Proxy (#7524) 2021-09-13 11:54:49 +02:00
Lucas MelchiorandAlexander Klizhentas fb180dafe1 fix broken links in api client readme (#8125)
Co-authored-by: Alexander Klizhentas <klizhentas@gmail.com>
2021-09-11 19:43:37 -07:00
Alan Parra 6bc540050a Add a global disable flag for Webauthn (#8191)
Since #8176[1] landed, tsh login favors Webauthn challenges over U2F, a behavior
recommended to other clients as well (such as the Web UI). This creates a
problem: until the Webauthn implementation if proven in the wild, if there are
issues with it, then clients could consistently fail login.

This change introduces a fallback for disabling Webauthn regardless of the
cluster's second_factor:on or second_factor:optional setting. By stopping
challenge generation we automatically push clients over to U2F or TOTP as a
fallback, allowing breaking issues to be fixed without impact. (Note that using
second_factor:u2f as a fallback isn't always possible, since it disables OTP as
well.)

The added setting is meant as a safety switch - once Webauthn is proved in the
wild it is to be removed.

This affects both teleport.yaml and cloud resource configs.

teleport.yaml:

```yaml
auth_service:
  authentication:
    type: local
    second_factor: on # or "optional"
    u2f: {}           # omitted
    webauthn:
      disabled: true
```

Resource configuration:

```yaml
kind: cluster_auth_preference
version: v2
spec:
  type: local
  second_factor: on
  webauthn:
    disabled: true
```

[1] https://github.com/gravitational/teleport/pull/8176

* Add global disable flag for Webauthn
* Generate protos
* Apply Webauthn global disable flag
2021-09-10 11:47:32 -07:00
Lisa Kim ecee1fdfb2 Account Recovery Token Getter and Create New Codes (#8177)
* Define new rpc CreateAccountRecoveryCodes that 
  creates new recovery codes for users who meet requirements, 
  invalidating their previous existing codes
* Define new rpc GetAccountRecoveryToken that
   validates and retrieves a recovery token
2021-09-09 15:31:22 -07:00
Roman Tkachenko 4ea2ecdcfc Introduce app server and app resources (#8140) 2021-09-09 14:19:02 -07:00
Brian Joerger b3bc7f396a LoadIdentityFileFromString (#8132) 2021-09-09 11:24:36 -07:00
Lisa Kim 5695f3b611 Implement CompleteAccountRecovery, Step 3 in Account Recovery (#8103)
* Define new rpc CompleteAccountRecovery, Step 3 in Account Recovery
   after ApproveAccountReocvery. After success, users authn is changed
   which allows a user to login with new credentials.
* Added a verifyMFARespAndAddDevice helper func to unify adding a
   device through stream or by a user token.
2021-09-08 14:26:25 -07:00
Lisa Kim da6e191fff Implement ApproveAccountRecovery, Step 2 in Account Recovery (#8100)
* Define new RPC ApproveAccountRecovery Step 2 in Account Recovery after 
  StartAccountRecovery that after successful invocation produces
  a recovery approved token that allows a user to change authn, 
  view/delete their MFA devices and get new recovery codes.
* Placed rate limit to this endpoint
* Added a verifyUserToken helper method that verifies 
  that a user token is not expired and is of the allowed subkinds.
2021-09-08 12:56:49 -07:00
Zac Bergquist 034e56bd50 webclient: use the provided context (#7801)
Ensure that the webclient package makes HTTP requests using the
provided context so that timeouts and cancelation are respected.

Updates #7795
2021-09-08 11:47:24 -07:00
Alan Parra d00d6b97f9 Wire Webauthn to login endpoints (#8094)
Allow login using Webauthn instead of U2F.

Installs with second_factor:on will automatically support Webauthn, generating
challenges for any U2F devices and allowing Webauthn to be used throughout the
entire login process.

Web REST API modified as follows:

Added /webapi/mfa/login/begin (1st login step)
Added /webapi/mfa/login/finish (2nd login step, SSH)
Added /webapi/mfa/login/finishsession (2nd login step, web session)
U2F endpoints deprecated, but support full breadth of MFA login options
(/webapi/u2f/signrequest, /webapi/u2f/certs and /webapi/u2f/sessions,
respectively)
Auth REST API modified as follows:

Added /:version/mfa/users/:user/login/begin (1st login step)
ssh/authenticate and web/authenticate now support Webauthn (2nd login step)
U2F endpoints deprecated, but support full breadth of MFA options as well
(/:version/u2f/users/:user/sign)

RFD: https://github.com/gravitational/teleport/pull/7808.

* Plug Webauthn into MFAAuth protos
* Generate protos
* Make CredentialAssertionResponse json-friendly
* Add Webauthn proto conversions
* Wire Webauthn to auth apiserver
* Wire Webauthn login to web apiserver
* Wire Webauthn to web login
* Add missing license headers
* Delete login_identity_test.go
* Use previously acquired devices on mfaAuthChallenge
* Take U2F App ID literally if it's not a proper URL
* Add direct tests for auth.Server
* Use trace.BadParameter consistently
* Include user name in "failed to authenticate" logs
* Add more login-related tests to auth.Server
2021-09-02 11:51:42 -07:00
Roman Tkachenko 3410bc8594 Dynamically register/unregister database resources (#7957) 2021-09-01 15:27:02 -07:00
Lisa Kim d0942b7abc Implement StartAccountRecovery, Step 1 in Account Recovery (#8095)
* Define new RPC StartAccountRecovery
* Placed rate limit to this endpoint
* Define new user token type `UserTokenTypeRecoveryStart`
   that allows users to begin recovery process
* Added new field to UserTokenSpec, `UserTokenUsage` to
   store data about how a user token will be used
2021-09-01 11:41:34 -07:00
Andrew Lytvynov 5b090f8633 Connect proxy <-> windows_desktop_service <-> RDP server (#7990)
* Connect proxy <-> windows_desktop_service <-> RDP server

Link together the proxy (websocket), service (mTPS) and RDP client. Pass
target desktop UUID via SNI on the TLS connection from the proxy.

* Use client CAs to validate incoming desktop_service connections

* Send binary frames on desktop websocket
2021-08-30 11:22:39 -07:00
Alan Parra dba49bfad6 Lint and fix missing license headers (#8075)
Introduce new make targets to check and add license headers to files
("make lint-license" and "make fix-license"). License checking is now a part of
"make lint" as well.

Initial attempts used goheader, but it caused "make lint-go" to become about 9x
slower (if not more), plus it only targets go files. Google's addlicense is fast
enough and targets however many file types we want.

Existing files that were missing licenses got the header added, using the
current year as the license date.

* Introduce lint-license and fix-license make targets
* Ignore generated files
* Add license to go files
* Replace irregular licenses with standard copyright/license
* Add license to proto files
* Install addlicense in build.assets Dockerfile
2021-08-30 09:44:09 -07:00
Lisa Kim ab57eab5c0 [RC 2] Extend GetMFADevices to accept tokenID (#8036)
* Add withSecrets bool parameter to identity service GetMFADevices 
  that removes secret (totp key) if true
* Add web handlers for getting devices for authenticated users
* Fix data race with RecoveryAttemptsCRUD test
2021-08-26 19:19:35 -07:00
Lisa Kim 6c1a5b7b87 Implement Account Recovery Codes (#8034)
* Add dice-ware library to create the recovery codes
* Add new recovery code "generated" and "used" events
* Implement create, upsert, and get recovery codes
* Create ChangeUserAuthentication grpc endpoint that is essentially a rework
  of ChangePasswordWithToken that returns both a web session and
  recovery codes (if user meets requirement)
* Add custom rate limit for grpc endpoint for ChangeUserAuthentication

* This commit also includes unused methods related to verifying recovery
  code and recovery attempts that isn't utilized until later PRs
2021-08-26 17:29:08 -07:00
Alan Parra f44ff5fc36 Add the WebAuthn user ID to LocalAuthSecrets (#8013)
WebAuthn recommends using a random user handle (aka user ID) in its protocol.
We are adding the user ID to LocalAuthSecrets (under Webauthn) and allowing it
to be updated and read, both through the user and independently.

The lib/auth/webauthn package is going to be responsible for assigning IDs to
users (and using them).

See https://www.w3.org/TR/webauthn-2/#sctn-user-handle-privacy.

WebAuthn Support RFD[1]

[1] https://github.com/gravitational/teleport/pull/7808

* Add Webauthn to LocalAuthSecrets
* Generate protos
* Add WebauthnLocalAuth persistence to Identity
2021-08-26 15:24:08 -03:00
Alan Parra 43c3541ddc Add support for WebAuthn configuration (#7949)
WebAuthn configuration works as follows:

If there is an explicit WebAuthn config, use it
Otherwise, try to fallback to the U2F config, copying/deriving what we can from it
Falling back to U2F allows users to easily migrate to Webauthn (in fact, if second_factor is "on" then Webauthn takes over from U2F).

See the "UX and configuration"[1] section of the RFD for reference.

[1] https://github.com/gravitational/teleport/blob/0fc785dbff221f015c6dca8292faff5657fa5e19/rfd/9999-webauthn-support.md#ux-and-configuration

* Add protos for WebAuthn configuration
* Add validation for types.Webauthn
* Add Webauthn to FileConfig
* goimports api/types/authentication_authpreference_test.go
* Add missing license headers
2021-08-26 10:24:05 -07:00
Brian Joerger 2d7bfe311c Add support for a profile specific kubeconfig file. (#7840) 2021-08-24 10:28:26 -07:00
Alan Parra 7c9985db10 Add WebAuthn protocol buffers (#7923)
WebAuthn messages are soon to be plugged into the AuthService gRPC API.

Definitions are based on the WebAuthn specification, current browser
capabilities and, in some part, meant to play nice with duo-labs/webauthn.

References:

* https://www.w3.org/TR/webauthn-2/
* https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer
* https://github.com/duo-labs/webauthn/
2021-08-19 12:28:05 -07:00
Andrew Lytvynov 40ebb89215 Fix windows_desktop_service keepalives (#7987)
I missed a few plumbing pieces for this. Initial heartbeats succeeded
but keepalive renewals did not.
2021-08-19 12:06:12 -07:00
Nic Klaassen c48ee9f062 Add support for HSM CA rotation (#7862) 2021-08-18 21:21:43 -07:00
Andrew Lytvynov f2cda7b3ee Split UpsertWindowsDesktop into Create/Update 2021-08-18 18:44:41 +00:00
Andrew Lytvynov e9351457ba Address review comments, batch 1 2021-08-18 18:44:41 +00:00
Andrew Lytvynov ab062428b1 Windows desktop service boilerplate
Boilerplate for a new service and API objects:
- windows_desktop_service config section
- service registration and heartbeats
- static host registration and heartbeats
- caching, permissions, etc
- "tctl get" support

For new connections the service aborts after authentication, since the
RDP client implementation is not ready yet (pending in
https://github.com/gravitational/teleport/pull/7824).

Tested that the service starts, registers (both over a tunnel and
directly) and creates the API objects.
2021-08-18 18:44:41 +00:00
xacrimon 6b5edfba65 add conversion code for billing information update events 2021-08-18 09:56:13 -07:00
Lisa Kim e7c82071a5 Fix incorrect zero value setting for web idle timeout (#7926)
* Revert "Send web idle timeout with new web session response (#7839)"
  which contains a bug where web idle timeout returns zero despite settings
* Retrieving web idle timeout in auth service and setting it with new web
  session fixes the bug
2021-08-18 09:29:08 -07:00
Andrej Tokarčík c2133f8e27 Emit audit events on lock upsert/delete (#7752) 2021-08-13 16:28:46 +02:00
Lisa Kim 680818fabc Send web idle timeout with new web session response (#7839) 2021-08-12 20:46:55 -07:00
Brian Joerger 25c9c982db API client tunnel address discovery fix (#7533) 2021-08-11 14:34:50 -07:00
Lisa Kim 09ba1ebbcf Rename ResetPasswordToken to UserToken for general use (#7681) 2021-08-10 13:41:12 -07:00
Andrej Tokarčík 9f410881f8 Handle stale lock views with strict/best-effort modes (#7798) 2021-08-10 16:56:56 +02:00
Joel fb9fb50aa1 Various fixes to SAML encryption key handling for SSO (#6767) 2021-08-10 14:45:37 +02:00
Andrej Tokarčík 7d9067da24 Replicate locks to remote clusters (#7737) 2021-08-09 11:59:10 -07:00
Brian Joerger eaa750445c ClusterConfig fallback (#7702) 2021-08-09 10:17:49 -07:00
Roman Tkachenko 25aeeae3ac Adding database resource API and tctl commands (#7792) 2021-08-09 07:14:39 -07:00
Roman Tkachenko 629042ed30 Decouple database server from database (#7771) 2021-08-05 01:50:21 -07:00
Brian Joerger 6b8a57f114 Fix client.New race condition (#7774) 2021-08-04 11:25:29 -07:00
Brian Joerger 9b8b9d6d0c rollback - Upgrade api version. (#7751) 2021-07-30 15:34:19 -07:00
Brian Joerger c040aca4c1 Upgrade api version. (#7609) 2021-07-28 13:51:21 -07:00
Andrej Tokarčík 7d878fff24 Enforce locks in auth.Authorize (#7625) 2021-07-28 18:54:21 +02:00
Andrej Tokarčík c782838c3a Fix ClusterConfig caching with pre-v7 remote clusters (#7698) 2021-07-27 15:15:05 +02:00
Roman Tkachenko 1576833094 AWS console access (#7590) 2021-07-26 08:17:16 -07:00
Andrej Tokarčík d5ca862280 Apply locks to connections tracked by srv.Monitor (#7506) 2021-07-23 14:11:50 +02:00
Brian Joerger 455cf84ca5 Fix profile credential loader known_hosts (#7532) 2021-07-20 19:22:32 -07:00
Brian Joerger 740547095c API Client UX fixes (#7521) 2021-07-20 18:50:19 -07:00