Commit graph

1313 commits

Author SHA1 Message Date
Lisa Kim 61d0aaa77f
WebDiscover: Hookup AWS RDS Flow (#24873)
* Clean up aws oidc integration instructions

* Change ResourceSpec icon type from ReactElement to string

When storing state into location URL, it doesn't allow storing
ReactElement, so I changed the icon element into string that
refers to the correct icon. Also adds rds aurora tiles to
Select Resources screen.

* Fix the expected backend aws status value for RDS list

* For RDS list, allow refreshing the table

Helpful when user makes changes to the RDS instance
(eg. tags) and needs to get the most up to date listing

* Update rds db setup access text info

* Make create database dialog more consistent btwn states

* Fix label matching

Previously we required the agent matcher labels
be an exact match of registered db labels otherwise we
prevented the user from deploying an agent (which was wrong).

Now the only requirement is that the matcher labels are all
able to match against registered db labels.

* Implement resuming discover flow from where user left of

* Enable integration access and rds flow

* Strip 443 ports from cluster uri

* Use the labels returned from polling db instaed

* Various touch ups

- Make label matching error less confusing by showing
  error upon user trying to generate command
- Make label messaging clearer
- Emit errors when failing to fetch rds dbs

* Address CR and update test
2023-04-25 19:57:34 +00:00
Zac Bergquist c7779971b6
Create locks using the correct property (#24989)
* Create locks using the correct property

The "lock target" in Teleport's backend uses a different value
depending on the type of lock you want to create. For example,
to lock a node you use its UUID, but to lock a role you use its
name.

We were incorrectly always using the name to create a lock,
which appears to work fine in the UI but is not correctly
enforced on the backend.

This change adds a new required field called targetValue, allowing
us to specify the value to be used for the lock on a per-resource
basis.

Fixes gravitational/teleport-private#556

* Simplify useGetTargetData
2023-04-24 21:35:15 +00:00
Lisa Kim a6d6c2483d
WebDiscover: Finish implementing Enroll Database Screen (#24710)
* Finish defining rest of fields for fetching aws db list

* Define aurora postgres/mysql engine type

* Finish checking for integration access

* Remove aws related logic and pull out dialog into own file

* Refactor useCreateDatabase hook

- Remove hook prop and use context instead
- Instead of automatically taking user to nextstep after
  registering db, let user manually go to next
  step by clicking button (removes brief flashing of loading
  dialog before next step)

* Add the new fields from response to table

* Finish implementing the after user selects a database

- on submit db, re-use the hook that creates database,
  checks if a database service exists to pick up this
  database by matching labels
- while this is happening, a dialog will render showing
  the process

* Update test

* Address CR

* Apply create db feedback and apply backend changes
2023-04-24 19:48:00 +00:00
Michelle Bergquist 2e9ed857da
Adds dependencies for teleport/e #1135 (#24574)
- Adds helper methods for formatting dates
- Adds stripe dependencies to yarn lock
2023-04-21 17:16:58 +00:00
Ryan Clark bdc3db931e
Add the favicon back (#24904) 2023-04-20 23:02:26 +00:00
Michael fce1212fc5
Add lock target matcher and fix button themes (#24851) 2023-04-19 21:22:11 +00:00
Michelle Bergquist 093dab9779
fix typo (#24695) 2023-04-18 15:30:34 +00:00
Krzysztof Skrzętnicki b8eca7f6f8
Make audit log details dialog larger. (#24519)
* Make audit log details dialog larger.

* Remove empty line
2023-04-18 11:39:03 +00:00
Grzegorz Zdunek 6761b9e448
Connect: Update colors in the search bar (#24611)
* Update colors in the search bar

* Move `resourceIcons` outside the component

* Run prettier
2023-04-17 15:15:04 +00:00
Lisa Kim 62c5e0ab04
WebDiscover: Create Enroll a RDS Database Screen (#24509)
* Add new endpoint, hardcode aws regions

* Create aws region selector

* Create listing for rds databases

* Create the enroll database screen
2023-04-17 15:00:39 +00:00
Rafał Cieślak dd9c042a68
Connect: Show resource search errors in the search bar (#24520)
* Move tshd test helpers to a better location

* Support passing no props to tshd test helpers

* Refactor ResourcesService getServerByHostname tests

* Move pluralize to shared package

* SearchContext: Rename `opened` to `isOpen`

* ActionPicker story: Show auxiliary items in a separate column

* ActionPicker: Split getClusterName into two functions

getClusterName used to not return the name of the cluster if there's only
a single cluster present. Some places needed to get the cluster name
no matter what, such as the modal with resource errors that will be added
to ActionPicker.

* Refactor resource search to use Promise.allSettled

* useSearchAttempts has been renamed to useActionAttempts
* useActionAttempts returns resourceSearchAttempt in order to supply errors
  from ResourcesService.searchResources to ActionPicker.

* SearchContext: Implement lockOpen

We'll want to display error details in a modal. While the user interacts
with the modal, we don't want to close the search bar and reset the results.

So instead, we are going to force the search bar to stay open until the
user closes the modal. This will use the lockOpen function from this commit.

* Add modal for showing resource search errors

* Refactor mockedSearchContext to not be a top-level mutable var

* Show an item in search bar with resource search errors

* ResourceSearchError: Add instanceof check to tests, include clusterUri in message

* Make isLockedOpen into a ref

* Use table tests for lockOpen tests

* Revert "Make isLockedOpen into a ref"

This reverts commit 07f4206cc2.

* Move capitalization to ResourceSearchError.messageWithClusterName

* ResourceSearchError: Use `public` in constructor

* Connect: Improve focus management in search bar (#24665)
2023-04-17 12:46:39 +00:00
Krzysztof Skrzętnicki 477e1b108a
OpenSearch audit log improvements. (#24437)
* OpenSearch audit log improvements.

* Run prettier.

* Add missing license.

* Review: share event formatting code.

* Review: add comments.
2023-04-17 12:19:29 +00:00
Yassine Bounekhla 5a46f044b5
add themes to webui (#24507) 2023-04-14 21:45:23 +00:00
Lisa Kim ab1206a133
Discover: Add new usage reporting events (#24567)
* Add aws connect account and enroll rds dbs event

* Update FE types to reflect backend changes

* Rename

* Add missing convert usager
2023-04-14 18:23:18 +00:00
Lisa Kim c17a9da802
WebDiscover: Add delete integration operation (#24590)
* Fix malformed JSON error response for 200

* Fix making response when fetching integrations

* Create re-usable integration ops hook (only delete for now)

* Create delete dialog

* Allow deleting integrations

* Fix lint
2023-04-14 16:08:59 +00:00
Lisa Kim 46c05b321a
Add the new access verb use to web user context (#24463)
* BE: Add field for verb use for user ACL

* FE: Add the new use access verb

* Only define use verb for relevant resources
2023-04-14 16:04:59 +00:00
Grzegorz Zdunek c81ed24e56
Update Electron to 22.3.6 (#24596) 2023-04-14 15:09:10 +00:00
Steven Martin 64448b1b0e
Renders user auth types in User List in expected capitalization (#23514)
* Renders user auth types to match expected capitalization for GitHub, SAML and OIDC

* Update test to use cap OIDC

* Update SAML and GitHub auth type test compare

* UI lint fix

* Applied comments for function location and import

* lint fix

* lint fix

* fix typecheck
2023-04-14 14:10:36 +00:00
Rafał Cieślak a08601e789
Connect: Enable search bar feature flag by default (#24595) 2023-04-14 12:59:52 +00:00
Rafał Cieślak be498cf9dd
Update missing color in Connect, reorder More Options menu items (#24593) 2023-04-14 12:59:25 +00:00
Ryan Clark ce939bef15
Vite fixes (default exports, circular dependency) (#24591)
* Fix Vite production build with react-day-picker

* Fix circular dependency

* Remove unneeded typings

* Use an esmodule interop instead of Vite config
2023-04-14 11:11:24 +00:00
Grzegorz Zdunek e2bb8b747e
Connect: Do not hide any filters if the search term limits the list of clusters to just one cluster (#24447)
* Do not hide any filters if the search term limits the list of clusters to just one cluster

* Rename `ExtraComponent` -> `ExtraTopComponent`

* Use `active` prop only for `InteractiveItem`
2023-04-14 11:05:09 +00:00
Grzegorz Zdunek 4b31ba88ab
Connect: Create dedicated functions for connecting to resources (#24445)
* Create dedicated functions for connecting to resources

* Do not use spread operator

* Rename `params` -> `telemetry`

* Rename `connectToNode` -> `connectToServer`

* Remove unused imports
2023-04-14 09:46:06 +00:00
Lisa Kim e8e9ad39ae
WebDiscover: Create connect to aws account screen (#24506)
* Implement connect aws account screen

* Fix story

* Add integration yaml rule

* Clarify TODO comments

* Update TODO after rebasing
2023-04-13 21:16:21 +00:00
Lisa Kim 49aa9db73e
WebDiscover: Enroll New AWS Integration Flow (#24459)
* Enroll new AWS integration flow

* Move IntegrationEnroll/* into Integration/Enroll/*

* Rename AWS into AwsOidc, story expects pascal case
but ran into non-story issues where casing was a problem
even renaming AWS to Aws wasn't enough, i don't know
why

* Capitalize browser directory to Browser

* Remove passing in clusterId for integration requests

Also define IntegrationKind as enum string values
to avoid hard coding it all over.

* Add sub routing for lazy loading AwsOidc comp

* Fix some styling, remove unused props, and add story

* Add a success dialog after creating integration

* Remove first in wording for now

* Replace teleport.lol with root cluster public URI

* revert renaming browser to Browser

* Fix lint: add license headers

---------

Co-authored-by: Ryan Clark <ryan.clark@goteleport.com>
2023-04-13 19:40:21 +00:00
Justinas Stankevičius 067ccba2b8
Plugin UX improvement prerequisites (#24436)
* Add new assets for integration enroll flow

* Adapt integration status after switch to enum

* Prettier

* Fix some lints

* Rename enum numbers according to conventions
2023-04-13 13:13:36 +00:00
Michael d9023fad9a
[web] Add isModeratedSession flag to web ssh session (#24238)
* Add isModeratedSession flag to web ssh session

* Fix lint

* Change to snakecase

* Change to moderated
2023-04-12 21:26:57 +00:00
Grzegorz Zdunek 8cfff5b5ae
Connect: Limit results after sorting (#24270)
* Limit results after sorting

* Rename `sortAndLimitResults` -> `rankResults`

* Add `useResourceSearch` test, check if the items are sorted correctly

* Use `renderHook` from the testing library, fix test name
2023-04-12 16:20:36 +00:00
Rafał Cieślak f45309853e
Deprecate custom implementation of renderHook (#24442) 2023-04-12 15:57:19 +00:00
Grzegorz Zdunek b8bd16d86b
Connect: Migrate keymap.openCommandBar to keymap.openSearchBar (#24051)
* Migrate `keymap.openCommandBar` to `keymap.openSearchBar`

* Add license header

* Review fixes

* Improve comments
2023-04-12 13:41:36 +00:00
Michael 349ec9404b
[web] Add storeUser to console context (#24159)
* Add storeUser to console context

* Remove teleportcontext

* Change name

* Move init to console context and handle errors

* Remove unneeded function declaration

* Update error message
2023-04-11 18:54:46 +00:00
Lisa Kim 00d3b155bd
WebDiscover: Add open source integrations enrollment page (#24399)
* Create a shareable tooltip no permission badge comp

* Implement the open source enroll integration screen

Copied over tile styling and header description with
minor refactoring from enterprise

* Add integration feature

This feature is manually disabled.
The user ACL for this screen is manually
set to always return false.

* Remove testing implementation detail?

* Make open source check for only integration resource access

* Update snapshot
2023-04-11 18:21:53 +00:00
Lisa Kim 4597ee5b9b
WebDiscover: Add OS integrations page (#24108)
* Move icons to design pkg to share between packages

* Moved integration routes from enterprise

* Add integrations ACL to user context

Also fixes inaccurate plugin perm checking for features.
Plugin "create" is moved to new feature flag "enrollIntegrations".

* Moved feature definition from enterprise

* Add integration service and types

Also moved Plugin type from enterprise

* Create add integration button comp for use in both OS/enterprise

* Move integration list from enteprise (refactored)

* Create open source integrations comp

* Update user.test

* Address CRs

* Make updates in response to backend PR updates

* Add clarifying comment

* Remove return value, export integration list
2023-04-11 17:42:38 +00:00
Grzegorz Zdunek 5641b22f52
Connects: SearchBar improvements (#24190)
* Add stories for longer resource and cluster names

* Extract `PickerContainer`, improve styling of pickers and input

* Extract `FilterButton` component to avoid repeating the same code

* Add a message about excluded clusters

* Show a hint message when input is empty

* Show cluster filters only when there is more than one cluster

* Make search bar input responsive

* Review fixes

* Add a story for no results state

* Fix missing margin when input wraps

* Add license header

* Render `NoResultsItem` and `TypeToSearchItem` as extra items above regular items

* Use `calc` to calculate padding

* Fix comment

* Show TypeToSearchItem only after filter actions attempt finishes

* Run filter search synchronously

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2023-04-11 13:20:54 +00:00
Edoardo Spadolini 851cb6598e
Fix package names for v1 protos, misc proto changes (#24183)
* Delete teleterm's ptyHost/v1, added by mistake

* Add package name to protos conforming to PACKAGE_VERSION_SUFFIX

* use go run in buf-connect-go.gen.yaml directly

* Run protogen in place

* Run the buf-go generation off of go run

This also adds protoc-gen-go-grpc to go.mod
2023-04-06 22:53:31 +00:00
Justinas Stankevičius 1ebefe3f35
Make react-router-dom and @types versions consistent (#24201) 2023-04-06 15:19:56 +00:00
Rafał Cieślak 84f050f623
Connect: Do not include staging feedback address in prod CSP (#24114)
Staging environments are typically less secure than production ones.
We should not include the staging feedback URL in the final packaged app
in case it gets compromised.
2023-04-06 09:59:20 +00:00
Lisa Kim f38f88e64c
DiscoverWeb: Emit events when clicking on unguided resources (#23746)
* Rename following naming convention

* Rename and add more db protocols

* Define new events and add event names to resource spec

* Emit events for unguided resources

Also clear the loc state if the search bar
was cleared to fix a weird quirk where
when user goes back to the select resources
screen, the preserved loc state applied
filter again

* Update tests

* Add database doc event types
2023-04-04 21:41:00 +00:00
Grzegorz Zdunek d229a53326
Connect: Add SearchBar (#23980)
This commit adds an MVP of the search bar to Connect. Currently it's
behind a feature flag (`feature.searchBar`) but we'll enable it by
default before the release. The plan was to merge the code ASAP,
potentially even straight to v12 when we have the chance, which didn't
exactly pan out but there's no harm to having this feature flag for now.

On top of that, this commit adds a new shortcut to open the search bar
(this replaces the current shortcut to open the command bar) and a
shortcut to open a new terminal tab.

The search works by essentially making a `ListResources` request for
each supported resource type to every cluster the user is logged in to.
We repurposed the old command palette UI for that but rewritten it to
use React context and hooks rather than a class and a store. This
allowed us to be a little bit more flexible as the old approach required
every picker to conform to the same interface, both in terms of UI and
code.

This implementation has two main pickers so far:

* `ActionPicker` which is the main one. It searches for resources but at
  the moment it also supports applying filters. In the future, we plan
  to add more actions to it such as "Open a new tab" or "Install tsh".
* `ParameterPicker` is activated when you pick an action from the
  `ActionPicker` that requires an additional parameter. Think choosing
  an SSH server or a db – you need to provide an SSH login or a db user
  for those item. In those situations, `ActionPicker` will switch to
  `ParameterPicker` and let you pick a relevant item from the list.

Everything is contained within `web/packages/teleterm/src/ui/Search`.
Arguably, `useSearch` could be refactored a little bit to maybe make its
structure a little more clear as it handles both the resource search and
the filter search. However, at the moment we're not totally sure how the
search bar will evolve, so we want to leave any bigger refactors for
later. We added a couple of basic tests for regressions that happened so
far. We also have stories for the items from the action picker.

Error handling will be added in an upcoming PR. Docs updates will be
done in a separate PR as well.

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2023-04-04 14:17:41 +00:00
Grzegorz Zdunek 057ff52f89
Connect: Collect protocol origin (#23898)
* Add `origin` field to protocol event

* Capture protocol event origin

* Use positional arguments

* Missing rename
2023-04-04 12:51:02 +00:00
Rafał Cieślak b8497e8789
ClusterItem: Remove usage of colors.secondary.lighter (#23979) 2023-04-03 13:06:54 +00:00
Justinas Stankevičius 10a075cfe1
Hosted plugins onboarding prerequisites (#23234)
* Respect route exactness in TopNav

* Allow submitting CSRF token via form

* Skip "safe" methods in CSRF checks

* Export getXCSRFToken

* Add WithAuth2

* Passthrough "name" of FieldInput

Allows it to be used in an actual form

* icomoon: add hashtag icon

* Add GetAvailablePluginTypes to PluginService proto

* Expose ProxyPublicAddr

For use in Enterprise web Plugin

* Run prettier

* Factor out app.MetaRedirect

* Rename: WithAuth2 -> WithAuthCookieAndCSRF

* Run GCI

* Renegerate protos
2023-03-31 16:05:51 +00:00
Isaiah Becker-Mayer f8057226f6
Fix vite development for desktop websocket endpoint (#23815)
* sets changeOrigin to false

* fixes README
2023-03-30 16:39:25 +00:00
Jeff Pihach 044e637e1c
Adds a new section to the UI for managing locks. (#22437)
New endpoints were added to the API server for fetching, creating and deleting locks.
The 'editor' role now has the ability to create, edit, and remove locks by default.
Created new SlidePanel component to easily add a panel that slides in from the right of the screen.
2023-03-30 16:11:50 +00:00
Yassine Bounekhla faecdcf3b7
Refactor theme (#23539) 2023-03-29 18:25:14 +00:00
Alan Parra 1b3598642c
Add device event update code to Web (#23713)
* Add device event update code to Web

* Update test snapshots
2023-03-29 16:12:44 +00:00
Michael 337bc1c5cb
Fix webapiPingPath (#23727) 2023-03-28 22:38:00 +00:00
Marco André Dinis 3102b82770
Use stable/cloud when Automatic Upgrades is on. (#23395)
* Use `cloud/stable` when Automatic Upgrades is on.

Teleport provides scripts to install teleport agents/services.
Those scripts use YUM/DEB repositories when possible.
Each repo has multiple channels:
- stable/v11
- stable/v12
- cloud/stable

We want to ensure that if the cluster is running in the cloud and
automatic upgrades is on (auth service was started with
TELEPORT_AUTOMATIC_UPGRADES=yes teleport ...), then the installation
script must offer the `cloud/stable` channel.

This PR changes the following scripts:
- Discover Install Node
- Discover Install Database Service
- Install App script
- EC2 default-installer and EC2 default-agentless-installer

* add helm chart knobs to enable auto updater

* use let instead of const and remove default export

* add HA to helm chart

* always return .automatic_upgrades in web ping response

* rename cloud/stable to stable/cloud

* fix ts test
2023-03-28 16:05:09 +00:00
Ryan Clark 255c97eba9
Fix the navigation only ever linking to the root cluster (#23567)
* Subscribe navigation items to clusterId updates

* Add a test for navigtion item changing correctly

* Add license to test

* Update license to match others
2023-03-28 11:33:13 +00:00
Lisa Kim c4a0fda97d
Web:Discover Refactor resource selector (#23018)
* Delete files

* Add new icons to discover assets

* Update context mocks for storybooking/tests

* Refactor PermissionErrorMessage

- Move file location to SelectResource directory
  (only used in SelectResource comp)
- Pass ResourceKind as prop to determine action
  and product name instead

* Hardcode resource specs and rename variables

- Split "resource" file into multiple parts since it
  was getting so large. Database got its own file b/c
  it's the biggest with potential to grow even larger
- Renamed stuff for clarity, a lot of things were getting
  named "resource"
- `shouldPrompt` for type ResourceViewConfig is now optional
  because resource flows will not start with "Select Resource Type"
  view now (change coming in later commit) so we don't have to
  skip the "first" view anymore

* Remove "Select Resource Type" as a view from resource configs

Each resource no longer needs its own "select view" as
resources are all combined into one view now (SelectResource.tsx)

* Refactor the SelectResource component

- Combines all resource kinds into one view
- Provides filtering by searching for keywords.
  As discussed in meeting, we did not want to provide
  like a sorting (filtering?) dropdown at this time
- Provides on hover explanation of why user can't
  add resources if user doesn't have access

* Update StepItem and step Navigation

 The first item of the step nav used to be "Select a Resource Type"
 which used to be part of the views list. The first item is now
 replaced with the resources assigned icon and the resource name.

* Refactor Discover component

Major change is now we init variables such as
indexing views and finding resource cfgs after a user has
selected a resource.

Updates how events are init and emitted
and handles user going back to the resource screen

* Remove duplicated type (defined in ResourceKind.ts)

* Minor micro changes from mostly path/variable rename/restruc

* Allows user to go back to the select resource screen

Adds a back button to the first view for each guided resource

* Update snapshot from rebasing with master

* Address Crs
2023-03-27 16:47:02 +00:00
Evan Freed 6dd7f70f14
switch Registry: k8s.gcr.io to registry.k8s.io (#23589)
Signed-off-by: Evan Freed <evan.freed@goteleport.com>
2023-03-27 08:20:58 +00:00
Sakshyam Shah 786be9ef0c
user acl for device trust ui (#23493)
* feat: user acl for device trust ui

* Update lib/web/ui/usercontext.go

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>

* revert e ref to current from master

* Update web/packages/teleport/src/stores/storeUserContext.ts

Co-authored-by: Lisa Kim <lisa@goteleport.com>

* Update web/packages/teleport/src/teleportContext.tsx

Co-authored-by: Lisa Kim <lisa@goteleport.com>

* update defaultAllowRules to RW()

* commend added to highlight preset rules should be same when added to defaultAllowRules

---------

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
Co-authored-by: Lisa Kim <lisa@goteleport.com>
2023-03-24 04:26:04 +00:00
Steven Martin 47d5f236ef
Use GitHub camelcase for UI, examples, and Messages (#23369)
* Use GitHub camelcase

* Update example github to camelcase

* Update references to GitHub as camelcase
2023-03-22 22:10:12 +00:00
Michelle Bergquist 35b7ea0521
reorder prehog credential events (#23254)
- move both events to auth service
2023-03-22 17:35:37 +00:00
Jakub Nyckowski f24f59b5d0
Headless SSO web endpoint and UI (#22914)
* Update UI

Update UI text

Update the code to add headless request get

Remove commented code

Added simple UI and endpoints

* Update UI
Implement reject SSO handler and UI

* Fix linter issues

* Fix more linter issues

* Fix UI tests

* Use url.JoinPath.

* center spinner on the page and animate it.

* Address code review comments

* Address code review comments

* Renamed React component

* Address PR comments

---------

Co-authored-by: joerger <bjoerger@goteleport.com>
Co-authored-by: Jeff Pihach <jeff.pihach@goteleport.com>
2023-03-22 15:16:09 +00:00
Ryan Clark c58d693e34
Fix styled-components CSS prop in Storybook (#23427) 2023-03-22 14:19:43 +00:00
Ryan Clark afcac88b28
Upgrade Webpack to 5.76.2 (#23403) 2023-03-21 19:20:56 +00:00
Ryan Clark 471a82bd6f
Move teleport over to Vite (#21168) 2023-03-21 18:01:53 +00:00
Grzegorz Zdunek 37d977a8dc
Notification improvements (#23163)
* Use `overflow-wrap: anywhere` to prevent overflow

* Prevent collapsing after clicking on a link
2023-03-17 07:53:54 +00:00
Ryan Clark fe96224e12
Fix navigation redirecting to the wrong page on category change (#23181) 2023-03-16 21:52:05 +00:00
Grzegorz Zdunek 2d387e179f
Add docs for Connect config (#22898)
* Rename old "quick input" to the current "command bar" feature name

* Remove 'Droid Sans Fallback' from Linux fonts

* Add docs for config

* Link to the proper documentation section

* Apply suggestions from @ravicious and @ibeckermayer

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
Co-authored-by: Isaiah Becker-Mayer <isaiah@goteleport.com>

* Adjust property descriptions with the names used in User Interface

* Drop `Courier New`

* Simplify `$schema` description

* Fix lint issues

* Add a break line after each heading

Co-authored-by: Paul Gottschling <paul.gottschling@goteleport.com>

* Schema should not be modified

* Config file is created on first launch

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
Co-authored-by: Isaiah Becker-Mayer <isaiah@goteleport.com>
Co-authored-by: Paul Gottschling <paul.gottschling@goteleport.com>
2023-03-16 15:26:54 +00:00
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
Grzegorz Zdunek 513f874fab
Update Electron to 22.3.2 (#23031) 2023-03-14 15:15:31 +00:00
Justinas Stankevičius c056efe974
Hosted plugins: add plugin management UI prerequisites (#22831)
* Add GetType() to Plugin

* Add Plugins feature flag to web

* Run prettier

* Update e_imports.go with slack plugin subpackage

Respective enterprise changes imports a new subpackage,
which pulls new dependencies.
2023-03-14 12:44:22 +00:00
Rafał Cieślak ffaa34390e
Log Connect version on startup (#22966)
When users send us logs, we have to ask them which version they're using
anyway as we don't currently save this information anywhere in the logs.
2023-03-14 09:50:02 +00:00
Grzegorz Zdunek af9e0ed438
Connect: Add "Open Config File" item to menu (#22730)
* Expose `openConfigFile` IPC

* Add "Open Config File" to `NavigationMenu`

* Make `NavigationMenu` more concise

* Remove unused imports

* Call "three dots" menu "More Options" to make it easier to refer to in the docs

* Show a notification with a config file path

* Render the icon component only in `NavigationItem`

* Render the separator only with access request items

* Use just `separator` string instead of an object

* Render `StyledListItem` as a button

* Shorten the notification

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2023-03-14 07:45:07 +00:00
Sakshyam Shah ca61963543
devices icon to be used for device trust management menu (side navigation) (#22970) 2023-03-14 04:21:23 +00:00
Rafał Cieślak a5fa148070
Fix unresponsive terminal in Connect on Windows Server 2019 (#22971)
* Update node-pty to 0.11.0-beta29

* Do not use ConPTY
2023-03-13 17:23:36 +00:00
Rafał Cieślak 328c4e8c7d
Fix uncaught exception handling in Connect's shared process (#22962)
* Fix uncaught exception handling in Connect's shared process

Without this patch, an uncaught exception being thrown would result in
the following error due to how binding methods to class instances works:

C:\Users\rav\AppData\Local\Programs\teleport-connect\resources\app.asar\
build\app\dist\main\sharedProcess.js:73614
    this.getLogger().error(message, ...args);
         ^

TypeError: this.getLogger is not a function
    at process.error (C:\Users\rav\AppData\Local\Programs\teleport-connect\
       resources\app.asar\build\app\dist\main\sharedProcess.js:73614:10)
    at process.emit (node:events:513:28)
    at process._fatalException (node:internal/process/execution:167:25)

* Log the origin of the uncaught exception
2023-03-13 16:54:13 +00:00
matheus d6133ff69f
Hide upgrade-related alerts from dashboards (#22967)
* Filter version alerts out of the alerts list

* Use constants to alert names

* Update test

* Addres code review comment

* Use afterEach to undo cfg change
2023-03-13 16:41:51 +00:00
matheus b0fb10ae4e
Hide download center when not on dashboards and prevent license gRPC endpoint from being called (#22965)
* Hide download center when not on dashboards

* Prevent getLicense gRPC call on cloud
2023-03-13 16:03:23 +00:00
Grzegorz Zdunek 17ff6d6a8f
Connect: Show config file errors (#22728)
* Add a function that returns error that might happen during loading the file

* Return validation and file loading errors from `ConfigService`

* Discard file storage updates when the file was not loaded correctly

* Do not show usage reporting dialog when the file was not loaded correctly

* Make title of notifications a little bit smaller, so longer titles do not look weird

* Get rid of sync fs functions wherever possible in file storage

* Move error handling code to `createFileStorage`

* Improve `getConfigError` comment

* Rename `discardUpdatesWhenLoadingFileFailed` to `discardUpdatesOnLoadError`

* Fix the error message in `notifyAboutConfigErrors`

* Revert "Make title of notifications a little bit smaller, so longer titles do not look weird"

* Make `writeSync` async too

* Return `unknown` from `FileStorage.get`

* Add a TODO comment about createFileStorage type

* Add "the" to "Using default config instead"

* Remove `toString()`

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2023-03-13 15:52:01 +00:00
Lisa Kim bc6e0d9fe5
Web-Discover: Add support for connection testers with per-session MFA enabled (#22529)
* Define new endpoints and request fields

- Add MFA response field for test connection reqs
- Define new types for checking if MFA is required

* Implement logic to check if MFA is required

* Add MFA dialog to test connectors

Adds a new function field for ReAuthenticate dialog
that just returns the MFA response

* Update storybook

* Change json field names as a result of backend CR

* Address CRs

* Address CR 2
2023-03-10 19:02:58 +00:00
Grzegorz Zdunek f061f9da00
Connect: Provide prehog address for prod env (#22546)
* Provide prehog address for prod env

* Use Connect specific endpoints
2023-03-10 12:01:38 +00:00
Grzegorz Zdunek 2a2b08dbfd
Use 13px font size in a Notification (#22842) 2023-03-10 10:08:15 +00:00
Rafał Cieślak f43297f56a
Connect: Remove leftovers from resource cache removal (#22772)
* Connect: Remove leftovers from resource cache removal

* GetAll* RPCs were used in the resource cache and are no longer used.
* ListApps was pretty much never actually used as we didn't ever list apps
  in Connect.
* ClusterContext.state.searchValue ceased to be used after we moved to
  fetching resources from the backend.

* Remove remaining leftovers from tshd client mock

* Remove unused imports
2023-03-10 10:05:18 +00:00
Grzegorz Zdunek 99671496a0
Connect: Generate json schema for app config (#22538)
* Rename `putAllSync` to `writeSync`

* Extend `FileStorage` with functions to replace an entire state and return file path used to create it

* Add `updateJsonSchema` function

* Generate schema for the app config

* Always return a string from `createMockFileStorage().getFilePath()`

* Add missing license headers

* Rename 'teleport_connect_config_schema.json' to 'schema_app_config.json'

* Rename `getKeyboardShortcutDescription` to `getShortcutDesc`

* Rename `keyboardShortcutSchema` to `shortcutSchema`

* Update a valid shortcut message

* Rename `configJsonSchemaFile` to `jsonSchema`

* Simplify `updateJsonSchema`

* Set `$refStrategy` to none

* Add missing description for `usageReporting.enabled`

* Bump zod to the latest (improves TS performance)

* Move `configService` implementation to `configStore`

* Rename `configStore` to `configService`

* Move `updateJsonSchema` to `createConfigService`

* Move `validateStoredConfig` outside `createConfigService`

* Rename `createAppConfigSchema.ts` to `appConfigSchema.ts`, `getKeyboardShortcutSchema.ts` to `keyboardShortcutSchema.ts`

* Export `createKeyboardShortcutSchema`

* Add license header
2023-03-07 14:39:49 +00:00
Yassine Bounekhla f8c5cd0441
fix select box sizing (#21212) 2023-03-06 22:59:54 +00:00
Grzegorz Zdunek 793210ee64
Fix broken Teleterm stories (#22657) 2023-03-06 15:04:48 +00:00
Jeff Pihach 016141c1ea
Resolve dependabot CVE issues (#22605)
* update storybook dependencies to resolve some dependabot issues.

* remove config that's already set to the default

* Resolve prettier issues after dep update.

* Pin x-default-browser version to resolve dependabot vulnerability.
2023-03-03 23:45:17 +00:00
Grzegorz Zdunek 4830ea16e5
Connect: Enable keyboard shortcuts configuration (#22194)
* Use event.code for non A-z keys

Without this fix, shortcuts like "Shift+1" can't work, because the reported character is "!".

* Add Zod schema to validate keyboard shortcuts

* Render better formatted error notification, add a link to docs

* Notify about duplicated accelerators

* Improve the error message for re-parsing failure (it can happen when a default value does not pass validation)

* A bunch of renames

* Allow spaces in accelerators

* Rename `isContentAnObject`

* Allow `Notification` to render links and lists

* Split by optional whitespace and "+"

* Allow lowercase letters

* Require a modifier for non-function keys

* Move VALID_SHORTCUT_MESSAGE to `initUi`

* Always return from `getDuplicateAccelerators`

* Use 'Cmd' and 'Ctrl' for mac

* Add comments

* Fix notification not rendering content

* Add more comments, rename `getKeyCode` to `getKeyName`

* Fix incorrect size of <Link> text

* Remove "expected" prefix

* Revert `typeof content === 'object'` in `Notification`

* Remove a comment about disabled keys in `ConfigService`, add a note about `keymap.` prefix

* Improve `getKeyName` comment

* Extract an inline object to a variable in `getKeyName`

* Fix notification list padding

* Change text for doc link & description for config error

* Improve comment for `getKeyName`

* Remove special formatting for list === 1 in `Notification`

* Print valid modifiers

* Call `getKeyboardShortcutSchema()` once

* Collect issues from all validations, run `invalidModifiers` through a set

* Change error message for `missingModifierIssue`

* Convert duplicates warning to error

* Define ALLOWED_KEY_CODES in a more concise way

* Support both `IntlBackslash` and `Backquote`

* Restore modifiers for mac to full spelling, sort them in order recommended by platform guidelines

* Fix old comment about the shortcuts order

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2023-03-03 14:05:38 +00:00
Grzegorz Zdunek 717c4fa55a
Connect: Prepare keyboard shortcuts configuration (#22193)
* Make naming around keyboard shortcuts more consistent

Previously, we used words like: "key", "type", "shortcut" which were really confusing (and I wrote this code), because it was hard to tell what exactly they describe.
From now, we will use only "accelerator" (borrowed from Electron) and "action" words.
For example, in a shortcut "Command+1": "tab-1":
- "Command+1" is "accelerator"
- "tab-1" is "action"

* Use "+" instead of "-" as a separator

With "-" we are not able to use this symbol as a valid key code.

* Rename some config keys to follow the same naming pattern

* Rename keyboard shortcuts to match config keys

* Extract `mapAcceleratorsToActions` to a function

* Rename other "keyboard shortcuts" to "accelerators" and "actions"
2023-03-03 11:44:25 +00:00
Michael Wilson 9bd0cc83c9
Add in SAML IdP service provider session metadata to auth attempts. (#22544)
* Add in SAML IdP service provider session metadata to auth attempts.

The SAML IdP auth attempt event now contains SAML IdP service provider,
which will allow the audit logs to display which service provider the user
is attempting to log into.

Additionally, a shortcut name has been added to the SAML IdP service provider
metadata to handle auth attempts where the service provider could not be found
given a shortcut name.

* Linting fix.

* Modify the auth attempt audit log entries.
2023-03-02 20:26:18 +00:00
Michael Wilson 6973cd6527
SAML IdP audit events. (#22208)
* SAML IdP audit events.

SAML IdP audit events have been added. These events have been added to the UI
for proper rendering. Additionally, service provider events will be emitted
when managing service providers.

* Align the naming more with the existing events.

* Zac's feedback.

* Add in delete all event.

* Fix typo.

* Update story snapshot.

* Linting and test fixes.

* Audit auth failures.

* Removing the nopermissions test, as it's covered in the regular create test.
2023-03-01 20:01:40 +00:00
Edoardo Spadolini 6fd8a233e1
lib/usagereporter refactor and consolidation (#22460)
* services.usagereporter to lib/usagereporter/teleport

* teleterm/daemon/usagereporter to usagereporter/daemon

* usagereporter/daemon type aliases

* Move UsageAnonymizable newtypes in a separate file

* DiscardUsageReporter should be passed by value

* Type renames in usagereporter/teleport

* Move audit event to usage event conversion to lib/usagereporter

* package import renames

* Don't break the e build for now

* move web usage report events to lib/usagereporter

* forgot license blurb

* lib/usagereporter/discover.go to types_discover.go
2023-03-01 18:40:53 +00:00
dependabot[bot] 5f1a5a25ad
Bump golang.org/x/crypto in /web/.cloudbuild/scripts (#22360)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20211215153901-e495a2d5b3d3 to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 17:53:05 +00:00
Michael d94fed7b0d
Add static and dynamic web ui configuration options (#21945)
* Add UiConfig option to proxy service config

* Add uiConfig to GRV_CONFIG window object and use in terminal constructor

* Update configuration reference docs

* Remove extra structs and change property to scrollbackLines

* Update web/packages/teleport/src/config.ts

Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>

* Use a common struct and apply in applyProxyConfig

* Remove webclient dependency for fileconf

* Add missing doc comments

* Set individual properties of cfg.Proxy.UI

* Remove unneeded comment

* Add nolint rule

* Fix nolint

* Add test for UIConfig

* Cleanup tests

* Fix TestUIConfig context

* Allow dynamic config for web ui (#22097)

* Update protofiles

---------

Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>
2023-02-28 17:45:52 +00:00
dependabot[bot] 5e4301007a
Bump golang.org/x/net in /web/.cloudbuild/scripts (#22353)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20211216030914-fe4d6282115f to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/commits/v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 14:25:12 +00:00
Yassine Bounekhla 10ca00a1a3
[Web] Refactor serverside filtering and pagination (#20823)
* refactor filtering

* stash

* fix errors

* tweaks

* fixes

* address comments

* fix missing searchAsRoles query param

* temp

* temp

* rename ClientSidePager

* temp

* rename

* update eref

* manually type returntype

* address comments

* type useServersidePagination

* revert default pageSize

* update snapshots

* remove useless act in test

* remove unused import

* address comment

* fixes

* update snapshot

* revert e

* revert e
2023-02-27 22:17:41 +00:00
Lisa Kim ff9aa378c4
[web] Move filtering out cloud and tcp apps to the frontend (#22257)
* [be] Remove filtering out cloud/tcp apps

* [web] Add conditional rendering of apps launch btn

* update snapshot

* Address code review with minor refactoring

* add nowrap to page indicator text

* remove hyphen

---------

Co-authored-by: Yassine Bounekhla <yassine@goteleport.com>
2023-02-27 17:04:51 +00:00
Rafał Cieślak 6578af1efd
Connect: Remove resource cache (#21964)
* Connect: Remove resource cache

This commit refactors parts of the Electron app which still depend on
the resource cache, that is cluster sync and `tsh ssh` executed from the
command bar.

A number of adjustments has been made to executing `tsh ssh` from the
command bar, namely the logic of resolving the hostname has been moved
from the command launcher to useDocumentTerminal. The UI was also
adjusted to allow the user to reconnect to an SSH server if resolving
the hostname fails. This has a nice benefit of also allowing them to
retry if the PTY couldn't be created for some reason.

---

Before gravitational/webapps#1307, Connect was pulling all resources
from the cluster on app start and cluster login. Then it'd show them to
you in tables if you opened a new tab with cluster resources. There were
at least two problems with this approach:

1. It was slow for big clusters as pagination, filtering and sorting
   were all done client-side and blocked the main thread.
2. It wasn't possible to implement advanced search unless we copied the
   implementation from the backend to tshd.

gravitational/webapps#1307 made it so that instead of depending on that
resource cache to show resource tables, Connect would pull paginated
resources from the backend.

However, the resource tables were not the only part of the app depending
on that cache. Due to time constraints, we weren't able to refactor all
of them. We managed to refactor autocomplete (gravitational/webapps#1406)
and the remaining places are listed in #21800.

This PR refactors those remaining places to not use the cache by either
not depending on resource details or by making a call to the proxy
instead.

* Add missing license
2023-02-27 15:32:19 +00:00
Lisa Kim 137c085061
Fix regression for not able to create or reset users (#22264) 2023-02-24 21:37:26 +00:00
Yassine Bounekhla 8d44d15fb8
[Web] Add custom element support to SearchPanel (#22186)
* fix apps totalCount and add support for custom elements in panel

* export kinds function

* revert totalcount change
2023-02-24 21:27:15 +00:00
Isaiah Becker-Mayer e2df4a31ba
Fix incorrect login options for Windows Desktops (#22118)
* Removes desktop logins from the ACL and adds them to each Desktop resource
as returned to the frontend. This behavior parallels what's currently being
done with other similar resources such as Nodes, and fixes a bug where
users were able to see all the logins permitted by their roles on every
desktop "connect" dropdown, even if the role permitting that login didn't
apply to a given desktop.

* Extracts common logic out of GetWindowsDesktopLogins (now GetAllowedWindowsDesktopLogins), uses it to create a GetAllowedServerLogins as well, tests both of them together, removing EnumerateServerLogins

* reduce unnecessary looping by using maps

* fixes flakiness by sorting lists

* uses require.ElementsMatch rather than manually sorting lists

* consolidates duplicated logic

* Consolidates separate server and desktop logic into a single GetAllowedLoginsForResource

* fixes tests

* fixes import order and test
2023-02-24 21:06:38 +00:00
matheus 50f2796207
Add isDashboard to web config object (#20830)
* Add isDashboard to web config

* Update config.js with the new field

* Remove debug log

* Remove debug log (2)

* Improve godocs

* Remove debug log(3)

* Improve godoc

* Improve godocs

* Update godoc

* Update comment

* Improve comments/godocs and rename method
2023-02-23 19:03:51 +00:00
Rafał Cieślak 6bd3cbac47
createPtyProcess: Return early on error (#22180)
Without this early return, createPtyProcess of PtyHostService would call
the callback twice on error. This doesn't have much negative implications
since the gRPC implementation will simply ignore the second call, however
it does pose some problems when trying to manually test PTY failures
by making `new PtyProcess` return an error.
2023-02-23 13:55:19 +00:00
Rafał Cieślak ff07b46f6e
ClustersService: Remove internal logins when syncing root clusters (#22179) 2023-02-23 13:55:15 +00:00
Grzegorz Zdunek 8c08211353
Connect: Enable font configuration (#21965)
* Remove sans serif from config

* Pass 'fonts.monoFamily' as style prop

* Get rid of `getSansSerif` function

* Use mono font from theme

* Add 'terminal.fontFamily' and 'terminal.fontSize' config options

* Require 'terminal.fontSize' size to be int

* Revert unneeded changes to mono font usage

* Add comment with a link to `ctrl.ts`

* Allow 'terminal.fontSize' to be in the range 1-256
2023-02-22 09:30:02 +00:00
Zac Bergquist 4b9351cbe5
Enable xterm web links addon (#22043)
This renders links as <a> elements in the web-based terminal,
making them true clickable links.

Closes #7569
2023-02-21 21:08:22 +00:00
Marco André Dinis 8436ea949b
Discover: install ent image when cluster is enterprise (#21971)
Update the helm chart for kube-agent.
The image swap logic was already there.

Update the UI to include `enterprise: <isEnterprise>` when installing
the kube-agent.
2023-02-21 19:06:01 +00:00
Jeff Pihach 5eafe86fa4
Remove usage of lodash methods (#21567)
* Create new local util lib to replace lodash.

* Replace usage of isInteger and debounce from lodash with highbar.

* Create isObject and runOnce utility methods.

* remove use of at, isObject, and once lodash method usage.

* remove map and transform lodash calls.

* Add memoize function to highbar.

* remove memoize lodash usage.

* remove merge and isEqual lodash methods and update other missing refs to highbar.

* convert the throttle to debounce.

* add throttle method to highbar.

* use the new throttle method instead of debounce where necessary.

* Add mergeDeep function for init config merge.

* remove lodash from the build process.

* Fix introduced bug in workspacesService.

* Added tests for highbar mergeDeep and expanded its functionality to support arrays.

* review updates.

* Added types to mergeDeep function.

* Add missing MapCache prototype methods.

* Add license notices, types and missing hash code.

* First pass at compare an array objects function.

* use new compareArrayObjs fn

* Add missing not

* Added types to arrayObjectIsEqual

* Add tests for arrayObjectIsEqual and fix some edge case bugs.

* update util fn name
2023-02-21 17:25:36 +00:00
Zac Bergquist 346146a670
Clean up the MFA modal (#22045)
Change the text on the MFA dialog to be less alarming.
Additionally, focus the OK button by default, so that users can
press enter to go straight to the MFA prompt without manually
clicking a button.

Closes #19042
2023-02-21 15:15:34 +00:00
Rafał Cieślak 515638b5f9
Import jest-canvas-mock in teleport tests which import xterm paths (#22063) 2023-02-21 14:19:19 +00:00
Lisa Kim 1dae784ed4
[Web:Discover] Add missing checks (#21862)
* Add missing failed fetch token emit event

* Emit the correct discovered count for desktops
2023-02-17 20:13:52 +00:00
Rafał Cieślak 0cdfa0b0ef
Connect: Use SSH server UUID instead of hostname for file transfer (#21913)
* Add ResourceURI.GetServerUUID

* Use server UUID when calling TeleportClient.TransferFiles

* Mark removed FileTransferRequest fields as reserved
2023-02-17 10:24:12 +00:00
Justinas Stankevičius 0d9523d973
Relay child exit code in g-build (#21693)
Currently, g-build always exits with a status code of 0 (success),
breaking the expectations in shell scripts or pipelines.
2023-02-15 21:06:03 +00:00
Rafał Cieślak 05d18cc11d
Update teleterm README (#21797)
* Update teleterm README

* Remove the Usage section in favor of linking to the docs.
* Mention that the OSS build is broken.
* Remove post-webapps-merge inconsistencies.

* Remove "Gravitational", align teleterm desc with teleport
2023-02-15 14:26:30 +00:00
Grzegorz Zdunek 45add5c484
Connect: Link to docs in UsageData dialog (#21709)
* Link to docs in `UsageData`

* Replace "documentation" with "our documentation" in link
2023-02-13 16:32:26 +00:00
Justinas Stankevičius 94079bcd21
Improve webpack "exclude" expressions (#21663) 2023-02-13 15:44:58 +00:00
Yassine Bounekhla 92651b5c20
[Web] Fix missing --request-id= flag in UI for Kubernetes login instructions (#21444)
* fix missing request-id flag for kube login instructions

* add snapshot tests
2023-02-10 16:11:21 +00:00
Steven Martin 4d8e23bb12
Updates port validation to restrict to valid port numbers 1-65535 (#21566)
* Updates port validation to restrict to valid port numbers instead of just 4 digits

* lint fix

* comment updates

Co-authored-by: Yassine Bounekhla <56373201+rudream@users.noreply.github.com>

* variable change

Co-authored-by: Yassine Bounekhla <56373201+rudream@users.noreply.github.com>

* variable change

Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>

* number eval change

Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>

* error message change

Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>

* variable change

* remove comment

* update error message

---------

Co-authored-by: Yassine Bounekhla <56373201+rudream@users.noreply.github.com>
Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>
2023-02-10 15:48:58 +00:00
Yassine Bounekhla 6edb26c60f
[Web] Make language on mfa verify step dialog more clear (#20825)
* update text on dialog

* tweak language and overwrite error message

* address comments

* fix 'enter' to submit on newdevice form
2023-02-10 15:04:47 +00:00
Grzegorz Zdunek 9ed52c327d
Ask for job role on the second launch (#21402)
* Ask for job role on the second run

* Add tests

* Call `onCancel` in mock
2023-02-10 14:16:27 +00:00
Michelle Bergquist 8dfa07559b
capture custom role creation in prehog (#21123)
* add e2e role creation events

* add role name

* reset proto

* cleartext default role names

* constant
2023-02-09 19:23:29 +00:00
Ryan Clark ed5e8a7436
Change debug commands during discover flow (#21530) 2023-02-09 13:29:16 +00:00
Rafał Cieślak 94ec267823
Update JS grpc-tools to 1.12.4 (#21452)
* Update JS grpc-tools to 1.12.4

1.11.2 didn't have support for arm64 so we had to do all this extra stuff
in the Dockerfile.

1.11.3 added support for Darwin arm64 and 1.12.4 finally adds support for
Linux arm64. This means we can completely remove extra cruft and just
install grpc-tools 1.12.4 on all architectures.

* Add comment to ptyHostService.proto
2023-02-09 07:40:45 +00:00
Isaiah Becker-Mayer 5556af4a71
Fix uncaught errors in Desktop's Discover flow (#21343)
* Adds values for when labels aren't defined

* fixes formatting and prevents usePingTeleport from rerunning the poll when used twice within a single context

* Adds comments, pushes start logic into start itself

* polishing usePingTeleport api such that it reflects that either the join token or search term is used for search

* simplify and fix searchTerm bug
2023-02-08 18:13:01 +00:00
Jeff Pihach 3f75acb163
Add license headers to web files that were missing it. (#21315)
* Lint the web files but not node_modules or vendored files.

* Add license headers to web files that were missing it.

* Add missing licenses.
2023-02-07 16:27:31 +00:00
Rafał Cieślak 644e85336c
Move Connect-specific MenuLogin story out of shared package (#21157)
* Move Connect-specific MenuLogin story out of shared package

* Copyright 2019 -> Copyright 2023
2023-02-07 10:24:27 +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
Ryan Clark 9a605331f3
Remove timeouts from discover flows, fix desktop discovery (#20829)
* Allow for inputs to be disabled

* Remove timeouts from the discover workflows

* Correct the resource type to be cleared on unmount

* Update test snapshots

* Rename useJoinToken to useJoinTokenSuspender

* Remove TODO

* Simplify usePoll

* Simplify the hint box code, add a shared hook

* Add the generte command button back to db flow

* Store the joinToken in PingTeleportContext state instead of using the hook

* Fix rebase diff mistake

* Fix bug with polling for result

- once we get the result, we set the result
  back to null, so we can't proceed to next step

---------

Co-authored-by: Lisa Kim <lisa@goteleport.com>
2023-02-06 17:52:30 +00:00
Lisa Kim c7a11477ee
[Web:Discover] Report events (#20581)
* Define event types

* Define event names for each flow

* Report events upon start, exiting, and next steps

* Update json property name change

* Emit user skipped event

* Emit error events

* Handle unloading event for 'completed' step

* Move updating event state into hook

* Finish emitting events for desktop

* Address CR: rename DiscoverDesktop to DiscoverResources

* Various changes:

- address CR: remove use of ref
- diagnostic traces can also be a success, only emit event on failed traces
- add mysql to discover events
- consistent naming on exit prompt

* Update and add new event names

* Update tests

* Emit events for unimplemented flows (apps and other dbs)

* Redo emitting events for test connection

Send event for EACH test connection failure or success.
If a user does not do any testing, send a skipped event.
2023-02-03 19:30:56 +00:00
Ryan Clark 3c464d658a
Fix the navigation not listening to the back button (#21207)
* Fix the navigation not listening to the back button

* Update web/packages/teleport/src/Navigation/Navigation.tsx

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

* Allow for history.Location and Location types to be used

* Run prettier

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2023-02-03 17:12:39 +00:00
Rafał Cieślak 6e1a59bc25
Remove web/package.json, move scripts to package.json (#21134)
* Remove web/package.json, move scripts to package.json

Removed scripts:

Leftovers from webapps Dockerfile and CI on GCB:
- package-term-ci
- build-and-package-term-ci
- build-and-package-term
- nop

Leftovers from webapps Makefile, presumably:
- build-oss
- build-e

* Add back nop script

* Remove build-teleport* scripts
2023-02-03 15:34:57 +00:00
Rafał Cieślak 3ac5a0aedb
Refactor prehog & teleterm protos to match project conventions (#20810)
* Adjust go_package of lib/prehog Go protobufs

This makes them follow the pattern set out by api/proto and proto.

* Adjust go_package of lib/teleterm Go protobufs

* Use single buf.gen.yaml to generate JS protos

This also entailed changing the location of lib/teleterm protos and changing
the value of their package specifier to match the conventions in other parts
of the codebase. This is a breaking change but that is fine for Connect
as the protos are used locally only and each build ships with matching
protobufs.

* Make web/packages/teleterm use protobufs from gen-proto-js

We used to copy protobufs over to web/packages/teleterm/src/services/tshd
since webapps used to be in a separate repo.

This is no longer the case, so we can just make teleterm use protobufs
from gen-proto-js.

* Move prehog & teleterm protos into proto/teleport/lib

* Generate JS protos to gen/proto/js

* Move lib/teleterm Go protobufs to gen/proto/go

* Move lib/prehog Go protobufs to gen/proto/go

* Rename lib/teleterm proto package

* Re-enable linter rules for teleterm & prehog

* Update prehogv1 path in usagereporter_test.go

* Use except instead of ignore_only to allow Google API-style responses

* Add UNARY_RPC to api/proto & proto

* Ignore gen/ when running addlicense

* buf-js.gen.yaml: Remove comment about lack of go_package for JS

* Move prehog protos to proto/prehog/v1alpha

* Adjust prehog's go_package to match proto package
2023-02-03 14:47:06 +00:00
Rafał Cieślak 641eeb1942
Connect: Check for existence of update-*-database in after-install (#21063) 2023-02-03 14:46:18 +00:00
Jeff Pihach 26f6022689
Initial pass at lint and test GHA for UI. (#21110)
* Initial pass at lint and test GHA for UI.

* Fix lint

* Add --frozen-lockfile

* Skip the e directory if it doesn't exist while linting.

* Update failing snapshots.

* use a more reasonable filter for eslint to support missing e

* ignore type check on e imports.

* ignore failing file that requires e teleterm file.

* fix lint

* quiet down the log output for prettier-write.
2023-02-02 22:56:55 +00:00
Vitor Enes 74e366231a
Improve error message when trying to rename resource (#20413)
* Improve error message when trying to rename resource

This commit improves the error message when a user tries to rename a
resource (role, auth connector and trusted cluster) using the web UI.

* Fix tests

* gofmt

* resourceExists -> getResource

* Improve comment.

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

* Improve error message

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2023-02-02 20:50:17 +00:00
Grzegorz Zdunek ce86ad57ee
Connect: fix "Connect a Cluster" screen flash (#20988)
* Render loading screen when initialization is in progress

* Wait with showing the window until it is ready to prevent "empty screen" flash

* Add comments
2023-02-01 08:21:41 +00:00
Steven Martin fd90bc9b5f
Open Support links in UI to new page (#20926) 2023-01-31 12:19:32 +00:00
Grzegorz Zdunek 34e9b44880
Connect: add env file for dev/prod vars, use prehog staging only in dev environment (#20768)
* Create env file for dev/prod vars

* Rename `ENV` to `staticConfig`

* Simplify condition
2023-01-30 15:38:45 +00:00
Ryan Clark d699603519
Fix the navigation not allowing switching back to resources (#20812)
* Fix the navigation not allowing switching back to resources

* Remove redundant state update
2023-01-30 15:01:08 +00:00
Isaiah Becker-Mayer c4eabb48c4
Removes the "overflow: auto" from StyledXterm (#20747)
thus setting it to "overflow: hidden", which prevents it from
outgrowing its parent component.
2023-01-27 22:47:58 +00:00
Isaiah Becker-Mayer ec527ef926
Adds a refresh icon to the playback bar (#20745) 2023-01-27 22:43:53 +00:00
Ryan Clark 4c83a1d7fc
Stop the support link pretending it's a dropdown (#20819) 2023-01-27 18:34:49 +00:00
Yassine Bounekhla 72bc16b3b4
fix lint error (#20827) 2023-01-27 16:54:14 +00:00
Rafał Cieślak ea1fc22045
Connect update xterm to 5.1.0 and xterm-addon-fit to 0.7.0 (#20767)
This makes teleterm match the versions used by teleport.
2023-01-27 12:10:37 +01:00
Yassine Bounekhla 4a90ff4632
[Web] Add support for Moderated Sessions in the Web UI (#20782) 2023-01-26 23:18:26 +00:00
Lisa Kim 83cf369e6b
[Web:Discover] Enable mysql for aws (#20753) 2023-01-26 19:02:34 +00:00
Grzegorz Zdunek 3a0fc94aa6
Connect: wait for process to exit before closing app (#20673) 2023-01-26 14:34:14 +00:00
Rafał Cieślak 6791b48da9
Remove grpc-teleterm Make target and Dockerfile-teleterm (#20032)
* Remove CLANG_FORMAT from Makefiles

It was used to format protos but we use Buf for that since v10.

* Move installing grpc_node_plugin into Dockerfile

This commit basically takes grpc_node_plugin compilation from
Dockerfile-teleterm and moves it to Dockerfile.

* Replace Dockerfile-teleterm with Dockerfile

After moving grpc_node_plugin compilation to Dockerfile, the only remaining
thing that Dockerfile-teleterm does is installing rpm so that we can make
an RPM package for Connect during tag builds.

Installing this package can be simply moved to Dockerfile.

* Remove grpc-teleterm Make target in favor of grpc

* Add updated protobufs

It looks like they're a result of someone changing protos in lib/prehog
without running `make grpc-teleterm` separately. Which is why we're getting
rid of grpc-teleterm as a separate Make target in the first place. ;)
2023-01-26 09:41:07 +01:00
Lisa Kim 09d3e38453
[Web:Discover] Enable mysql flow (#20719)
* Change default port based on db type
* Require db name for postgres only for testing connection
2023-01-26 02:37:02 +00:00
Nic Klaassen a15f3f44e9
feat: frontend support for login rule audit events (#20722)
This PR adds frontend support to nicely display login rule audit events. I followed the guide [here](https://github.com/gravitational/teleport/tree/master/web#adding-an-audit-event) and mostly copied the types used for the role create/delete events.
2023-01-25 22:17:36 +00:00
Jeff Pihach b21204e9ff
Move storybook to root package.json and fix config so e components are rendered. (#20723) 2023-01-25 20:31:14 +00:00
Zac Bergquist 3cefb38890
Update xterm-addon-fit (#20696)
This resolves an issue when starting an SSH session from the web UI,
and also fixes the out-of-date lock file.
2023-01-25 20:05:58 +00:00
Ryan Clark 42ec01c88a
Refactor features, implement new design for navigation & user menu (#20553) 2023-01-25 17:53:59 +00:00
Ryan Clark 27ad839d47
Move jest, eslint & prettier to the root (#20698)
* Move jest, eslint & prettier to the root

* Update e ref
2023-01-25 17:19:22 +00:00
Rafał Cieślak 9b7355cd20
Connect: Add useWorkspaceLoggedInUser (#20552) 2023-01-24 15:31:39 +00:00
Jeff Pihach 0f21a8b8e3
Resolve issues to enable passing CI tests. (#20582)
* Move lint commands to root package.json

* Correctly resolve e-teleport paths.

* Fix prettier issues.

* move eslint configuration files to root.

* resolve lint errors.
2023-01-23 22:06:56 +00:00
Tiago Silva 10da451dd6
Add support for subResourceName to teleterm (#20541)
Initial support for `subResourceName` when listing resource access requests for `type=pod`.
2023-01-23 15:06:01 +00:00
Rafał Cieślak b94edcf450
Move tsconfig.json to root dir, remove web Makefile and Dockerfile (#20399)
* Move tsconfig.json to root dir

At the moment, it looks like the TS language server has problems with
recognizing imports when editing files inside e/web.

I figured this is probably because tsconfig.json is in web, so the lang
server doesn't recognize it when editing files from e/web.

* Remove web/Dockerfile and web/Makefile

* Misc updates to readme

* Fix links in readme
2023-01-23 11:50:16 +00:00
Michael Wilson 72e044c880
Decode URL encoded values from AppLauncher's ARN. (#20387)
The new app access authentication workflow inadvertently preserves the URL
encoded values present in the AWS role ARN, which are then passed directly
to the webapi/sessions endpoint. As a result, Teleport RBAC doesn't properly
match AWS role ARNs, as they contain (in particular) `/` characters encoded as
`%2F`.
2023-01-20 13:56:40 +00:00
Michael d9d61e859b
Add .prettierrc to teleport root (#20448) 2023-01-19 17:17:55 -06:00
Jeff Pihach 34f102bdeb
Enable building teleport with the new UI location (#20361)
* Changes for merging webapps into teleport.
2023-01-18 22:22:25 +00:00
Rafał Cieślak fd88f686f3 Update e ref (#1526) 2023-01-18 16:06:58 +01:00
matheus f1e0617e1d Update e ref (#1521) 2023-01-13 21:15:05 +00:00
Lisa Kim e120a945b4 Add device trust events (#1517) 2023-01-13 19:35:39 +00:00
Grzegorz Zdunek 834cf0e059 Connect: Ask for user job role (#1491) 2023-01-13 16:10:35 +01:00
Rafał Cieślak 7e988cdb3d Add --quiet to eslint package.json script (#1510)
By default, eslint outputs warnings as well as errors but doesn't sort
them in any way. When the lint step fails in CI because of an error, it's
hard to find that error among warnings.

The warnings are still useful when they show up in the editor, so let's
add --quiet which makes eslint output only errors and no warnings.
2023-01-13 14:22:38 +00:00
Ryan Clark 2a142742b5 Change the application access authentication flow (#1278)
* Simplify the app launcher flow

* Use `X-Cookie-Value` header instead of using a cookie name

* Export AppLauncher as default to allow for lazy loading

* Do not include credentials

* Include the port & credentials when making requests to applications

* Add the subject cookie header

* Update packages/teleport/src/AppLauncher/AppLauncher.tsx

Co-authored-by: Lisa Kim <lisa@goteleport.com>

* Handle the ?path= query param

* Remove `useAppLauncher`

* Improve the error handling

* Remove unused import

Co-authored-by: Lisa Kim <lisa@goteleport.com>
2023-01-12 21:23:49 +00:00
Isaiah Becker-Mayer 99914cf059 Fix clipboard permissions apparent inconsistency (#1509) 2023-01-12 18:02:51 +00:00
Yassine Bounekhla 25177ab6ba Revert "Use sessionStorage for Authentication Bearer Token (#1275)" (#1505) 2023-01-11 14:17:04 -05:00
Michelle Bergquist 9b23ff6aaf capture additional prehog events (#1466) 2023-01-11 10:48:19 -07:00
Yassine Bounekhla 5df7ae9176 Refactor clusters service (#1501)
* refactor clusters service
* remove unused import
2023-01-10 16:12:52 -07:00
Grzegorz Zdunek 53da3a19c4 Connect: Collect usage events (#1451) 2023-01-10 18:29:23 +01:00
matheus 1604aae4ab Add downloads page (#1452) 2023-01-10 14:11:16 -03:00
Rafał Cieślak f2a05c9187 Update Electron to 22.0.0 (#1498) 2023-01-09 10:28:04 +00:00
Lisa Kim 3692fc3295 [Discover] Temp remove db service checker until bug is fixed (#1495)
* Fix bug where matcher label ret val can be string or array
* Add a skip button to skip adding db service (since we removed checker)
2023-01-06 10:44:46 -08:00
matheus 8e8125bfa0 Make trusted cluster screen hidden based on user roles (#1484)
* Make cluster screen role-based. Add methods to access request_access permissions
2023-01-06 12:04:43 +00:00
Michael 26c645a9c4 Update sessionPath value to new endpoint (#1486) 2023-01-05 12:23:46 -06:00
Lisa Kim e38f665de5 [Discover] Add database service checker and various db tweaks (#1481)
* Create ToolTipInfo component
* Update FieldInput to accept optional tool tip content
* Temp fix for story viewing timed out polling state
* Support different informational texts depending on database
* Add database service checker to determine if we can skip next step
* Enable AWS RDS postgres flow
2023-01-05 06:47:22 +00:00
Rafał Cieślak 87ffebf7f8 Make bundled tsh available outside of Connect (#1445)
* Rename assets to build_resources

* Add resources\bin to Path during installation on Windows

* Adjust docs related to USE_SYSTEM_FPM

It turns out you need that for deb packages too.

* Create symlink to bundled tsh on Linux targets

* after-install: Get rid of old symlink removal

* Expand story for QuickInput

* Make command suggestions stay in place

* Align suggestion icons to the top rather than center

This makes it easier to tell when one suggestion ends and another starts.

* Add install & uninstall cmds to command bar

* Exclude new commands from OSes other than macOS

* Implement commands for symlinking tsh
2023-01-04 17:05:47 +00:00
Grzegorz Zdunek 4f037f0630 [Connect] Update protofiles to support authClusterId (#1483) 2023-01-04 15:12:27 +01:00
Rafał Cieślak 40b901a96e Connect: Add missing modal stories, misc modal fixes (#1479)
* Group all modal stories under ModalsHost

* Fix type of DialogClusterConnect, rename DialogBase to DialogNone
2023-01-04 10:15:17 +00:00
Rafał Cieślak de66460718 Notifications: Add showcase story, fix types & icon alignment (#1474) 2023-01-04 09:50:10 +00:00
Lisa Kim a5cbd0a8b7 [Discover] Implement the IAM policy screen (#1459) 2023-01-03 23:59:22 -08:00
Michael 6e63d3658b [Connect] Update protofiles and webapps.e to support suggestedReviewers and requestableRoles (#1449) 2023-01-03 16:36:55 -06:00
Lisa Kim b1457b048b [Discover] Tweaks based on design review and regression fixes (#1433)
* Change placement of info content for SetupAccessWrapper
* Create AnimatedProgressBar
* Allow fixed labels for LabelsCreater
* Fix a regression where events were getting passed
  down to nextStep function on button click (expected number)
* Add matching label rule for DB DownloadScript
* Add a modal loader for CreateDatabase (also add port input field)
    - Add countdown and error to this modal
2023-01-03 20:36:42 +00:00
Steven Martin 987aaf98d3 Include session id in Session Uploaded event (#1475) 2023-01-02 23:20:17 +00:00
Isaiah Becker-Mayer fa3dd60667 awaits the file write and close to avoid data corruption (#1471) 2022-12-30 09:05:25 -08:00
Zac Bergquist b0ac4cf409 Fix websocket close (#1463)
In #1442 we added a close code when closing websockets, but didn't
properly adhere to the API. When explicitly setting a close code,
you must either use the normal code or use a custom code. Usage of
the standard codes in the 1001-1015 range is reserved for the browser.

Fixes gravitational/teleport#19688

Co-authored-by: Isaiah Becker-Mayer <isaiah@goteleport.com>
2022-12-29 11:23:19 -07:00
Gavin Frazar 601f97ada6 Add dynamodb event formatting (#1461)
* Add dynamodb event formatting
2022-12-29 05:14:24 +00:00
David Janda 4110794acd Display instructions for connecting to a database with passwordless auth 2022-12-23 15:40:58 +00:00
Michael 80ed096f17 [Connect] Use resourcesList in review access request table (#1430) 2022-12-21 19:10:20 -06:00
Rafał Cieślak d171bf73e4 Connect: Use default config in main process fixtures (#1450)
This unbreaks some Connect stories which depend on keyboard shortcuts
config.

If we ever need to change the config in stories or tests, we should
revisit the mock. But it might be enough to call the `set` method on
the config service.
2022-12-21 11:41:07 +00:00
Isaiah Becker-Mayer 16a9862c78 Adds a status code to the closing of the tdp client's websocket (#1442) 2022-12-21 00:01:50 +00:00
Grzegorz Zdunek 41020cc29c Connect: Store installation ID (#1443) 2022-12-20 18:55:12 +01:00
Yassine Bounekhla 6872c9e6d3 Use sessionStorage for Authentication Bearer Token (#1275) 2022-12-16 22:38:26 +00:00
Lisa Kim 843567498a [Discover] Add all db options to db selector (#1441)
* Refactored add db modal to accept a selected database 
  resource and removed drop down selector
* Unimplemented db flow will fallback to the refactored 
   modal
* Enabled self-hosted postgres flow
2022-12-16 19:23:59 +00:00
Ryan Clark 5bab34f3c1 Change Discover navigation & flow to be dynamic from the user's selection (#1379) 2022-12-16 17:49:56 +00:00
Mike Jensen 2250138850 Add Dependency Review Action (#1437)
This action is documented on shared-workflows here: de06c07914/.github/workflows/dependency-review.yaml (L1-L9)
2022-12-15 17:24:07 +00:00
Grzegorz Zdunek ed135ae92a Connect: Add UsageData dialog (#1404) 2022-12-15 16:38:10 +01:00
Grzegorz Zdunek 5267ae8dba Connect: Add config file (#1403) 2022-12-15 15:50:54 +01:00
Rafał Cieślak 3341950aeb Update electron-builder to 24.0.0-alpha.5 (#1434) 2022-12-15 09:42:02 +00:00
Rafał Cieślak f21ebd1139 Connect: Use typed URIs (#1394)
* Remove ClustersService methods related to apps

I had problems with the new types and apps because I didn't create a
separate type for app URI. So I decided to remove it all because it isn't
used anyway.

* Remove WorkspacesService.getWorkspacesDocumentsServices

This method wasn't used anywhere since #1203 got merged.
2022-12-14 17:19:59 +01:00
Lisa Kim 67e5179300 [Discover] Implement mutual TLS screen (#1418) 2022-12-14 07:14:39 +00:00
Noah Stride bd40cad5cf Add support for InstanceJoin and BotJoin audit events (#1414)
* Add support for InstanceJoin and BotJoin audit events

* Update snapshot and add advice on doing so

* Add newline back to package josn
2022-12-13 21:11:54 +00:00
Yassine Bounekhla 83f5e17e74 Allow for specifying roles when making Resource Access Requests (#1321) 2022-12-09 17:19:53 +00:00
Gavin Frazar b3accec7fa Add subject value to app sessions (#1413)
* Add opaque value

* Rename opaque -> subject
2022-12-09 01:04:41 +00:00
Michelle Bergquist 10c6095eda alert convention matches grpc (#1424) 2022-12-08 15:45:06 -07:00