Commit Graph
24 Commits
Author SHA1 Message Date
STeve (Xin) Huang 46a528fe11 Avoid Postgres Web Access to dial proxy public address (#52724)
* prototype

* add server name and fix ut

* reduce scope

* fix ut and check client ip

* minor refactor

* remove extra check

* fix GetClusterName after merge

* fix lint
2025-03-20 18:50:27 +00:00
Gabriel Corado b48b9a6249 refactor: use websocket error send on repl errors (#50613) 2025-01-02 16:39:02 +00:00
Gabriel Corado 903b5f5cbe Add WebSocket handler for WebUI database sessions (#49749)
* feat(web): add websocket handler for database webui sessions

* refactor: move common structs into a separate package

* refactor(web): use ALPN local proxy to dial databases

* feat(repl): add default registry

* refactor(web): code review suggestions

* refactor: update repl config parameters

* refactor: move default getter implementation

* feat(web): add supports_interactive field on dbs

* refactor: code review suggestions

* refactor: update database REPL interfaces

* chore(web): remove debug print

* feat: register postgres repl

* refactor(web): update MakeDatabase to receive access checker and interactive

* chore(web): remove unused function
2024-12-14 02:16:29 +00:00
Andrew LeFevre 6614832058 enforce a smaller read limit on HTTP request reads for endpoints that create or update resources (#47416) 2024-10-10 17:31:13 +00:00
Lisa Kim 354eb49d3e Teleterm: Add listing kube resources endpoint (#46753)
* Rename makeLabels into MakeUILabelsWithoutInternalPrefixes

* Teleterm: add listing kube resource endpoint

* Teleterm pb updates

* Renames, moves test, fix imports, address CRS
2024-10-08 20:44:53 +00:00
Lisa Kim f92ee2bd58 Use default labels when deploying service into ECS and allow overwriting existing DB (web) (#45180)
* Allow overwriting an existing database

* Default to pre-defined labels when deploying service into ecs

* Address CRs

* Reuse create database endpoint to support overwrite

Revert database update logic

* Add checks for required fields for default labels
2024-08-21 17:51:22 +00:00
Isaiah Becker-Mayer 2089af5c7e Adds tctl desktop bootstrap, updates docs. (#42161)
* Removes Desktop discovery flow from the frontend, marks the relevant backend endpoints deprecated

* removes documentation that references desktop discover flow

* Deletes web/packages/teleport/src/Discover/Desktop

* Adds `tctl desktop bootstrap`

* final touchups on configure-ad.ps1

* Updates docs for tctl desktop bootstrap

* active-directory-manual to active-directory

* fixes storybook snapshot test borked from merge

* reduces final output of powershell script to just the ldap section rather than an entire config

* checks out master docs/config.json, updates with redirect

* Adds description to CreateCertificateBlob and changes to BLOB

* linter
2024-06-17 20:59:29 +00:00
Gavin Frazar 9723fd096f cleanup after db ca split (#41351)
* remove database client CA event filter injection

* remove tctl database client CA fetch fallback

* remove sqlserver database client CA fetch fallback

* remove database client CA migration

* cleanup tests and mocks
2024-05-09 19:51:27 +00:00
Michael f97e82e73e Add includeRequestable param to unified params (#41075) 2024-05-01 16:08:21 +00:00
Gavin Frazar 5c568bbe07 split database CA into server/client CAs (#35949)
* split database CA into server/client CAs

* update migration logging
    * include auth component in migrations
    * debug log when skipping db client ca migration
* update tctl auth sign for cockroachdb
* update tctl auth sign for oracle
* set ExtKeyUsage for DB certs
    * clientAuth for DB Client CA
    * serverAuth for DB Server CA
* inject filter for pre-v14.3.1 clients
* inject a filter instead of dropping events in grpcserver
* add DatabaseClientCA type

* debug log when skipping filter injection

* update CA filter injection version check func name and doc
2024-01-14 23:53:24 +00:00
fheinecke b178b8b732 Updated Teleport codebase to AGPL3 license (#35259)
Signed-off-by: Fred Heinecke <fred.heinecke@goteleport.com>
2023-12-01 17:48:14 +00:00
Gabriel CoradoandSTeve Huang 96ed71b2f7 Add token and database URI validation to SQL Server configure script route (#34035)
* feat(web): add token and database uri validations to sql server configure

* feat: add sql server address validation

* test: update example sql server URIs

* Update lib/web/databases_test.go

Co-authored-by: STeve (Xin) Huang <xin.huang@goteleport.com>

---------

Co-authored-by: STeve (Xin) Huang <xin.huang@goteleport.com>
2023-11-29 12:50:00 +00:00
Marco André Dinis 40ff26d819 WebAPI: Include new DB RDS fields (vpc and subnet) (#31588)
* WebAPI: Include new DB RDS fields (vpc and subnet)

Those two fields were not being saved to the backend.

* compare aws rds subnets

* remove space
2023-09-13 17:17:49 +00:00
rosstimothy 20559218ad Fix tsh windows builds (#28357)
#24864 added a dependency of lib/web into tsh which broke windows
tsh builds because lib/web transiently depends on lib/srv which
has linux specific code. This shuffles around a few things so
that lib/web is no longer importing lib/srv at all by:

- Indirectly using the srv.SessionController to apply session
control for web ssh sessions

- Moving the common reversetunnel interfaces into
reversetunnelclient since lib/reversetunnel imports
lib/srv/forward which imports lib/srv.

- Directly converting mysql client errors in the connection
tester instead of calling a common function.
2023-06-30 17:12:12 +00:00
Gabriel CoradoandIsaiah Becker-Mayer 0d885e231e SQL Server PKINIT configuration script (#24521)
* feat(web): add powershell configure script for sqlserver

* chore(web): fix license

* Update lib/web/databases.go

Co-authored-by: Isaiah Becker-Mayer <isaiah@goteleport.com>

* refactor(web): rename endpoint

---------

Co-authored-by: Isaiah Becker-Mayer <isaiah@goteleport.com>
2023-05-02 17:31:16 +00:00
Lisa Kim 8aefef1ae6 [Web:Discover] Bring back db service checker (#21062)
* [Backend]: allow more db fields to be updatable

* Add preventing duplicate keys for label creator

* Add sort compare fn helper

* Update db request update object

* Update CreateDatabase component

- Uncomment and touch up db service checker
- Fix db service label checking
- Allow user to make changes to updatable db fields
- Split defining db name and the other fields into
  two views, to prevent user from changing the db name
  which is not allowed with the update action

* Address CR: use nil value to determine CACert update

* Few more touch ups
- address CR: don't OR update db request field CACert
  and use consistent camelCasing
- remove the skip button for deploying service since
  we have the service checker now, which auto skips it
  for user if detects service
- refactor label matching for both register database
  and deploy service steps

* Address CR: make all fields updatable

* Update service polling after rebase
2023-02-06 18:44:39 +00:00
Marco André Dinis f90a1bd452 WebAPI/CreateDB: improve error message when DB already exists (#20345)
When creating a database with the same name of an already existing one,
we were getting a raw error (depends on the backend implementation:
memory, lite, dynamo, ...).
This message is shown to the user which sees it as a cryptic error.

To improve this we should present the error in a better way and provide
an immediate action.
2023-01-26 08:05:18 +00:00
STeve (Xin) Huang 48fbd369ed Enable database fetchers for discovery service (#19739) 2023-01-13 14:03:06 +00:00
Lisa Kim fe1acfc6d3 [Discover] Fix yaml formatting with yaml lists for db join token request (#19939)
* Fix yaml formatting with yaml lists
* Snuck in adding db access checker result 
   with webapi create db endpoint
2023-01-06 18:38:10 +00:00
Lisa Kim 296255f868 [Discover] Add ons for database flow (#19063)
* Add db access rule required for db discovery
  in editors role

For the webapi layer:
* Return db access with user context
* Add AWS RDS fields for creating db request
* Return hostname of each queried db server
2022-12-06 19:20:11 +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
Marco André Dinis 692d2661f4 WebAPI: Get database endpoint (#18041)
* WebAPI: Get database endpoint

This commit creates a new endpoint to return a single databse by its
name.

```
GET /webapi/sites/:site/databases/:database

{
  "name": "<database_name>",
  "desc": "<description>",
  "protocol": "<protocol>",
  "type": "<type>",
  "labels": [
    {"name": "<name>", "value": "<value>"},
    ...
  ],
  "database_users": ["<db_user1>", ...],
  "database_names": ["<db_name1>", ...],
}
```

The `database_users` and `database_names` will list the available
Database User and Names for the current user, based on its roles.
2022-11-10 16:25:09 +00:00
STeve (Xin) Huang d8f4581606 Web API for getting database IAM policy (#17635) 2022-11-09 13:58:17 +00:00
Marco André Dinis 80f4f61032 Create and Update database http endpoints (#17783)
This commit adds two new endpoints:
Create a database with

```
POST .../databases
{
  "name": "<databasename>",
  "protocol": "<protocol>",
  "uri": "<uri>",
  "labels": [{"name":"<name>", "value": "<value>"}...]
}
```

Update a database's `ca_cert` (the only updatable field for now)
```
PUT .../databases/:database
{
  "ca_cert": "------BEGIN CERTIFICATE-----\n <certificate> --END..."
}
```
2022-11-08 11:37:01 +00:00