Commit graph

2655 commits

Author SHA1 Message Date
Brian Joerger 7bff7c41bd
Remove API aliases (#6983) 2021-06-04 13:29:31 -07:00
inertial-frame 8922af0c61
docs: port of 6871 (#7091) 2021-06-04 14:16:05 -05:00
Andrej Tokarčík 3ca21aca9a
Make ClusterNetworkingConfig resource dynamically configurable (#7013) 2021-06-04 19:42:50 +02:00
Andrej Tokarčík 833da36de9
Emit backward compatible ClusterConfig events (#6836) 2021-06-04 18:10:40 +02:00
Marek Smoliński f3fb92f0b8
Skip the app.session.request event from AuditEvent (#7011) 2021-06-04 09:37:22 +02:00
jane quin 326fd1d7be
Add support to configure tsh directory for data (#7035) 2021-06-03 20:37:15 -07:00
jane quin b1e4f1e032
Remove the need for --proxy for session playback (#7052) 2021-06-03 19:55:12 -07:00
jane quin 5c78f1f756
Improve Access Request Events (#6863) 2021-06-03 14:28:38 -07:00
Marek Smoliński 24d5bbd949
Add delay in TestRootLeafIdleTimeout test (#7116) 2021-06-03 21:58:37 +02:00
Roman Tkachenko b4bc767a7c
Buddy: https://github.com/gravitational/teleport/pull/6250 (#7165) 2021-06-03 11:37:10 -07:00
Joel ceb0de8c79
Fix file event driver inconsistencies (#7073) 2021-06-03 08:49:23 +02:00
Marek Smoliński c4843f3c26
Fix flaky DB UT (#7139) 2021-06-02 15:35:32 -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
Joel 4ac06ba1b7
Fix variable shadowing error causing migration slowdown (#7097) 2021-05-31 22:34:54 +02:00
Marek Smoliński eb7bb01d34
Support disconnect_expired_cert for database access (#6857) 2021-05-31 10:26:50 +02:00
Eugene Yakubovich 585c33232b Move from BCC to libbpf with CO-RE. 2021-05-28 15:25:23 -07:00
Joel b2494bea8e
Improve RFD 24 Dynamo migration efficiency and performance (#7012) 2021-05-27 22:19:56 +02:00
Brian Joerger 5fbffaab80
keypaths package (#6848) 2021-05-27 10:31:05 -07:00
Nic Klaassen 1b0747764e Make utmp support best-effort 2021-05-26 10:06:44 -07:00
Nic Klaassen f268ba173e
Stop registering a Kubernetes cluster named after the Teleport cluster (#6786) 2021-05-25 17:50:35 -07:00
Roman Tkachenko fc4c18f297
Allow users impersonating database service generate database certs (#7024) 2021-05-25 14:11:35 -07:00
a-palchikov b6f4d6fc71
Log traits to role mapping warnings on case-insensitive matches (#6209)
* Compute warnings when mapping traits to roles
* Log warnings for case-insensitive traits to role matches.
Updates https://github.com/gravitational/teleport/issues/6016.
Co-authored-by: Andrew Lytvynov <andrew@goteleport.com>
2021-05-25 08:39:22 -07:00
Lisa Kim c15a980e2f
Return unique kube cluster names when retrieving for ui display (#7002) 2021-05-21 14:34:10 -07:00
Joel 615c4639b8
Resolve test issues and event driver bugs (#6990) 2021-05-21 22:01:52 +02:00
Andrew Lytvynov 355755670a mfa: user server instead of log context.Context for audit events
In `GRPCServer` handlers, `g.Context` resolves to the context included
in `logrus.Entry` due to embedding.
This context is typically `nil`, so if anyone tries using it (such as
the `aws-sdk-go` when using a dynamodb audit backend), things break.

Use the `closeCtx` from the parent `auth.Server` instead.
2021-05-20 23:52:33 +00:00
Joel bd96cdd946
Add event handler for access request review event (#6966) 2021-05-20 21:38:15 +02:00
Andrew Lytvynov 4f20fc3e14
mfa: strip trailing newline when reading TOTP codes (#6948)
The newline should not be interpreted as part of the code (or any
`prompt.Input` result).
2021-05-19 13:58:03 -07:00
Joel 3d72d92950
Handle UserUpdatedEvent in event deserialization code (#6949)
* handle UserUpdatedEvent

* add comment
2021-05-19 21:50:08 +02:00
Andrej Tokarčík 555695dfdd
Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
Andrew Lytvynov 11c62e8897
etcd: use a separate connection to check peer versions (#6905)
There is a data race in etcd that breaks the internal state in etcd client
implementation for some server setups (user/pass authentication with
JWTs).
2021-05-19 10:07:08 -07:00
Andrej Tokarčík 66ff76c94f
Add tctl rm cap for resetting cluster auth preference to defaults (#6801) 2021-05-19 18:29:38 +02:00
NajiObeid 86a6abcfcb
lazy init of prometheus collectors (#6561)
* lazy init of prometheus collectors

* incorporate metrics intorduced in #6271

* linting

* tests

* pr changes

* tests

* pr changes
2021-05-19 11:53:36 -04:00
a-palchikov ee6e2c85d8
AuditLog/grpc server data race (#6170)
* Avoid test flake by ensuring the gRPC server is shutdown gracefully before closing the audit log

* Fix lint warnings. Nove tunnel server's Close to earlier to close the proxy watcher and release grpc traffic

* Use graceful shutdown selectively until all tests have improved support for it

* Move session recorder clean up to session.Close

* Always use graceful shutdown for TLS.
2021-05-18 17:57:57 -07:00
Andrej Tokarčík 60f7692353
Add CheckAndSetDefaults call to UnmarshalAuthPreference (#6898) 2021-05-18 12:23:10 -07:00
Roman Tkachenko 6be68ff055
Add missing database cli flags (#6739) 2021-05-18 11:10:16 -07:00
Joel b68c519b4c
Implement RFD 19: Event Iteration API (#6731) 2021-05-18 16:46:01 +02:00
Lisa Kim f0fc07711f
Remove http.NoBody check for web renew token endpoint (#6893) 2021-05-17 11:19:05 -07:00
Trent Clarke 1d0dd975ce Update lib/client/api.go
Co-authored-by: Nic Klaassen <nic@goteleport.com>
2021-05-14 16:09:48 -07:00
Trent Clarke b4c3b16d03 More review additions 2021-05-14 16:09:48 -07:00
Trent Clarke 03ae893846 Review feedback 2021-05-14 16:09:48 -07:00
Trent Clarke 47daff7c0b Doc fix 2021-05-14 16:09:48 -07:00
Trent Clarke eea8dde38e Addressing review feedback 2021-05-14 16:09:48 -07:00
Trent Clarke a6de1c202a Addressing review feedback 2021-05-14 16:09:48 -07:00
Trent Clarke 7fb9cb15f0 Address review feedback 2021-05-14 16:09:48 -07:00
Trent Clarke 17ffe33821 Adds concurrent default-port selection to tsh
Addresses issue #4924

If a default Web Proxy port is not specified by the user, either via
config or on the command line, `tsh` defaults to `3080`. Unfortunately
`3080` is often blocked by firewalls, leading to an unacceptably long
timeout for the user.

This change adds an RFC8305-like default-port selection algorithm,
that will try multiple ports on the supplied host concurrently and
select the most reponsive address to use for Web Proxy traffic. I
have included the standard HTTPS port (443) in the defaulut set,
and this can be easily expanded if other good candidates come along.

If the port selection fails for any reason, `tsh` reverts to the
legacy behaviour of picking `3080` automatically.
2021-05-14 16:09:48 -07:00
jane quin aee7523535
Add session_recording field to session start and end event (#6664) 2021-05-13 18:55:25 -07:00
Trent Clarke 4284fc3586
Forbids use of --insecure in FIPS mode (#6191)
Forbids the use of the `--insecure` mode when FIPS mode is enabled in teleport
Disables the `--insecure` tsh command line option when built with FIPS support

See-Also: #5073
2021-05-14 09:22:46 +10:00
Andrew Lytvynov 84a7230e6e
Move CheckAndSetDefaults definition to types.Resource (#6825)
All resources should implement it, reduce some code duplication in
interfaces.
2021-05-13 14:02:56 -07:00
Andrew Lytvynov 8922554f0d Revert TLS cert usage for database certs
Database service doesn't fully support the cert usage restrictions yet
so we need an unrestricted cert again.
2021-05-13 20:44:39 +00:00
Andrew Lytvynov e987caa292
client: set TLS certificate usage for k8s/app/db certs (#6824)
* client: set TLS certificate usage for k8s/app/db certs

--- TLS usage field

The certificate usage field prevents a certificate from being used for
other purposes. For example, a k8s-specific certificate will not be
accepted by a database service endpoint.

Server-side enforcement logic was already in place for a long time, but
we stopped setting the correct Usage in UserCertRequest during keystore
refactoring in 5.0 (with introduction of k8s certs).

--- TLS certificate overwrite

As part of this, client.ReissueUserCerts will no longer write
usage-restricted certificates into the top-level TLS certificate used
for Teleport API authentication.

For example, when generating a k8s-specific certificate, we used to
overwrite both:
- `~/.tsh/keys/$proxy/$user-x509.pem`
- `~/.tsh/keys/$proxy/$user-kube/$cluster/$kubeCluster-x509.pem`
This PR stops overwriting `~/.tsh/keys/$proxy/$user-x509.pem`.
This is not a breaking change.

--- Selected k8s cluster

Prior to this PR, `tsh status` printed the selected k8s cluster based on
the top-level TLS certificate. Since we no longer overwrite that
certificate, it will not contain a k8s cluster name.

Instead, we extract it from the kubeconfig, which is actually more
accurate since a user could switch to a different context out-of-band.

* Document UserCertRequest CertUsage enum values
2021-05-13 10:26:12 -07:00