Commit Graph
22 Commits
Author SHA1 Message Date
Michael 3f0c74b845 Allow webauthn to be passed when issuing certs for web-based scp (#22864)
* Allow webauthn to be passed when issuing certs for web-based scp

* Remove extra line
2023-03-16 02:03:37 +00:00
Michael eeb1596c98 Use serverUID for web scp target (#23124)
* Use serverUID for scp target

Revert unneeded hostname change

Remove comment

Get name

* Change name to serverId

* Fix lint errors

* Add comment

* Fix comment and signature format
2023-03-15 22:00:25 +00:00
Isaiah Becker-Mayer 7d19ffeb93 Clean up web endpoints (#19937)
Abstracts out authenticateRequestWithCluster so that the WithClusterAuth
logic can be used in siteSessionStreamGet without making siteSessionStreamGet
a ClusterHandler, which is expected to return JSON.
2023-01-14 00:48:36 +00:00
rosstimothy 07e2ca13e4 Prevent race from causing remote clients from being closed (#19010)
* Prevent race from causing remote clients from being closed

`web.SessionContext` was susceptible to races retrieving `auth.ClientI`
for remote sites. The mutex on the remote client cache was not held for
the duration of the `GetUserClient` which meant two simultaneous requests
could find no client existed in the cache, create one and then add it to
the cache. When the second client is added to the cache it would close the
first client created, which results in the `use of closed network connection`
error displaying on the web UI as described in #17173.

To remedy this the portion of `GetUserClient` that retrieves the remote client
is now protected by a `singleflight.Group`. This ensures that races on creating
a client no longer happen.

`web.SessionContext` was slightly refactored to make it easier to test, to
remove some unnecessary operations, and to provide `context.Context` to `GetUserClient`.
Additionally, all `web.SessionContext` variables which were named `ctx` in `lib/web`
have been renamed to avoid confusion as that often refers to a `context.Context`.

Fixes #17173
2022-12-05 20:10:01 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Lisa Kim 3a3a0cf8a7 Return nil on success for web UI file tranfers (#15021)
When we download, we write the file contents with the 
`http.ResponseWriter` which is also used to write our 
replies, so it was also writing our success replies.

fixes https://github.com/gravitational/teleport/issues/14557
2022-07-29 17:47:35 +00:00
rosstimothy da891423a9 Revert usage of NodeWatcher in web api (#12586)
The web api cannot leverage the NodeWatcher because it needs to
have each request for nodes go through RBAC checks per user. Rolling
back to creating an auth client per user and retrieving nodes
directly from the auth.ClientI.
2022-05-16 23:23:15 +02:00
rosstimothy fa12352214 Stop loading the enitre node set into memory per tsh ssh connection (#12014)
* Prevent proxy from loading entire node set into memory more than once

When establishing a new session to a node, the proxy would load the 
entire node set into memory in an attempt to find the matching host. For
smaller clusters this may not be that problematic. But on larger clusters,
loading >40k nodes into memory from the cache can be quite expensive.
This problem is compounded by the fact that it happened**per** session,
which could potentially cause the proxy to consume all available memory 
and be OOM killed.

A new `NodeWatcher` is introduced which will maintain an in memory list
of all nodes per process. The watcher leverages the existing resource 
watcher system and stores all nodes as types.Server, to eliminate the
cost incurred by unmarshalling the nodes from the cache. The `NodeWatcher`
provides a way to retrieve a filtered list of nodes in order to reduce the number 
of copies made to only the matches.
2022-05-02 15:59:56 -04:00
Yassine Bounekhla c8e8b7d438 Fix sessions endpoint and remove namespaces (#9217) 2021-12-07 15:17:41 -05:00
Marek Smoliński 17a5cadabb Add Proxy listener mode and proxy v2 configuration (#8511) 2021-10-21 14:45:47 +02: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 7bff7c41bd Remove API aliases (#6983) 2021-06-04 13:29:31 -07:00
Brian Joerger 9def18cb9f gRPC conversions - Nodes (#6535) 2021-04-28 18:27:12 -07:00
Lisa Kim 2669e7aef2 Open source UI users, roles, github cn, trusted cluster (#5540)
* Transferred user endpoints/handlers from e
* Transferred and refactored endpoints/handlers for roles, trusted clusters, and github cn from e
* Export ok() func so e can use
* Silence rbac auth connector access denials on first check failure
* Update e-ref
2021-02-22 08:54:36 -08:00
a-palchikov 72630d1df5 Implement support for preserving file times for 'tsh scp' (#4764)
* Add -p flag to scp
* Add support for preserving access/modification times on files/directories when copying files between hosts.
* lib/sshutils/scp: add time statting for directories
* Add directory handling for scp
* Rewrite scp tests with testify
* Address review comments
2021-01-06 13:21:06 +01:00
Andrew Lytvynov 519df4daff Add missing error checks in lib/web 2020-05-15 16:56:44 +00:00
Andrew Lytvynov c748bebbf2 Set real ClientAddr for web-based SCP uploads/downloads
Without setting `ClientAddr` in `TeleportClient`, the proxy will log
itself (`localhost`, the web service) as the remote address of SCP
client.

Plumb the remote address of the original HTTP request to log the actual
user IP (the machine running browser with web interface open).

Fixes #2958
2020-05-06 00:03:48 +00:00
Russell Jones 217188ce64 Pass site name along in fileTransferRequest. 2018-10-29 10:29:06 -07:00
Russell Jones 1439408b34 If the server has a public address set, use that as the address instead
of the one passed in by the user.
2018-08-31 16:33:54 -07:00
Alexey Kontsevoy ee98d7335d http files/separate remote location from file name in SCP requests 2018-07-18 19:05:00 -04:00
Alexey Kontsevoy 57b2789a49 http file transfer 2018-07-12 14:58:37 -04:00