Commit Graph
793 Commits
Author SHA1 Message Date
Zac Bergquist ce03d2cdea Enhance LDAP desktop discovery (#9152)
* Refactor component heartbeat callbacks

Consolidate the OK/degraded broadcasts so the same logic isn't
duplicated for each component.

* Periodically update discovered desktops

Fixes #8644

* Allow customizing the desktop search

With this change, we support a discovery base DN other than '*',
and add support for further filtering the results with additional
LDAP filters.

Additionally, we filter out group managed service accounts, which
show up in LDAP searches for (objectClass=computer), despite not
being comptuers. (This is mostly harmless, as the service accounts
aren't present in DNS, so Teleport just ignores them. It does, however,
log a DNS error message that could be confusing, so we explicitly
filter these out just to be safe. This was discovered when testing
on AWS managed AD, which creates a gMSA for DNS.
2021-12-01 16:17:30 -08:00
Roman Tkachenko 4d5493eb69 Add Azure access token auth support for Postgres/MySQL (#8951) 2021-12-01 14:30:25 -08:00
Zac Bergquist 53562aadb0 Use t.Setenv in tests (#9154)
This new feature in Go 1.17 automatically restores the environment
variable to its previous value when a test ends, making it simpler
to set up the environment for tests and less likely that we accidentally
leave behind global state.

Also convert some of the remaining uses of check to standard Go tests.
2021-12-01 10:43:12 -07:00
Gabriel Corado df588df526 Add app metatada to app audit events (#8930) 2021-11-18 11:40:04 -03:00
Brian Joerger 6512bca599 Move unimplemented client methods out of the api client. (#8972) 2021-11-17 15:42:44 -08:00
Brian JoergerandZac Bergquist 664560cee8 teleport.cluster.local cleanup (#7922)
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
2021-11-15 17:32:45 -08:00
Marek Smoliński 33f8a021b1 Fix tunnel address for TLS routing if public tunnel address is present (#8961) 2021-11-15 12:58:22 -08:00
Trent Clarke 3956ed27a6 Fix race condition in integration tests. (#8888)
Some integration tests modify global "constants" to speed up test
execution (e.g. shortening polling intervals). This is occasionally
tripping the Go data race detector, so I have added explicit
serialisation to reading and writing these global settings.

These values are only ever changed in a test environment, and there
should be zero contention for them in a non-test environment.
2021-11-10 11:34:34 +11:00
Lisa Kim c5b2da13b7 Return created date with new recovery codes (#8777) 2021-10-29 20:14:56 -07:00
Alan Parra 41b6ae7b63 Set user verification to "discouraged" for WebAuthn (#8759)
The default user verification setting, "preferred", leaves it open for
client-side implementations whether to to perform verification checks.
In theory it sounds reasonable, but in practice it takes a variety of
forms: Chrome will perform PIN checks if a PIN is configured, a
redundant check in face of our existing password checks. Windows goes a
step further and directs user to set a PIN, a further deviation from the
usual security key workflow.

The traditional workflow is achieved by setting user verification to
discouraged, implemented here.

Reference:
- https://chromium.googlesource.com/chromium/src/+/refs/heads/main/content/browser/webauth/uv_preferred.md

* Set user verification to "discouraged" for WebAuthn
* Add user verification to CredentialAssertion proto
* Add authenticator selection to CredentialCreation proto
2021-10-29 14:06:11 -07:00
Nic Klaassen f884cdd7e3 Make RegisterUsingTokenRequest a Protobuf type (#8690) 2021-10-27 10:59:44 -07:00
Tim Ross d3789279ae use RoutingStrategy enum instead of boolean flag 2021-10-22 17:12:43 -07:00
Tim Ross ab61848a04 Route to the most recently heartbeated node when there are duplicates
Allow users to opt in to changing routing behavior when duplicate
nodes are present. Legacy behavior is to return an error when multiple
nodes are matched by the routing logic in proxyToHost. A new RouteToMostRecent
flag in ClusterNetworkingConfig can be set to allow users to opt in to returning
the most recent node instead of an error. By default, the legacy behavior
is preserved.
2021-10-22 17:12:43 -07:00
Forrest Marshall 7f39084def fix nits 2021-10-22 16:42:33 -07:00
Forrest Marshall babd6b07dd remove OnlyRecent behavior 2021-10-22 16:42:33 -07:00
Forrest Marshall 78b0d8c726 ttl-based fallback caching 2021-10-22 16:42:33 -07:00
Forrest Marshall 19c5768873 server-side filtering 2021-10-22 16:42:33 -07:00
Marek Smoliński 17a5cadabb Add Proxy listener mode and proxy v2 configuration (#8511) 2021-10-21 14:45:47 +02:00
rosstimothy c730778960 Replace golint with revive (#8613) 2021-10-19 14:00:24 -04:00
Marek Smoliński 7606d330e9 AWS CLI access (#8151) 2021-10-19 10:43:53 +02:00
Roman Tkachenko ce547953db Automatically import RDS databases (#8481) 2021-10-15 11:03:10 -07:00
Zac Bergquist 3d5266cc23 desktop access: add session start/end audit events
Updates #7761
2021-10-13 16:37:10 -04:00
Zac Bergquist 01ced111f4 Add RBAC for Windows desktop access (#8520)
* Add RBAC for Windows desktop access

This commit adds RBAC checks for Windows Desktops as described in
RFD 33 and RFD 34:

- add Windows desktop logins & labels to role definition
- introduce new file config for host labels based on a regexp match
- auth server API performs access checking for Windows desktop resources
- add RDP client callback to authorize the user
- support user/role locks
- respect the client idle timeout setting

Note: in cases where an connection is terminated to to RBAC, the web UI
currently displays "websocket connection failed" because the connection
is closed from the server. We'll need to follow up with a nice error
message for the client side to improve the UX here.

Other changes:

* Remove OSS RBAC migration marked for deletion
* Stop creating a default admin role
* add wildcard desktop access to the preset access role

Updates #7761
2021-10-12 14:52:59 -06:00
Alan Parra d892cbdde0 Allow second_factor 'on' and 'optional' without U2F (#8498)
Before this change, second_factor types 'on' and 'optional' required U2F.
Starting at the next Teleport version, those settings require Webauthn by
default and treat U2F as optional.

Group second factor tests by second factor type, which is a more natural way to
think about configuration and cuts some repetition in testing.

* Simplify and extend second factor config tests
* Allow second_factor 'on' and 'optional' without U2F
* Make teleport.yaml parsing correctly reflect absent U2F
* Simplify uses of GetSecondFactor when applicable

We can take advantage of the IsSecondFactor*Allowed functions to do some
heavy lifting for us.

* Additional error handling
2021-10-08 16:00:35 -07:00
Nic Klaassen 2d10515f19 Implement Simplified Node Joining (#8250) 2021-10-08 10:41:28 -07:00
Andrej Tokarčík b86fa7bfa8 Implement where conditions for session recordings list/read (#8289) 2021-10-08 10:18:22 -07:00
Roman Tkachenko 288c5519ce Accept multiple SANs in tctl auth sign for databases (#8449) 2021-10-05 16:00:28 -07:00
Russell Jones dafcf377a0 Release 8.0.0-alpha.1. 2021-10-05 15:28:42 -07:00
Roman Tkachenko 0897a31ee2 Auto-configure IAM for Redshift databases (#8348) 2021-10-04 10:42:55 -07:00
Andrew Lytvynov 813dff20c1 PIV authentication for RDP (#8408)
* PIV authentication for RDP

This uncomfortably large change fully implements smartcard PIV
authentication for RDP clients using the Teleport CA:
- PIV applet implementation in emulated RDP smartcard
- generating Windows-compatible certificates using Teleport CA with a
  dedicated RPC
- generating dummy CRLs for Teleport CA and publishing it via LDAP

The CRLs are required by Windows for any smartcard login certificate, we
can't avoid that. But we can avoid making it public: the CRL can live in
ActiveDirectory instead of a public endpoint of a Teleport service.
Here, we use LDAP to publish the CRL on startup, valid for a year.

There are a few unhandled cases in the current implementation:
- LDAP server certificate is not validated when upgrading to TLS
- multiple active CAs (with HSMs) are not supported, only one CRL is
  published
- CA rotation is not supported, CRL is not re-published on rotation

All of the above issues will be handled in future PRs as this one is
already too large.

* Address review feedback

* Fix linter errors
2021-10-01 15:01:17 -07:00
Alan Parra 93a7a8926b Return preferred MFA method on ping endpoints (#8439)
Give Teleport clients a consistent hint of which MFA method they should
favor when facing multiple options.

To be used by tsh and Web UI to decide whether they should refer to
"U2F" or "WebAuthn" during the transitional period.

* Return preferred MFA method on ping endpoints
2021-10-01 13:35:22 -07:00
Roman Tkachenko 9959ea381f Auto-configure IAM for RDS databases (#8339) 2021-10-01 11:06:17 -07:00
Zac Bergquist e66a359bfd Unify RBAC checking functions (#8407)
Prior to this change, we have several variants of CheckAccessTo*
methods for each resource type that uses RBAC.

This change reduces duplication and the potential for RBAC to behave
differently for different resources by implementing a common
CheckAccess method that can check access to a variety of resources.

This implementation is also sometimes faster than the original
implementation, because it is careful to avoid checking unnecessary
matchers after a role has already denied access.

This includes a new resource for KubernetesClusterV3 and a conversion func.
Note: plumbing the KubernetesClusterV3 resource through existing protos
and deprecating the original resource is out of scope for this change.
2021-09-30 08:41:28 -06:00
Lisa Kim d0c09338ac Rename VerifyAccountRecovery and token ID proto fields (#8395)
- Rename ApproveAccountRecovery to VerifyAccountRecovery 
   to match the language we use for the UI
- Use generic TokenID field naming for requests where more 
   than one type of token is accepted or a single token use 
   may be unlikely (MFA related rpcs)
2021-09-28 10:29:11 -07:00
Nic Klaassen 99cc8eb5ef Require enterprise license for HSM support (#8370) 2021-09-27 10:40:47 -07:00
Lisa Kim 8c4bf751b2 Implement AddMFADeviceSync and GetAccountRecoveryCodes (#8287)
Following allows for UI dashboard mfa and recovery code management:

- Adds new rpc AddMFADeviceSync (nonstream) so users can add device
- Adds new rpc GetAccountRecoveryCodes to retrieve nonsensitive data 
  about a users recovery codes e.g. created date to display in the users 
  dashboard
- Added privilege access to DeleteMFADeviceSync and 
  CreateAccountRecoveryCodes
2021-09-24 12:26:45 -07:00
Lisa Kim c2016bbae7 Unify creating u2f, totp, and webauthn MFA register challenges (#8342)
One endpoint is now responsible for creating/returning 
MFA register challenges:
- Deprecates RotateUserTokenSecrets 
- Deprecates GetSignupU2FRegisterRequest
2021-09-24 08:59:48 -07:00
Andrej Tokarčík bddc54d8c4 Remove ClusterConfig resource (#8150) 2021-09-23 13:56:35 -07:00
Alan Parra 6187d00c74 Add Webauthn support to ChangePassword and Ping (#8337)
Add Webauthn support to a few outstanding endpoints and RPCs.

* Refactor and add Webauthn support to ChangePassword
* Add explicit JSON tag to AuthenticateUserRequest.Webauthn
* Add Webauthn support to /webapi/users/password/token
* Add Webauthn to /webapi/ping
* Add default Webauthn device name to ChangeUserAuthentication
* Tidy Ping tests
2021-09-23 13:34:30 -07:00
Andrej Tokarčík 3585bf9034 Bump version to 8.0.0-dev 2021-09-23 21:11:03 +02:00
Lisa Kim 9196d8a521 Implement User Privilege Token (#8076)
- Privilege tokens are obtained after a logged in user successfully
  re-authenticates with their second factor. This token allows 
  access to protected actions and will last 5 minutes. 
- There is one exception where a user can obtain `PrivilegeException` 
  token without re-authenticating if a user doesn't have any second factors.
  Currently used to allow users to add their first MFA devices for
  auth type optional.
- Added web handlers
2021-09-22 16:09:07 -07:00
Alan Parra 5574cc52c4 Add the DeviceType proto to Auth Service (#8336)
Replaces the local device type in AddMFADeviceRequestInit for a global enum.
Useful for future RPCs.

* Add the DeviceType proto to Auth Service
* Generate protos
* Use new DeviceType in implementations
2021-09-22 15:36:33 -03:00
Trent Clarke a3d8f72d43 Replace log with logrus in Webclient (#8328)
Using the standard logger results in log messages being routed to the
console even in non-debug mode, so reverting to `logrus` which will
honour the debug setting
2021-09-22 21:08:49 +10:00
Forrest Marshall cf7d221b64 improve graceful restart behavior 2021-09-21 11:56:39 -07:00
Roman Tkachenko 13e6c52ccc Add app resource watcher/reconciler (#8228) 2021-09-20 09:27:14 -07:00
Roman Tkachenko 6502a12f1f Add API and CLI for managing application resources (#8185) 2021-09-20 08:44:13 -07:00
Roman Tkachenko e1c3f80aa0 Fixes for cert checker and Postgres config builder (#8251) 2021-09-17 13:28:40 -07:00
Trent Clarke e1b2a267a9 Allow login over plain http in restricted situations (#7835)
This patch will allow the web api to (optionally) fall back from HTTPS
to HTTP under very particular circumstances:

  1. The appropriate `insecure` flag was set, and
  2. The target host is the loopback

If both conditions are met, this patch will allow the WebAPI client to
fall back to plain HTTP when attempting to login to the auth server.
2021-09-17 19:47:03 +10:00
Alan Parra 523cfe5b90 Support registration of Webauthn devices (#8278)
Plug Webauthn registration into the *MFADevice RPC family: AddMFADevice,
DeleteMFADevice and GetMFADevices.

As a consequence, Webauthn authentication and registration become supported by
various other gRPC endpoints that defer authn and registration to the RPCs
above.

Further RPC support and refactors are punted to upcoming PRs.

* Add streaming tests for Webauthn
* Add further login/registration failure tests
* Add Webauthn support for streaming RPCs
* Guard against unexpected second factor type in deletion
2021-09-16 09:56:56 -07:00
Lisa Kim e624dd1730 Allow getting MFA authenticate challenge with recovery token (#8231)
Created a new rpc `CreateAuthenticateChallenge` that 
replaces/deprecates `GetMFAAuthenticateChallenge`

Allows 3 ways to invoke this request:
1. with username + password 
2. with token ID (username retrieved from token)
3. with empty request (username retrieved from context)
2021-09-14 14:48:41 -07:00