Commit Graph
34 Commits
Author SHA1 Message Date
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Alan Parra a5c6f40e22 Fix validation for pre-existing U2F devices (#17858)
Add a test for `services.ValidateLocalAuthSecrets` that includes all device
types and reintroduce a case mistakenly dropped by #10476.

I've elected to make `services.ValidateMFADevice` private and keep it around, as
this is the least intrusive change. All outdated TODOs are dropped.

#17853
2022-10-27 13:50:14 +00:00
Alan Parra bac0ccdc99 Remove U2F support (#10476)
Follows up on #10466 by removing remaining U2F references, including proto/gRPC
surface and the lib/auth/u2f package itself.

#10375

* Remove U2F from lib/auth/ (1)
* Remove U2F from lib/auth/ (2)
* Remove U2F from lib/auth/ (3)
* Remove U2F from lib/services/
* Remove U2F from tsh mfa add suggestions
* Remove U2F protos
* Update generated protos
* Cleanup a few stragglers
* Remove lib/auth/u2f package
* Fix references to auth.MFAAuthenticateChallenge
* Revert needless lib/auth/password.go change
* Update e/ to ad8fd4a (U2F cleanup)
* Fix stragglers from latest master rebase
* Fix lint and compile failures
2022-02-24 19:54:28 +00:00
JoelandZac Bergquist 62173e096b use google/uuid instead of pborman/uuid (#9793)
* replace imports

* use google/uuid

* fix test

* reverse changelog changes

* update gomod

* zac steps

* tidy

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2022-01-19 23:44:48 +00:00
Alan Parra c8e9ce2deb Add Webauthn devices via tsh mfa add (#8310)
Introduce client-side registration for Webauthn and ensures `tsh mfa` commands
are compatible.

* Implement client-side Webauthn registration
* Add Webauthn devices via `tsh mfa add`
* Add Webauthn devices to ValidateMFADevice
* Add a brief explanation about CheckAuthenticate's usage
* Use constants for CLI device types
2021-09-20 18:37:20 -03: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
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
Brian Joerger bd07d7be20 CheckAndSetDefaults sets all defaults. (#6846) 2021-06-18 12:57:29 -07:00
Andrej Tokarčík 3d22eaac0e Turn AuditConfig into a standalone resource (#6997) 2021-06-14 15:49:22 -05:00
Brian Joerger 7bff7c41bd Remove API aliases (#6983) 2021-06-04 13:29:31 -07:00
Andrew Lytvynov cd2f4fceb7 Remove JSON schema validation (#6685)
* Remove JSON schema validation

Removing JSON schema validation from all resource unmarshalers.

--- what JSON schema gets us

Looking at the JSON schema spec and our usage, here are the supposed benefits:
- type validation - make sure incoming data uses the right types for the right fields
- required fields - make sure that mandatory fields are set
- defaulting - set defaults for fields
- documentation - schema definition for our API objects

Note that it does _not_ do:
- fail on unknown fields in data
- fail on a required field with an empty value

--- what replaces it

Based on the above, it may seem like JSON schema provides value.
But it's not the case, let's break it down one by one:
- type validation - unmarshaling JSON into a typed Go struct does this
- required fields - only checks that the field was provided, doesn't actually check that a value is set (e.g. `"name": ""` will pass the `required` check)
  - so it's pretty useless for any real validation
  - and we already have a separate place for proper validation - `CheckAndSetDefaults` methods
- defaulting - done in `CheckAndSetDefaults` methods
  - `Version` is the only annoying field, had to add it in a bunch of objects
- documentation - protobuf definitions are the source of truth for our API schema

--- the benefits

- performance - schema validation does a few rounds of `json.Marshal/Unmarshal` in addition to actual validation; now we simply skip all that
- maintenance - no need to keep protobuf and JSON schema definitions in sync anymore
- creating new API objects - one error-prone step removed
- (future) fewer dependencies - we can _almost_ remove the Go libraries for schema validation (one transient dependency keeping them around)

* Remove services.SkipValidation

No more JSON schema validation so this option is a noop.
2021-06-01 15:27:20 -07:00
Andrej Tokarčík 60f7692353 Add CheckAndSetDefaults call to UnmarshalAuthPreference (#6898) 2021-05-18 12:23:10 -07:00
Andrew Lytvynov ac9ba539ce Use cmp.Equal instead of manual Equals methods (#5828)
* Use cmp.Equal instead of manual Equals methods

Equals methods can get out-of-sync with the fields added in structs they
compare. Using `cmp.Equal` handles that, removes a ton of code and makes
it more explicit when specific fields are excluded from comparison.

* Use gogoproto equal plugin for comparing proto values

This will be faster than reflect-based go-cmp.
2021-05-06 11:47:31 -07:00
Andrew Lytvynov 8492f62d43 u2f: add optional attestation cert validation (#6057)
By specifying `device_attestation_cas` in `teleport.yaml`, admins can
restrict U2F device manufacturers. For example, specifying the yubico
attestation CA
(https://developers.yubico.com/U2F/yubico-u2f-ca-certs.txt), you can
restrict users to only yubikeys.

Example error when using the yubico CA and trying to register a Google
Titan key:

```
$ tsh mfa add --type u2f --name test && tsh mfa rm test
Tap any *registered* security key
Tap your *new* security key
ERROR: rpc error: code = InvalidArgument desc = U2F device attestation certificate is signed by "CN=Security Key,O=Google", but this cluster only accepts certificates from ["CN=Yubico U2F Root CA Serial 457200631"]; make sure you're using a U2F device from a trusted manufacturer
```
2021-03-23 15:14:31 -07:00
Andrew Lytvynov 5135f00ae2 mfa: add cluster-level require_session_mfa option (#5939)
* mfa: add cluster-level require_session_mfa option

Users may choose to require MFA for all sessions in some clusters, or
only on select roles in others.
This PR adds the cluster-level option in the `auth_service` config.

To expose this field to non-auth services, opened up `GetAuthPreference`
access over the auth API, including all the cache plumbing.

* Address review feedback
2021-03-17 13:42:24 -07:00
Brian Joerger 427bafe7b2 API Go module (#5449) 2021-02-22 16:20:43 -08:00
Andrew Lytvynov 4b5bb54bf4 u2f: restructure MFA backend to support multiple devices (#5404)
Each user can now have multiple devices. This commit only changes the
backend structure to support it, the client and API haven't been updated
yet.

Also added a migration for existing MFA data on auth server startup.
2021-02-01 17:30:39 -08:00
Brian Joerger eedcd78981 api dependency reduction - authentication (#5385)
Move methods involving authentication logic into /lib/services.
2021-02-01 10:59:51 -08:00
Brian Joerger ce87251ea0 api dependency reduction - marshalers (#5384)
Refactor Marshal logic on types, and move it into /lib/services to reduce dependencies in /api.
2021-02-01 10:26:50 -08:00
Brian Joerger 3c3ce160d9 Move API types and functionality from lib/services to api/types. (#5143) 2021-01-11 10:02:34 -08:00
Andrej Tokarčík a178a278ef Support viewing cluster auth preferences with tctl get cap (#5159) 2021-01-07 14:42:45 +01:00
Andrew Lytvynov bd974ef09a golint: final batch of fixes (#4589)
And enable `golint` during `make lint`.
2020-10-22 00:13:09 +00:00
Forrest Marshall 05f3eeaf00 Support resource-based bootstrapping for backend. (#2871)
* Support resource-based bootstrapping for backend.

Outside of static configuration, most of the persistent state of an
auth server exists as a collection of resources, stored in its
backend.  The resource API also forms the basis of Teleport's more
advanced dynamic configuration options.

This commit extends the usefulness of the resource API by adding
the ability to bootstrap backend state with a set of previously
exported resources.  This allows the resource API to serve as a
rudimentary backup/migration tool.

Notes: This features is a work in progress, and very easy to misuse;
while it will prevent you from overwriting the state of an existing
auth server, it won't stop you from bootstrapping into a wildly
misconfigured state.  In general, resource-based bootstrapping is
not a complete solution for backup or migration.

* update e-ref
2019-08-29 16:16:03 -07:00
Sasha Klizhentas 8356ae6a74 Use in-memory cache for the auth server API.
This commit expands the usage of the caching layer
for auth server API:

* Introduces in-memory cache that is used to serve all
Auth server API requests. This is done to achieve scalability
on 10K+ node clusters, where each node fetches certificate authorities,
roles, users and join tokens. It is not possible to scale
DynamoDB backend or other backends on 10K reads per seconds
on a single shard or partition. The solution is to introduce
an in-memory cache of the backend state that is always used
for reads.

* In-memory cache has been expanded to support all resources
required by the auth server.

* Experimental `tctl top` command has been introduced to display
common single node metrics.

Replace SQLite Memory Backend with BTree

SQLite in memory backend was suffering from
high tail latencies under load (up to 8 seconds
in 99.9%-ile on load configurations).

This commit replaces the SQLite memory caching
backend with in-memory BTree backend that
brought down tail latencies to 2 seconds (99.9%-ile)
and brought overall performance improvement.
2019-04-12 14:23:09 -07:00
Roman Tkachenko c0cf7df7c9 Github connector 2017-12-14 13:41:38 -08:00
Russell Jones 865000d6fe Reintroduced --auth flag to tsh. 2017-08-09 17:24:54 -07:00
Russell Jones b4c805fe23 Re-factored cluster configuration. 2017-08-07 17:20:16 -07:00
Russell Jones 6299d349c1 Introduced and migrated to RoleV3. 2017-07-18 11:20:48 -07:00
Sasha Klizhentas f8641681f6 SAML 2.0 initial implementation 2017-05-12 14:10:18 -07:00
Russell Jones 2033d8093c Fix configuration file regressions. 2017-02-24 14:48:52 -08:00
Alexey Kontsevoy 0a49bb4039 always return config.js 2017-02-24 12:10:36 -05:00
Russell Jones cfe92d7ad2 Fixed bugs created in #783. Updated response returned from /webapi/ping and
/web/config.js. Added support for authentication selection based off ping
response in tsh.
2017-02-23 13:45:19 -08:00
Russell Jones 1dcd3e11e5 Refactored authentication configuration, created resources for dynamic configuration of authentication configuration, and updated documentation. 2017-02-22 11:48:06 -08:00