Commit Graph
1103 Commits
Author SHA1 Message Date
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 ZdunekandRafał Cieślak 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 ZdunekandRafał Cieślak 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 ZdunekandRafał Cieślak 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
MichaelandJeff Pihach 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 KimandYassine Bounekhla 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