Commit graph

462 commits

Author SHA1 Message Date
Andrej Tokarčík d63d144e8e
Move ClusterID field from ClusterConfig to ClusterName (#7050) 2021-06-18 18:42:09 +02:00
Trent Clarke 52fb813390
Adds per-node ability to disable ssh TCP forwarding (#6989)
Prior to this change, TCP forwarding over SSH could only be disallowed
by user-based rules, rather than by individual target nodes.

This change adds:
  * the`port_forwarding` key to the yaml SSH config block, with a boolean value
  * Plumbing to pipe the resulting config value through to the SSH server
  * A predicate check in the SSH server to [dis]allow port forwarding based on the setting.

This change also:
    * adds a common way for integration tests to await the establishment of an SSH session
    * refactors several integration tests to use this new method rather than manually waiting
    * adds some marshaling code to move errors from spawned goroutines back into the 
      main test routine in verifySessionJoin()

See-Also: Issue #6783
2021-06-16 20:17:26 -05:00
Andrej Tokarčík 3d22eaac0e
Turn AuditConfig into a standalone resource (#6997) 2021-06-14 15:49:22 -05:00
Brian Joerger 4d36870ff0
Remove remaining API aliases (#7137) 2021-06-08 12:08:55 -07:00
Andrej Tokarčík 2747cc75bf
Move ClusterConfig auth fields into ClusterAuthPreference (#6876) 2021-06-07 11:07:02 -07:00
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
Marek Smoliński 24d5bbd949
Add delay in TestRootLeafIdleTimeout test (#7116) 2021-06-03 21:58:37 +02:00
Marek Smoliński eb7bb01d34
Support disconnect_expired_cert for database access (#6857) 2021-05-31 10:26:50 +02:00
Joel b2494bea8e
Improve RFD 24 Dynamo migration efficiency and performance (#7012) 2021-05-27 22:19:56 +02:00
Nic Klaassen f268ba173e
Stop registering a Kubernetes cluster named after the Teleport cluster (#6786) 2021-05-25 17:50:35 -07:00
Andrej Tokarčík 555695dfdd
Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07: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
Andrej Tokarčík ad00c6c789
Introduce ClusterNetworkingConfig extracting fields from ClusterConfig (#6638) 2021-05-07 13:54:08 +02: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
Roman Tkachenko db6fb57dae
Add app access headers rewrite (#6601) 2021-05-06 11:24:49 -07:00
Brian Joerger b62323e74f
Clarify node connection debug logs. (#6722) 2021-05-05 17:31:36 -07:00
Lisa Kim 9c06ddc8ad
Check cloud feature before setting billing access for web (#6537)
* Init web handler with auth server feature flags on proxy init
* Retrieve auth server features by calling Ping when connecting 
  to auth svc which contains the server feature flags in the response
2021-05-05 14:58:43 -07:00
Roman Tkachenko a3d39e3810
Add redshift auth support to database access (#6479) 2021-04-26 11:53:10 -07:00
Roman Tkachenko d67e11ff2d
Adding postgres_public_addr and mysql_public_addr (#6426) 2021-04-21 19:52:52 -07:00
Brian Joerger 228029df00
Improve process connection error handling and logging (#6471) 2021-04-20 16:59:01 -07:00
Brian Joerger d830ed6db7
Refactor api package and docs to use pkg.go.dev effectively. (#6388) 2021-04-20 16:44:17 -07:00
a-palchikov d5bc20bf95
Implement alternative reverse tunnel address support and add a test case. (#6056) 2021-04-15 12:11:48 -07:00
Forrest Marshall e118629367 improve cert rotation periodics
* Eliminates spurious leaf cluster CA writes.
* Adds jitters to various periodic operations.
2021-04-07 15:49:27 -07:00
Brian Joerger 8ecbefb122
Close leaky direct client. (#6297) 2021-04-02 14:04:54 -07:00
a-palchikov d301da5a39
Embed webassets natively into teleport instead of attaching to the binary (#5935)
Switch to go1.16. Use embed package to embed webassets instead of ad-hoc attaching to binary
2021-03-26 17:37:52 -07:00
Brian Joerger 2beb991598
API client connection overhaul (#5625)
* Added support for connecting API client through tunnel proxy and web proxy addresses (with identity file).

* Added concurrent dialing logic to dial several possible dialing combinations and seamlessly return the first client to connect.
2021-03-23 14:39:20 -07:00
Roman Tkachenko 8739417729
Add Postgres Cloud SQL support (#5941) 2021-03-22 09:38:05 -07:00
Roman Tkachenko a3837f6720
App access cli flow (#5918) 2021-03-22 09:18:53 -07:00
dmitri d6fe06c906 Augment checking stream/streamer and AuditWriter with cluster name detail to automatically populate the field upon event emission.
Updates https://github.com/gravitational/teleport/issues/5856.
2021-03-17 18:21:57 -07:00
Roman Tkachenko 3dd86eba3f
Fix --insecure-no-tls flag (#5924) 2021-03-10 07:42:23 -08:00
Alexey Kontsevoy 472df28f2a
Add "billing_information" RBAC resource (#5676)
* Expose GRPC client connection to plugins
* Replaces global plugin state with the PluginRegistry
2021-03-01 22:47:03 -05:00
Andrej Tokarčík f4e13ea8f3 Don't defer Close calls on writable files 2021-03-01 22:14:10 +01:00
Andrej Tokarčík 8720b1872a Assemble safe FQDN values for AAP redirects 2021-03-01 22:14:10 +01:00
Andrej Tokarčík 85244157b0 Check CA expiration status when joining a cluster 2021-03-01 22:14:10 +01:00
Andrej Tokarčík 899cc1c0ec
Propagate the mapped local user identity via auth.Context (#5794)
In `auth.Context`, the `Identity` field used to contain the original
caller identity and `User` field contained the mapped local user. These
are different, if the request comes from a remote trusted cluster.

Lots of code assumed that `auth.Context.Identity` contained the local
identity and used roles/traits from there.

To prevent this confusion, populate `auth.Context.Identity` with the
*mapped* identity, and add `auth.Context.UnmappedIdentity` for callers
that actually need it.

One caller that needs `UnmappedIdentity` is the k8s proxy. It uses that
identity to generate an ephemeral user cert. Using the local mapped
identity in that case would make the downstream server (e.g.
kubernetes_service) to treat it like a real local user, which doesn't
exist in the backend and causes trouble.

`ProcessKubeCSR` endpoint on the auth server was also updated to
understand the unmapped remote identities.

Co-authored-by: Andrew Lytvynov <andrew@goteleport.com>
2021-03-01 21:55:59 +01:00
Gus Luxton 01fbe15b32
[tctl] Don't explicitly set value for config path and preserve backwards compatibility (#5731) 2021-02-25 22:00:48 -04:00
Andrew Lytvynov fc1c1dbd14 Move all utils.InitLoggerForTests calls to TestMain
This prevents data races between changing the standard logger and it
acutally being used.
2021-02-23 18:04:55 -08:00
Brian Joerger 488cf7b66c
API credential loaders (#5455) 2021-02-22 16:43:00 -08:00
Jane Quintero f3f87489ce remove pointer from GetUploadMetadata in MultipartUploader interface + PR feedback
pass uploadmetadata by value

update test

use DiscardAuditLog in tests

update e and use uploadHandler as UploadMetadataGetter
2021-02-19 17:29:11 -08:00
Jane Quintero 11f787f157 go formatting 2021-02-19 17:29:11 -08:00
Jane Quintero 1ca978bc43 make only protostreamer implement getuploadmetadata 2021-02-19 17:29:11 -08:00
Jane Quintero 9b26bfe821 emit session upload event 2021-02-19 17:29:11 -08:00
Andrew Lytvynov 0f49d601a7
auth: API for requesting per-connection certificates (#5527)
* auth: API for requesting per-connection certificates

See https://github.com/gravitational/teleport/blob/master/rfd/0014-session-2FA.md#api

This API is a wrapper around GenerateUserCerts with a few differences:
- performs an MFA check before generating a cert
- enforces a single usage (ssh/k8s/db for now)
- embeds client IP in the cert
- marks a cert to distinguish from regular user certs
- enforces a 1min TTL

* Apply suggestions from code review

Co-authored-by: a-palchikov <deemok@gmail.com>

Co-authored-by: a-palchikov <deemok@gmail.com>
2021-02-10 20:29:00 -08:00
Roman Tkachenko 81e1102250
Add MySQL support for database access (#5453) 2021-02-10 11:08:13 -08:00
Forrest Marshall db89206db6 improve tsh tests 2021-02-09 13:31:03 -08:00
a-palchikov 86908cc2f3
Web UI disconnects (#5276)
* Use fake clock consistently in units tests.
* Split web session management into two interfaces and implement them separately for clear separation
* Split session management into New/Validate to make it aparent where the sessions are created and where existing sessions are managed. Remove ttlmap in favor of a simple map and handle expirations
explicitly.
Add web session management to gRPC server for the cache.

* Reintroduce web sessions APIs under a getter interface.
* Add SubKind to WatchKind for gRPC and add conversions from/to protobuf. Fix web sessions unit tests.
* lib/web: create/insert session context in ValidateSession if the session has not yet been added to session cache.
lib/cache: add event filter for web session in auth cache.
lib/auth: propagate web session subkind in gRPC event.

* Add implicit migrations for legacy web session key path for queries.
* Integrate web token in lib/web
* Add a bearer token when upserting a web session
* Fix tests. Use fake clock wherever possible.

* Converge session cache handling in lib/web

* Clean up and add doc comments where necessary

* Use correct form of sessions/tokens controller for ServerWithRoles. Use fake time in web tests

* Converge the web sessions/tokens handling in lib/auth to match the old behavior w.r.t access checking (e.g. implicit handling of the local user identity).

* Use cached reads and waiters only when necessary. Query sessions/tokens using best-effort - first looking in the cache and falling back to a proxy client

* Properly propagate events about deletes for values with subkind.

* Update to retrofit changes after recent teleport API refactorings

* Update comment on removing legacy code to move the deadline to 7.x

* Do not close the resources on the session when it expires - this beats the purpose of this PR.
Also avoid a race between closing the cached clients and an existing reference to the session by letting the session linger for longer before removing it.

* Move web session/token request structs to the api client proto package

* Only set HTTP fs on the web handler if the UI is enabled

* Properly tear down web session test by releasing resources at the end. Fix the web UI assets configuration by removing DisableUI and instead use the presence of assets (HTTP file system) as an indicator that the web UI has been enabled.

* Decrease the expired session cache clean up threshold to 2m. Only log the expiration error message for errors other than not found

* Add test for terminal disconnect when using two proxies in HA mode
2021-02-04 16:50:18 +01:00
Brian Joerger 626ad243eb
api dependency reduction - utils constants (#5363)
Moved constants and utils used in /api into /api/constants and /api/utils respectively.
2021-01-29 09:37:01 -08:00
Brian Joerger a555844116
Refactor API Dependencies - clockwork (#5253)
Deprecate SetTTL method in favor of SetExpiry and remove other dependencies on clockwork.
2021-01-20 15:55:32 -08:00
Brian Joerger 7f0c20d9a2
API Dependency Reduction - lib/jwt (#5295)
Refactor CertAuthority methods and GenerateAppToken to remove lib/jwt dependency.
2021-01-19 14:16:25 -08:00