Commit Graph
4118 Commits
Author SHA1 Message Date
Lisa Kim 8bb0636863 Partial delete deprecated code for "DELETE IN 11.0.0" and lower (#16947)
* Deleted 
   - GetAppServers
   - GetApplicationServers 
   - GetDatabaseServers 
   - GetKubeService 
   - UpsertAppServer
   - DeleteAppServer
   - DeleteAllAppServers
   - RotateUserTokenSecrets
* Delete list nodes fallback
* Use AppServer type for heartbeat test
2022-10-04 17:58:30 +00:00
Mike Wilson a4af8ae256 Revert "Ensure audit logging of tsh app login."
This reverts commit 31859e5d30.
2022-10-04 11:14:12 -04:00
STeve (Xin) Huang 684f3e5468 Refactor TestResolveEndpoints to avoid test failure when AWS SDK changes (#16943) 2022-10-04 12:32:36 +00:00
Gabriel Corado 0f67969138 Add message for "certificate has expired" error on database connect (#14794) 2022-10-04 12:02:34 +00:00
Lisa Kim bc81db4655 Use field hostname for node resource for predicate expr using "name" identifier (#16902)
* Predicate expressions using the "name" identifier will now use
  field "hostname" when `ls` querying for nodes, as expected by
  the user
* Change predicate expression for access request that use
  name identifier to using the actual json field names
2022-10-04 00:20:04 +00:00
Zac Bergquist bb0000441f Improve BPF tests (#16939)
This doesn't address the flakiness in TestRootScript, but it does:

- ensure that the background goroutine terminates
- ensure that test failures are only done in the main goroutine
- fix a race condition due to the shadowing of the 'err' variable

Updates #16908
2022-10-03 17:53:53 -06:00
STeve (Xin) Huang d319ee2734 Azure Cache for Redis auto discovery (#16755) 2022-10-03 20:54:44 +00:00
Forrest Marshall ae99259f41 begind namespace deprecation 2022-10-03 09:04:27 -07:00
Forrest Marshall 76f92ec9f3 move to compare-and-swap node hbs 2022-10-03 09:04:27 -07:00
Noah Stride eb42cabbea Revert "Introduce ProvisionTokenV3 (#16361)" (#16934)
This reverts commit 3fba50261f.
2022-10-03 14:14:01 +00:00
Brian Joerger ce20b20753 PIV login enforcement (#15874)
Add private key policy enforcement.

  - Add private key policy cert extensions and enforcement.

  - Add private key policy settings and attestation logic.

  - Wire attestation request through login endpoints.

  - Store attestation data for reissue requests.

  - Add private key policy discovery and logic.

  - Relogin on hardware key policy errors.

  - Include integration with Teleport Connect.
2022-09-30 23:27:48 +00:00
Zac Bergquist 09de0ba530 Revert "Remove [direct] dependency on go.uber.org/atomic (#16884)" (#16918)
This reverts commit 4f3aa9a3f2.

We're unable to build for 32-bit Linux due to
https://github.com/golang/go/issues/55152,
which looks like it will be fixed with Go 1.19.2 next week.

We'll re-evaluate with the next Go release and reintroduce this change
as soon as we can.
2022-09-30 22:41:45 +00:00
Alan Parra 59bcdf51c5 Update k8s related dependencies (#16909)
Update k8s.io/ and sigs.k8s.io/ modules and drop dependency on k8s.io/utils.
2022-09-30 22:07:05 +00:00
Yassine Bounekhla 09633dd47f Remove license feature flags for Moderated Sessions, Resource Access Requests, Machine ID (#16585) 2022-09-30 21:46:25 +00:00
Zac Bergquist 4f3aa9a3f2 Remove [direct] dependency on go.uber.org/atomic (#16884)
Go 1.19's sync/atomic package provides the same functionality
2022-09-30 20:39:05 +00:00
Nic Klaassen 60950a9aa0 security: log non-interactive SSH commands at beginning of session (#16872)
* include exec command in session.start.initial_command

* trim oversized events
2022-09-30 19:57:01 +00:00
Alan Parra e61da10df2 Update (even more) Go dependencies (#16900)
Do another large batch of dependency updates.

Most updates are around minor versions, so _theoretically_ safe. The following
v0.x updates draw attention:

* cloud.google.com/go/iam (likely safe, as Google is largely trunk-based)
* github.com/Microsoft/go-winio

Notable exceptions are k8s-related modules, which are harder to update for
various reasons.

* Update Go dependencies
* Fix lib/srv/app/aws/endpoints_test.go
2022-09-30 19:22:35 +00:00
Alan Parra dd3a884abe Drop direct dependency on github.com/golang/protobuf (#16898)
Drop dependency on the (superseded) github.com/golang/protobuf and add a
depguard.
2022-09-30 18:19:44 +00:00
Forrest Marshall 3533dd3e36 local alert resync 2022-09-30 10:48:12 -07:00
Mike Wilson 31859e5d30 Ensure audit logging of tsh app login.
Application sessions were previously only logged when launching an application
session via the UI, and not from the `tsh app login` command. This has been
corrected. The AppName and AppURI are now passed in as part of the gRPC
request to the auth server, which is then used to emit the audit event.
2022-09-30 12:53:13 -04:00
rosstimothy 86bc823231 Fix label based tsh when per session mfa is enabled via role (#16819)
Label based tsh was sending UUID:0 as the node name to the
IsMFARequired check. The server was checking this name against each
nodes name and uuid. However the port included in the name prevented
any matches from being found. Which resulted in the ssh session being
rejected with an access denied message by the node because mfa was
required but never performed.

This removes the :0 from the node name to the IsMFARequired check and
adds a test case to TestSSHOnMultipleNodes that uses role based
per session mfa.
2022-09-30 15:31:13 +00:00
Alan Parra 5cda242067 Update various Go dependencies (#16861)
Update various "assorted" dependencies, that either are used throughout
(logging, testing), are mostly algorithmic or otherwise difficult to pinpoint
"ownership".

I've dropped a couple of deprecated/mostly meaningless dependencies. I suspect
`github.com/mitchellh/mapstructure` could be dropped to, but I didn't look
further now.

* Drop dependency on Clever/go-utils
* Drop dependency on github.com/pkg/errors
* Update various Go dependencies
* Use CompareAndSwap instead of CAS (uber/atomic)
* Add a comment after replaced dependencies
2022-09-30 14:01:51 +00:00
Andrew Burke ce94f93ad1 Fix client idle timeout ending sessions too early (#16392)
This change fixes a bug with client idle timeouts that could cause sessions to end too early.
2022-09-29 23:53:53 +00:00
Joel da7316973c Validate SAML connectors upon creation (#16565) 2022-09-29 18:46:08 +00:00
STeve (Xin) Huang aabced42dc Azure Cache for Redis engine support (#16551) 2022-09-29 18:25:53 +00:00
Krzysztof Skrzętnicki af7cd0239d Elasticsearch: alternative clients (#16670) 2022-09-29 17:53:49 +00:00
Krzysztof Skrzętnicki b7ceede97c Implement tctl auth sign --format=elasticsearch (#16795) 2022-09-29 14:24:12 +00:00
Zac Bergquist 7f1f8ec098 Remove upload completer grace period (#16809)
The 24-hour grace period was kept in Teleport 10 for backwards
compatibility, but is no longer necessary for Teleport 11 due
to the session tracker system.

As a result, it takes about an hour to complete an abandoned upload
instead of 24 hours.
2022-09-29 13:18:52 +00:00
Zac Bergquist d22c6d48b8 Stop checking the cert's province field for kube groups (#16759) 2022-09-29 03:41:40 +00:00
Isaiah Becker-Mayer 99961924a9 Initial RDPDR tests (#16470) 2022-09-29 02:18:30 +00:00
Andrew Burke ac257084a7 Automatically import Azure tags (#16218)
This change lets Teleport automatically import tags from the Azure instance it's running on.
2022-09-28 23:40:13 +00:00
Nic Klaassen d92cd32037 security: only allow one exec request per SSH channel (#16683) 2022-09-28 20:31:02 +00:00
Forrest Marshall 0e6b90071f security patch alerts 2022-09-28 11:06:18 -07:00
Noah Stride 85c426bbcd Remove deprecated cert authority fields and migration (#16761)
* Remove old/deprecated cert authority migration

* Remove on-the-fly migration and deprecated fields

* Remove references to removed and deprecated key fields

* Fix tests for removed fields

* Fix tests that referenced deprecated fields
2022-09-28 17:30:34 +00:00
Andrew LeFevre 77f8a4ef10 Switch underlying protocol used for 'tsh scp' to SFTP (#16601)
* switch underlying protocol used for 'tsh scp' to SFTP

* address TODO

* appease linter

* add method to make it easier for other callers to transfer files

* add tests

* print transfer progress with progress bar by default

Also allow a SIGINT to gracefully stop the SFTP connection. This is
necessary  because the progress bar will ignore signals and prevent the
process from exiting.

* address SFTP fork issues

* make tests less flakey

* fix specifying dir for dst not copying files to correct paths

* make tests less flakey (again)

* don't check file access times, often differs when run in CI

* few small fixes from review, simplify Create method now that HTTP FS isn't needed

* create dst files and dirs with src mode

* improved error messages when doing file operations

* expand home dirs in remote paths

* addressed more feedback

* add license to get_home_dir.go

* address minor feedback of tests, add home dir expansion test

* update sftp fork to point to latest commit on master branch

* addressed feedback

* don't cache home dir lookups, only one remote path can ever be used
2022-09-28 16:37:18 +00:00
Ryan Clark 806a568ada Introduce config v3, add auth_server and proxy_server, remove auth_addresses (#15761) 2022-09-28 15:30:15 +00:00
Forrest Marshall ad4be5ae44 bucket etcd leases 2022-09-27 15:01:32 -07:00
Noah Stride 3fba50261f Introduce ProvisionTokenV3 (#16361)
* Introduce proto types for ProvisionTokenV3

* Add methods to ProvisionTokenV3 to support ProvisionToken iface

* Start building v3 support into the client

* add support for mashalling and unmarshalling ProvisionTokenV3

* Start unit testing ProvisionTokenV3

* Remove oneof to support yaml marshal/unmarshal

* Client should try V3 methods and fallback to v2

* More tests

* Fix join tests

* Fix integration tests

* Switch integration tests to use v3 spec

* Switch iam tests to use ProvisionTokenV3

* Change ec2 join tests to use V3 tokens

* Fix events tests for V3 token

* support ProvisionTokenV3 within API client events handler

* Explicitly specify JoinMethod

* Tidy up final usage of NewProvisionTokenV2FromSpec in tests

* Improve proto docs on ProvisionTokenV3

* Fix bot join tests

* Clarify error message for invalid join method

* Adjust resource version comment

* Fix comments and return error rather than bool in V2() method

* Catch incompatible conversions case

* Include V2 ProvisionToken in tests and add appropriate DELETE IN notes

* Fix linter warnings/unit test failures

* Use nolint rather than lint:ignore

* Add more DELETE IN notes

* Run goimports on join_ec2_test.go

* Address PR comments from tim.

* Add more deprecation/delete in notices

* Improve godoc comments on checkAndSetDEfaults for provider config

* Simplify implementation by dropping client-ahead compatability

* Add some support for client-ahead but with conversion to v3

* Update code comments to include responsible party

* Rename `Role` to `RoleARN` in EC2 configuration for clarity

* Fix tests for Role -> RoleARN rename

* Move MustCreateProvisionToken out of API and into test packages

* Properly go imports files
2022-09-27 17:05:32 +00:00
Alan Parra 53b3c93b4e fix: Handle failures when checking for excluded credentials (#16737)
U2F devices, like the Yubikey4, fail in a slightly unexpected way when
assertions set UP=false. Handle this edge case and also make sure that failures
when checking for excluded credentials won't break the entire ceremony.

Similar to #15975, but in the registration flow this time.

Repro steps:

1. Register a Yubikey 4
2. Attempt to register a different security key
3. Registration fails with a "user presence required" error
2022-09-27 16:41:24 +00:00
rosstimothy 649958b6e3 Reduce number of auth dials for tsh commands (#16367)
* Reduce number of auth dials for tsh commands

One of the major areas of latency for `tsh ssh` is creating multiple
auth clients. Since the auth client is lazy and only actually performs
the dial on first use we can create an auth client once and simply
reuse it. This is done by adding an `auth.ClientI` to `ProxyClient`
which is created via `connectToProxy`. All attempts to connect to
the current auth server via the `ProxyClient` will be given the
cached `auth.ClientI`.

The new method of retrieving the current auth client also allowed
to remove a number of calls to `GetSites` which were used to obtain
the current cluster name. The local profile already contains the name
of the cluster and calls to `GetSites` were unnecessary. All instances
which relied on the site name now retrieve from information that the
`ProxyClient` already has.

In an effort to reduce ambiguity and confusion `CurrentClusterAccessPoint`
and `ClusterAccessPoint` were also removed. AccessPoint denotes that
you are connecting to a cache, but the `ProxyClient` is always going
to be hitting the auth server directly. The two have been replaced
with `CurrentCluster` and `ConnectToCluster`, which they were merely
wrappers for anyhow.
2022-09-27 15:37:51 +00:00
rosstimothy ae1eb1b450 Allow tsh to retrieve cluster details in one request (#16456)
* Allow tsh to retrieve cluster details in one request

Prior to connecting to a node via `tsh ssh` we  need two bits of
information about the cluster:
 1) The session recording mode
 2) Whether FIPS is enabled

In order to retrieve the information `tsh` first would send the
global ssh request `RecordingProxyReqType` to determine the
session recording mode. Later on `tsh` would Ping the auth
server to determine if the cluster was running in FIPS mode.

In an effort to reduce the number of round trips to retrieve
this data, a new global ssh request `ClusterDetailsReqType` is
introduced that returns both the session recording mode and
whether FIPS is enabled. This allows `tsh` to leverage the new
request to get all the information it needs, and is extensible
in case more information is needed` in one request which helps
reduce latency for `tsh ssh`.
2022-09-27 14:00:24 +00:00
Edoardo Spadolini 7778c59dd2 Azure Blob Storage for sessions (#16144)
* Azure Blob Storage for sessions

* Turn fmt constants into functions

* Remove redundant NewHandlerFromURL

* Remove formatted log calls

* Clean up clean up

* Allow nil URL as a no-op in SetFromURL

* Wrap unwrapped errors

* godocs

* trace.Wrap every returned error

* Refactor container creation

* Fix missing error propagation
2022-09-27 11:10:09 +00:00
Alan Parra 8b387b4c2b Update duo-labs/webauthn to 20220815211337 and use new APIs (#16724)
Update duo-labs/webauthn to latest and adapt/make use of new APIs.

Relevant commits:
- ResidentKey: https://github.com/duo-labs/webauthn/commit/048000f85ea880227b7d76ff2c0e4a0b89994cb2
- Discoverable login (aka passwordless): https://github.com/duo-labs/webauthn/commit/09bc59f7770df2eb03b0d11f990481d92c1b61e3

* Update duo-labs/webauthn to `20220815211337`
* Use the new ResidentKey field
* Use the new passwordless APIs
* Record AppID TODOs for posteriority
2022-09-26 21:28:48 +00:00
rosstimothy 0ec2116ba2 Provide proxy listener mode from reversetunnel.Resolver (#16434)
By only providing the tunnel address from the `reversetunnel.Resolver`
callers would still need to lookup the proxy listener mode to determine
how to dial the address. This results in sending a request to
`/webapi/find` once by the resolver to get the tunnel address and then
a second request to `/webapi/find` by users of the `Resolver` to determine
the proxy listener mode. Propagating the listener mode along with the
tunnel address by the `Resolver` ensures only one `/webapi/find` call
is needed.

This is especially impactful because the `reversetunnel.TunnelAuthDialer`
which is used by the auth http client would do this everytime the
`http.Client` connection pool was empty. When the `http.Client` needed
to dial the auth server it was incurring the additional roundtrip to the
proxy.
2022-09-26 20:15:32 +00:00
rosstimothy d99ce1aa8a Use proper context in trackSession (#16687)
trackSession was always using `s.serverCtx` instead of the passed
in context, which prevented having spans from being added to the
correct trace. Calls to NewSessionTracker now use the proper request
scoped context. The backgroun UpdateExpirationLoop still uses
`s.serverCtx`, but the span created for it is properly linked to
the request context.
2022-09-26 19:52:02 +00:00
rosstimothy e0721a1609 Leverage inventory control stream for instance version metrics (#16518)
* Leverage inventory control stream for instance version metrics

The version metrics relied on loading all resources in the cache on
each auth server to tally the counts. Unmarshalling items from the
cache can be quite expensive, especially when done every 15s for
all resources in a cluster. While auth servers are typically robust
machines the extra computation for calculating a single metric is
a bit costly and will grow with the cluster size.

Now that the inventory control stream provides a simple and efficient
manner to iterate over all connected instances we can leverage it
instead of the cache to calculate the version counts. This is a slight
breaking change however, as an auth server will now only be reporting
the versions of instances connected directly to itself, and not
versions for all instances within the cluster. This can easily be
worked around by aggregating the metric from all auth servers for
a cluster.

Closes #16429
2022-09-26 19:15:41 +00:00
STeve (Xin) Huang 245e67ad1f Fix auto discovery on secondary cluster of a global Aurora database (#16187) 2022-09-26 13:20:37 +00:00
Zac Bergquist aa136e7e8a Run a single uploader service per process (#14521)
Prior to this change, each individual service (proxy, app, SSH, db, etc)
would spin up its own uploader service. If you are running multiple
Teleport services in the same process, this means you get multiple
uploaders all looking at the same directory, which can result in
duplicate upload events in the audit log.

Additionally, desktop access has (mistakenly) failed to set up this
service, so desktop sessions would only be uploaded if you happened
to also run some other service in the same process that does spin up
the uploader.

Solve these issues by centralizing the uploader service so that it
runs once per process, and each Teleport service doesn't need to think
about whether or not the service should run.
2022-09-25 22:33:46 +00:00
Ryan Clark 9f9461d5f0 Add labels to Windows Desktop Service, add endpoint for searching them (#16436) 2022-09-23 22:08:04 +00:00
Nic Klaassen a35848d9ce feat: include hostnames of requested servers in access request API outputs (#16483)
* add WithCluserClientProvider

* export GetResourcesByResourceIDs
2022-09-23 21:29:08 +00:00