Commit graph

12803 commits

Author SHA1 Message Date
Zac Bergquist 5fe9617fcf
Fix cluster alerts timeout (#25261)
tsh shows clusters alerts for both `tsh login` and `tsh status`.
We intentionally used a short (500ms) timeout to avoid slowing down
`tsh status` which was previously an "offline" command.

As a side effect, cluster alerts would not always show on login if
they took longer than 500ms to fetch.

This change ensures that we always wait for cluster alerts to come
back for `tsh login`, but we still enforce a short timeout for the
`tsh status` command. (The timeout was increased slightly since the
context now wraps the entire command and not just the cluster alerts
call)

Fixes #25239
2023-04-27 22:12:14 +00:00
Walt f7db99217b
Pin the plugins/slack image for unmanaged pipelines (#25213)
The latest version of this image has a regression where it reports
builds as successful even when they've failed.
2023-04-27 19:47:58 +00:00
Alan Parra b4e5d788c4
Record and verify WebAuthn RPIDs (#25238)
* Add the credential_rp_id field to WebauthnDevice

* Update generated protos

* Record credential RPID on registration and login

* React to unexpected RPIDs when issuing challenges

* Log number of allowed credentials

* Fix TestServer_CreateAuthenticateChallenge_authPreference

* Use slices.Delete

* Try to appease the flaky test detector
2023-04-27 18:58:21 +00:00
Przemko Robakowski 75df7682e5
Add non-AD tests to test plan (#25266) 2023-04-27 18:49:22 +00:00
Edoardo Spadolini c5a720aa47
Use the correct emitter in auth.TLSServer (#25265) 2023-04-27 16:04:09 +00:00
Krzysztof Skrzętnicki abcd527641
Fuzz TDP protocol, fix two issues. (#25260)
* Add FuzzDecode covering tdp protocol.

* Add FuzzDecode to oss-fuzz

* Limit PNG2Frame size.

* Fix decodeSharedDirectoryAnnounce incorrectly consuming 4 extra bytes.
2023-04-27 15:13:21 +00:00
Tiago Silva a2565e6c56
Fix TestAuthSignKubeconfig test (#25251)
This PR parallelizes the test and removes the requirement of using a
HTTPS proxy to intercept the calls to proxy's ping endpoint.

It also introduces simplifications and improves the test readability.

Fixes #18882
2023-04-27 14:32:22 +00:00
Tobiasz Heller 28e7e88f00
Fix dynamo TestEmitAuditEventForLargeEvents (#25256)
* Fix dynamo TestEmitAuditEventForLargeEvents

* extend test plan
2023-04-27 14:11:34 +00:00
Tiago Silva d6af208bf6
Extend cross-account discovery for EKS clusters (#24905)
This PR adds support for cross-account EKS auto-discovery.

Database Access: #22866
2023-04-27 09:57:14 +00:00
Tiago Silva 9ab997f21d
Add option to override kube context on tsh kube login (#24972)
This PR allows users to change the kubeconfig's context name when `tsh
kube login` is executed.

It allows users to override our default naming convention
`{teleport-cluster}-{kube-cluster}` and replace it with a custom name.

`tsh kube login cluster --set-context-name=ctx` overrides the context
name to `ctx`. `--set-context` cannot be executed with `--all`.

Fixes #12833
2023-04-27 09:50:01 +00:00
Yassine Bounekhla 98d3eeefb4
update e-ref (#25232) 2023-04-27 02:17:46 +00:00
Brian Joerger 1185948d2d
Fix underlying reader not a terminal issues (#25102)
* * Use Stderr during headless login to fix rsync compatibility

* Improve error messages when attempting to login without a terminal

* Skip MOTD acknowledement when logging in without a terminal (headless,
  sso)

* When attempting re-login without a terminal, make a debug log and
  return the original error

* Return access denied error on unexpected handshake failures in tsh
  proxy ssh

* Fix TestProxySSH test and add it to the flaky test detector testsToSkip
list.
2023-04-27 00:20:49 +00:00
Andrew Burke 7a90a0ff99
RFD for GCP IAM join/auto discovery. (#23946) 2023-04-26 20:59:45 +00:00
Yassine Bounekhla 4a2b422b1a
redesign participant modes join menu (#24961) 2023-04-26 20:10:08 +00:00
Yassine Bounekhla e34dc0f622
update eref (#25229) 2023-04-26 18:52:18 +00:00
Steven Martin 648ef7a349
Show <1m for remaining tsh status valid time for last minute (#25151)
* Show <1m for remaining tsh status time instead of 0s

* simplify time check

* logic change

Co-authored-by: Russell Jones <russjones@users.noreply.github.com>

---------

Co-authored-by: Russell Jones <russjones@users.noreply.github.com>
2023-04-26 17:56:16 +00:00
Yassine Bounekhla 1d7785971e
theme-related fixes (#25119) 2023-04-26 17:55:46 +00:00
Brian Joerger 0ae212cf0a
* Save ssh_service.public_addr values to Server.PublicAddrs instead of discarding them (#24070)
* Use Server.PublicAddrs when checking if session MFA is required

* Deprecate server PublicAddr in favor of PublicAddrs
2023-04-26 17:35:33 +00:00
Gavin Frazar 704a104397
Move db cert renewal message to debug log (#25097) 2023-04-26 16:41:36 +00:00
Nic Klaassen e1d23053d0
fix: avoid inadvertent deletion of active HSM keys (#25025)
This is a partial fix for #25017

The latest version of the YubiHSM2 SDK has changed the behavior for keys
longer than 2 bytes, which used to be silently truncated for all
operations.
This causes an unfortunate interaction with `DeleteUnusedKeys` when the
SDK is upgraded in an active Teleport cluster.
Because none of the active keys can be queried from the HSM
individually by their ID, but they can be listed by their label, all of
the active keys end up being deleted.
Yeah that's bad.

`DeleteUnusedKeys` is written this way in an attempt to be "stateless".
Trying to synchronously delete keys at the instant they are
rotated out during a CA rotation would be error-prone.
If the auth server were to restart or crash at the wrong moment, you
could be left with an orphaned key on your HSM forever, with no
reference to it stored by Teleport or anywhere else.

Instead, the Auth server labels all keys it creates with its own host
UUID.
Then periodically (during startup) it lists all keys in the HSM that are
labeled with its own UUID, and if they are not currently active, deletes
them.
This goes catastrophically wrong when individual lookup operations fail,
but list operations succeed.

The fix here is to avoid deleting any keys if any single lookup fails.

The YubiHSM2 SDK version 2023.1 is still not supported, but with this
fix at least we won't delete any active keys.
2023-04-26 16:31:49 +00:00
Michael Wilson c866918735
Update e ref. (#25190)
Update e ref so that enterprise is compatible with the changes to the
OktaAssignment object.
2023-04-26 16:00:29 +00:00
Steven Martin 3d17be5a1d
docs: add information on viewing status and logs for systemd service (#25139) 2023-04-26 15:22:09 +00:00
Michael Wilson 892883fbcd
Simplify Okta assignment statuses. (#25166)
* Simplify Okta assignment statuses.

The Okta assignment statuses have been simplfieid so that there's only a
status on the Okta assignment object itself and the number of states is
reduced.

* Fix tests, remove unused code.

* Add in Duration for update statuses to prevent changing status too soon.

* Make sure LastTransition is UTC.

* Remove actions in favor of targets, make cleanup time non-nullable.
2023-04-26 13:30:10 +00:00
Grzegorz Zdunek 5bf72af28a
Connect: Fix logout sequence (#24978)
* Fix logout sequence

* Adjust `useLoggedInUser` documentation

* Mark clusters as disconnected after logging out

* Refactor `ClusterLogout` to not use the hook/container pattern

* Run prettier

* Fix test

* Use `routing.belongsToProfile`
2023-04-26 10:01:08 +00:00
Rafał Cieślak 839afa8509
Account for request errors when displaying "no results" message in the search bar (#25061)
* Render ExtraTopComponent based on computed action picker status

* Fix formatting

* Use named args for getActionPickerStatus

* Use const for nonRetryableResourceSearchErrors

* Fix logic behind determining remaining filters
2023-04-26 09:52:52 +00:00
Rafał Cieślak e32a3e5207
Retry search in Connect if current workspace cert has expired (#24880)
* Adjust copy of db action

* Use retryWithRelogin when getting db usernames

* useAsync: Remove unnecessary useCallback

The state setter coming from useState is always stable.

https://legacy.reactjs.org/docs/hooks-reference.html#usestate

* useAsync: Expand docs with `run` return value example

* useSearch: Rename `restrictions` to `filters`

* useSearch: Remove unnecessary useState calls

* Refactor lockOpen into pauseUserInteraction

lockOpen worked great when we were concerned only about user interaction
with a modal closing the search bar as well. However, in the next commit
I'm going to add a login modal that's shown if the search fails with a
retryable error.

In that scenario, pressing Enter in the modal wouldn't work, as it would
be captured by the window listener that ResultList adds.

To work around this problem, I refactored lockOpen into pauseUserInteraction.
It still works pretty much the same way. But then instead of having checking
isLockedOpen in the close function, we have a new addWindowEventListener
function.

addWindowEventListener automatically removes the listener after
pauseUserInteraction is called. This solves both the problem of closing
the modal and the problem of using the enter key in the modal.

* Relogin & retry resource search if current workspace cert has expired

* addWindowEventListener: Name the cleanup function

* Make addWindowEventListener a prop of ResultList
2023-04-26 08:31:53 +00:00
Walt a3c528785a
Clean up Drone slack notifcations (#25133)
* Pin the plugins/slack image for dronegen pipelines

The latest version of this image has a regression where it reports
builds as successful even when they've failed.

Fixes https://github.com/gravitational/SecOps/issues/317

* Rework slack notifications in dronegen

Remove the call to action language, and leave only the relevant links.

Flatten several short lines into one longer line.  This allows the
entire message to render without needing to expand it.

* Rework slack notifications in unmanaged pipelines

Remove the call to action language, and leave only the relevant links.

Flatten several short lines into one longer line.  This allows the
entire message to render without needing to expand it.
2023-04-25 23:38:36 +00:00
Walt 7a15440fc7
Bump gh-trigger-workflow timeout to 2h30m (#25005)
We're regularly seeing workflows queue for 40 minutes and then fail to
finish within the 1 hour timeout window.

The teleport repo has a hard limit configured at 3 hours.  So 2:30 gives
plenty of leeway for checkout before and sending the slack notification
after.
2023-04-25 20:51:13 +00:00
Michael Wilson e4960017a8
Add SAML IdP to test plan. (#25150)
The SAML IdP feature has been added to the test plan.
2023-04-25 20:20:25 +00:00
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
rosstimothy 1f527cba02
Avoid prompting users for mfa when using tsh ssh --headless (#24701)
* Avoid prompting users for mfa when using `tsh ssh --headless`

* add mfa+headless test
2023-04-25 17:29:39 +00:00
Tobiasz Heller 1b34cefb83
athena audit logs - delete from sqs (#24967)
* athena audit logs - delete from sqs

* rework to table tests
2023-04-25 17:05:47 +00:00
Nic Klaassen 59ebccb538
docs: Login Rule k8s operator docs (#23888)
* docs: Login Rule k8s operator docs

* apply Tiago's suggestions

* minor edits

* add loginrules to cspell.json

* address code review comments

* explicitly mention enterprise instructions

* fix lint

* consolidate CRD check into prereq bullet

---------

Co-authored-by: alexfornuto <alex.fornuto@goteleport.com>
2023-04-25 16:55:29 +00:00
Steven Martin 5a2ef4b476
Update headless tsh command descriptions (#25093)
* Update headless tsh command descriptions

* update request ID parameter description

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

---------

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2023-04-25 15:13:05 +00:00
STeve (Xin) Huang c9b0a601ab
TLS routing behind LB support for IAM join (#23974)
* TLS routing behind LB support for IAM join

* minor beautify

* add test for verifyALPNUpgradedConn

* use getHostAddresses(params)[0]
2023-04-25 14:02:45 +00:00
Andrew LeFevre e343989f52
fix session recordings from Web UI to agentless nodes having name set as node UUID (#25109) 2023-04-25 13:22:48 +00:00
Tobiasz Heller d3c6017955
athena audit logs - parquet writer (#24805) 2023-04-25 11:59:21 +00:00
Tobiasz Heller e93c6a975c
athena audit logs - sqs receive (#24038) 2023-04-25 10:16:15 +00:00
Zac Bergquist 7d06c8b8f2
Update e ref (#25128) 2023-04-25 02:29:54 +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
Steven Martin 4cf53ec3a9
docs: append cluster name for example ansible hosts list (#25037)
* docs: append cluster name for example ansible hosts list

* Use variable for cluster name

* language update

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

---------

Co-authored-by: Paul Gottschling <paul.gottschling@goteleport.com>
2023-04-24 21:29:27 +00:00
Paul Gottschling 09fa42815f
Add headings to the Cloud FAQ (#25065)
Closes #12506

This change adds H2-level headings to the Cloud FAQ page in order to
help users navigate the page. The order of headings is based on my guess
as to the importance of each topic.

This change does **not** attempt to refresh the content of each
question/answer entry, but will make it easier to update the page in the
future since the page should be easier to navigate.
2023-04-24 21:13:02 +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
Hugo Shaka 6d78efb4b0
helm: mount kube ca certs through projected volumes (#25034)
* helm: mount kube ca certs through projected volumes

* fixup! helm: mount kube ca certs through projected volumes
2023-04-24 19:43:05 +00:00
Paul Gottschling fe05e6e749
Document relative link paths in partials (#25011)
* Document relative link paths in partials

Closes #18155

Add a section to the docs UI reference explaining how relative path
evaluation works for partials.

* Linter fix
2023-04-24 19:41:47 +00:00
Paul Gottschling bb1f9899c1
Alphabetize the GUI Client page (#25013)
Closes #20018
2023-04-24 19:38:31 +00:00
Brian Joerger 40ba8f3879
Headless Login explicit username (#24689)
* Return an error if user is not explicity set for headless login.

* Add test.

* Resolve comments.

* Fix typo.
2023-04-24 19:36:32 +00:00
dependabot[bot] e2efb22deb
Bump github.com/aws/aws-sdk-go-v2/service/rds from 1.42.3 to 1.43.1 (#25039)
Bumps [github.com/aws/aws-sdk-go-v2/service/rds](https://github.com/aws/aws-sdk-go-v2) from 1.42.3 to 1.43.1.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/rds/v1.42.3...service/ec2/v1.43.1)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/service/rds
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-24 18:10:37 +00:00
Brian Joerger a84bab8bd2
[RFD] Proxy Templates update: cluster switching and tsh ssh parity (#24586)
* Update proxy templates rfd to include cluster switching section and tsh ssh section.

* Resolve comments.
2023-04-24 17:52:04 +00:00
Michael Wilson 5d6b5adca4
Add login hooks. (#24828)
* Add login hooks.

Login hooks have been added to support performing arbitrary operations on
user login. This is done to support generating of an Okta assignment on
user login for the Okta service feature.

* Don't use error channel for calling hooks, test login hooks.

* Expose ResetLoginHooks for external testing.

* Provide user as part of login hook.

* Update lib/auth/methods.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Improve the documentation for LoginHook, AuthenticateUser returns types.User.

* Use user.GetName() instead of username in AuthenticateSSHUser response.

* Address nits and restore comments.

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2023-04-24 17:26:45 +00:00