Commit Graph
1021 Commits
Author SHA1 Message Date
STeve (Xin) Huang f0efebb651 pgx migration: use pgx v5 for postgres.MakeTestClient (#65476)
* pgx migration: use pgx v5 for postgres.MakeTestClient

* update go.mod

* add a ping to pgx pool

* format files
2026-04-08 12:37:06 +00:00
Edoardo Spadolini 825b23049e session-helper: move srv.RunAndExit to session/reexec (#65263)
* Move the reexec parts of lib/srv to session/reexec

* Update references to the moved bits of lib/srv

* Avoid testutils in session/reexec

* Shuffle some constants around to avoid imports in session/reexec

* Vendor in the relevant parts of logutils in session/reexec

* Remove unnecessary symlink checks when opening files

* Inline the last two things from lib/utils in session/reexec

* Inline moved constants

* Deprecate group name consts and fix missed inlines

* Add missing session/reexec.TestMain with reexec check

* Reuse existing constants from the log constants package in session

* Fix broken godoc link
2026-04-08 09:40:52 +00:00
306b6a9db0 Set Teleport version in SSH clients (#65004)
* Set Teleport version in SSH clients.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Add more tests. Fix lint.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix import. Fix lint exclude.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix lint - come on!

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix race by making a defensive copy.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Use ErrorIs.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Deep clone client conf. Early return for err. Make consistent.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Return new conf if nil. Add trace.Wrap to missing.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Add IsSSHFeatureSupported. Switch from api to api_test for test pack. Make prefix exported const.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Revert accidental commit.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Return sentinel error for older clients or non-teleport clients to improve downstream handling.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Clean up.

Co-authored-by: Chris Thach <chris.thach@protonmail.com>

* Apply suggestions from code review

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@gmail.com>

* Remove defensive check.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Change from trace.BadParam to reg error.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Use strings.Cut and improve readability.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Use error struct.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Add test that errors if ssh.ClientConfig changes.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Move to subpackage.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Use static assertion instead.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Return error if config is nil.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Allow clients to override client version via config.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix test because I forgot to update it.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Move assert to test file.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Remove error return val.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Relax parser to allow for more.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix lint.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* WIP take on a tracessh wrapper. Will fail CI.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Add tests and polish new package.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Revert changes to tracessh. Add lint config.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Revert changes to use tracessh.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Delete extra s.

Co-authored-by: Chris Thach <chris.thach@protonmail.com>

* Apply suggestions from code review.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Add IsEmpty helper methods.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* First pass of refactoring.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Second pass refactor.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Third pass refactor.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix nil panic.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix missing user value.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix missing User value.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Remove Get from name. Polish.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix incorrect signers for clients. Make changes consistent.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Allow ClientConfig to be empty in proxy config.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix eager signers regression in generateClientConfig.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Add edge case for space after prefix.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix issues from code review.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Drop suffix. Update comments.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Update ClientConfig docs.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Add warning about using the Teleport version.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Teleport version is mandatory.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Revert timeout to make Claude/Codex happy.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Remove alias in places that didn't need it. Revert lib/cloud/gcp/alloydb.go.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Add wrapper for tracessh.Client.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Add tests for generate client config.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Drop config from field name to shorten.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Fix lint issues.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

---------

Signed-off-by: Chris Thach <chris.thach@goteleport.com>
Co-authored-by: Edoardo Spadolini <edoardo.spadolini@gmail.com>
2026-04-07 18:06:00 +00:00
Tiago SilvaandNic Klaassen e54bfb9ab7 enforce region validation on all AWS config loading (#64893)
* enforce region validation on all AWS config loading

Replace direct uses of `github.com/aws/aws-sdk-go-v2/config.LoadDefaultConfig`
with the internal `lib/cloud/aws/config.LoadDefaultConfig` wrapper, which
validates any explicitly requested AWS region before use. Enforces this via a
new forbidigo linter rule.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* Apply suggestions from code review

Co-authored-by: Nic Klaassen <nic@nicklaassen.ca>

* fix unit tests

* include underscores and uppercase letters

* add ConfigureRegion

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
Co-authored-by: Nic Klaassen <nic@nicklaassen.ca>
2026-04-07 08:48:47 +00:00
Edoardo Spadolini 644f415a27 session-helper: submodule preparation and dependencies of lib/srv/reexec.go (#65145)
* Depguard rules for the session submodule

* Move lib/auditd to session/auditd

* Move lib/loginuid to session/loginuid

* Reduce dependencies of lib/utils/envutils

* Move lib/utils/envutils to session/envutils

* Split the SSH utilities of sshutils/x11 into sshutils/x11forward

* Move lib/sshutils/x11 to session/networking/x11

* Move lib/sshutils/networking to session/networking

* Move lib/shell to session/shell

* Move lib/utils/uds to session/uds

* Move lib/utils/host to session/host

* Move lib/pam to session/pam

* Avoid lib/utils/log in session/pam

* Move lib/service/servicecfg.PAMConfig to session/pam/pamcfg.PAMConfig

* Move lib/srv/uacc to session/uacc

* Avoid importing lib/utils in session/uacc

* Move lib/selinux to session/selinux

* Avoid lib/utils and lib/utils/log in session/selinux

* make go-mod-tidy-all

* Update oss-fuzz path for session/networking/x11
2026-04-01 12:34:10 +00:00
Grzegorz Zdunek c0a66f3344 Connect: verify signature in privileged updater against hardcoded Windows signing cert (#64754)
* Make `verifySignature` compare subject against fixed cert

* Adjust tests

* Update README.md
2026-03-23 15:40:10 +00:00
Nibras Ohin e69e793d5d fix: optimizing api call and allow searching db users with no-wildcards (#64449)
* fix: optimizing api call and allow searching db users with no-wildcards for db users

* chore: addressing pr comments on renaming var and updating comments

* chore: updated based on pr comments to add more tests

* chore: refactor connct button dropdown state rendering

* chore: using t.context() directly in the test

* chore: cleaner refactor of ActionButtons logic

* chore: updated unifiedresoruces test to re-use the existing mock auth client

* chore: removing fallback as not needed for connect

* chore: remove unused api

* chore: reworked test and updated no wildcard logic

* chore: remove unused GetAllowedDatabaseUsers method

* fix: put back test that verifies correct logins are returned for a leaf cluster with access request

* fix: updated parameterpicket to account for allowOnlySuggestions when filtering
2026-03-19 20:39:00 +00:00
Brian Joerger 000f6392ca Re-enable proxy recording mode test; Fix control master timeout flake. (#61762) 2026-03-06 17:31:07 +00:00
Grzegorz Zdunek ad36d4e068 Connect: add privileged updater service (#63572)
* Add privileged updater service

* Add integration tests for updater

* Review fixes

* Move privileged updater to its own module

* Fix comments

* Interpolate registry pathnames, switch errors to AccessDenied

* Improve error handling in `waitForSingleClient`

* Use stricter DACL for named pipe

* Close `conn` on context cancellation

* Move reading update meta to separate function

* `trace.LimitExceeded` -> `trace.Errorf`

* Fix test

* Ensure updater only allows HTTPS

* Use TLS server in tests

* Fix tests
2026-03-06 13:11:11 +00:00
nixpigandMarek Smoliński 4726a384c0 Update suggested reviewers to include owners of JIT access lists (#64046)
* Update suggested reviewers to include owners of JIT access lists

* Replace undefined with empty array so data serialises without error

* Use consistent proto naming

Co-authored-by: Marek Smoliński <marek@goteleport.com>

* Remove unused req return value from reviewer list function

* Remove suggested reviewers logic from OSS API

* Tests and tidy up

* Refactoring

* wip

* Remove changes addresses in a separate PR

* Remove proto for reviewers

* Add godoc

---------

Co-authored-by: Marek Smoliński <marek@goteleport.com>
2026-03-06 10:44:35 +00:00
rosstimothy ff714af486 Inject insecure mode instead of relying on global variable (#63825)
Part 1 or removing InsecureDevMode - enterprise still relies on it
so a few TODOs were left around for clean up later. This global is
mostly leveraged in tests to permit trust when self-signed certificates
are used. These tests are often spinning up multiple teleport instances
and most of the time exercise trusted clusters which makes them slow.
Due to the global nature of InsecureDevMode these tests cannot be
run in parallel.
2026-03-05 16:31:10 +00:00
rosstimothy 5b98cd713e Respect context in all process storage APIs (#63826)
Replaces all context.TODOs with a caller supplied context so
that cancellation is respected when interacting with process
storage.
2026-03-02 22:05:29 +00:00
Zac Bergquist 7cc789743c Minor test cleanup (#64146)
Removes some unnecessary code and refactors TestDebugService so
that it returns better errors and does multiple assertions instead
of bailing on the first failure.
2026-03-02 18:45:51 +00:00
Krzysztof Skrzętnicki 226773cf4d Bump timeout in WaitForAuditEventTypeWithBackoff (#64161) 2026-03-02 16:31:35 +00:00
Nic Klaassen b2e150e7d7 test: stabilize TestIntegrations/SessionRecordingModes by isolating per-subtest user/role state (#64033)
* test: stabilize TestIntegrations/SessionRecordingModes by isolating per-subtest user/role state

Fixes #48043

`TestIntegrations/SessionRecordingModes` was flaky because the subtests
reused the same Teleport user and role while switching recording mode
between `strict` and `best_effort`. Under cache propagation
delay/staleness, one subtest could observe the previous subtest’s role
state, causing incorrect behavior (for example, `BestEffortMode` failing
with `ssh: could not start shell` as if strict mode was still active).

For local reproduction, I introduced a temporary debug cache fault to
drop role update events after initial cache population. With
`StrictMode` run before `BestEffortMode`, that reliably reproduced the
failure by forcing stale role reads in later subtests.

The fix removes shared mutable identity state from the test:
- create a unique Teleport user per mode subtest
- create a unique role per mode subtest

This makes each subtest evaluate recording mode against isolated auth
state, instead of depending on cache timing/order.

Validation:
- with the temporary cache fault enabled, the old test shape reproduced the failure while the isolated user/role version passed
- after removing the temporary fault, `go test ./integration -run 'TestIntegrations/SessionRecordingModes' -count=50` passes with the final code

* stop loading test keys into local SSH agent
2026-02-21 02:50:09 +00:00
Andrew LeFevre 7ec6d03b52 use the audit login session ID to track sessions when using Enhanced Sesssion Recording (#63050) 2026-02-19 18:20:18 +00:00
Edoardo Spadolini af34a7076b Improve the happy path of Client Tools Managed Update re-execution (#63774)
* Display early debug logging for autoupdate tools in tsh

* Avoid reporting success on exec failure

* Use a shared lock in GetToolsConfig

* Return the selected tool from Updater.CheckLocal if available and ready

* Reexecute locally available client tools immediately

* Add a test for the fast reexec path

* fix expected, actual order in require
2026-02-18 16:11:51 +00:00
rosstimothy 844928e1ff Add modules to servicecfg.Config and helpers.InstanceConfig (#63824)
Before these can be consumed in OSS, the enterprise modules need to be
able to both override the global modules and update the configs so that
tests and builds do not break during the transition.

Contributes to https://github.com/gravitational/teleport/issues/62799.
2026-02-18 12:17:09 +00:00
rosstimothy 0353e8797c [fix] panic on failure in TestHSMRevert (#63802)
Removes shadowing of the auth1 variable to ensure that cleanup always
happens on a valid and non-nil teleport process.

```
  panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x181445ee]

goroutine 20184 [running]:
testing.tRunner.func1.2({0x18f7e9c0, 0x232a1910})
	/opt/go/src/testing/testing.go:1872 +0x419
testing.tRunner.func1()
	/opt/go/src/testing/testing.go:1875 +0x683
panic({0x18f7e9c0?, 0x232a1910?})
	/opt/go/src/runtime/panic.go:783 +0x132
github.com/gravitational/teleport/integration/hsm.TestHSMRevert.func1()
	/__w/teleport/teleport/integration/hsm/hsm_test.go:557 +0x6e
testing.(*common).Cleanup.func1()
	/opt/go/src/testing/testing.go:1308 +0x169
testing.(*common).runCleanup(0xc002a336c0, 0x0)
	/opt/go/src/testing/testing.go:1572 +0x226
testing.tRunner.func2()
	/opt/go/src/testing/testing.go:1928 +0x4d
runtime.Goexit()
	/opt/go/src/runtime/panic.go:615 +0x5e
testing.(*common).FailNow(0xc002a336c0)
	/opt/go/src/testing/testing.go:1013 +0x7b
github.com/stretchr/testify/require.NoError({0x1beac6e8, 0xc002a336c0}, {0x1be434a0, 0xc0030987e0}, {0x0, 0x0, 0x0})
	/go/pkg/mod/github.com/stretchr/testify@v1.11.1/require/require.go:1401 +0xe4
github.com/gravitational/teleport/integration/hsm.TestHSMRevert(0xc002a336c0)
	/__w/teleport/teleport/integration/hsm/hsm_test.go:567 +0x6e5
testing.tRunner(0xc002a336c0, 0x1abea740)
	/opt/go/src/testing/testing.go:1934 +0x21d
created by testing.(*T).Run in goroutine 1
	/opt/go/src/testing/testing.go:1997 +0x9d3
```
2026-02-17 20:26:17 +00:00
rosstimothy e857153bb9 Switch from mattn/go-sqlite3 to modernc.org/sqlite (#55940)
* Switch from mattn/go-sqlite3 to modernc.org/sqlite

* fix: import sqlite in utmp test

* fix: encode connection uri params
2026-02-12 15:40:16 +00:00
Erik Tate e7ecc19c19 adding immutable labels to scoped tokens and host certificates (#62941) 2026-02-06 20:57:03 +00:00
Chris Thach c26680a73c Lint to enforce using t.Context() instead of context.TODO() 👮🏾 (#63596)
* Update linter to restrict using context.TODO() in Go tests.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Revert changes to testlib package.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

---------

Signed-off-by: Chris Thach <chris.thach@goteleport.com>
2026-02-06 19:42:33 +00:00
Kenneth fc5bdb1535 Revert "Created check for device trust after MFA before creating web session (#62019)" (#63523)
This reverts commit ddc4586440.
2026-02-06 03:44:30 +00:00
Marek Smoliński d4f2c9ef27 Align helper.StartAndWait wait time (#63190) 2026-02-02 14:08:10 +00:00
Maxim 7d2d2a891d Access Requests: Add Resource-Scoped Constraints (#60123)
* feat: Extend `AWSRole` struct w/ `RequiresRequest`

- Differentiate between already-granted vs. requestable AWSRoles when
  including requestable resources in `clusterUnifiedResourcesGet`
  req

* feat: Implement Resource Constraints support for Proxy, Auth

* fixup: Fix tests

* test: Add tests for resourceaccessid-related helpers

* fixup: Address code review feedback

* test: Update identity/events tests for new `ResourceAccessID` fields

* fixup: Expand/improve godocs/comments for sentinel ResourceID handling

* fixup: Address code review feedback

* feat: Conv ResourceID->ResourceAccessID at cert decoding

- Convert ResourceIDs present on certs to ResourceAccessIDs at decoding
  time, rather than at each callsite. Update tests/usages of tlsca/sshca
  Identities to reflect this.
2026-01-27 14:51:52 +00:00
Kenneth ddc4586440 Created check for device trust after MFA before creating web session (#62019) 2026-01-23 21:25:10 +00:00
rosstimothy 6590c944b6 Inject modules into keygen (#62843)
Contributes to #62799.
2026-01-16 18:52:50 +00:00
Marek Smoliński 94897a4e02 Add WebClientPack.Renew method (#62761) 2026-01-13 09:25:51 +00:00
Andrew Burke b7158a4235 Fix path errors moderated sftp (#62281)
This change fixes handling non-absolute paths in
moderated sftp.
2025-12-22 21:32:13 +00:00
Tiago Silva d2529eedf0 fix: Drain participant stdout to prevent blocking in kube join test (#62348)
Add goroutine to continuously drain participant stdout stream to ensure
the test doesn't block on write operations during session cleanup and we
release the resources.

Fixes https://github.com/gravitational/teleport/issues/55044

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2025-12-18 14:33:28 +00:00
Tiago Silva fc07a33534 Improve resource cleanup in TestKube/Join (#62238)
Move cleanup operations to t.Cleanup to ensure proper resource release.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2025-12-16 16:37:48 +00:00
rosstimothy 32f073e75b Disable unused services in Kubernetes tests (#62247) 2025-12-15 16:36:10 +00:00
Tiago Silva a52060cc55 Fix flaky TestKube/Join by using io.Pipe instead of os.Pipe (#62229)
In TestKube/Join, we previously used os.Pipe[1] to create stdin for the
test. However, os.File instances are implicitly closed when garbage
collected via a runtime finalizer inserted in newFile[2].

Under CPU-constrained conditions, the garbage collector can run
mid-test and detect that participantStdinW is no longer referenced.
This triggers the finalizer, which closes the writer file descriptor,
causing the reader to receive io.EOF.

Since Kubernetes terminates exec sessions when stdin closes, the EOF
can arrive before the client receives the server payload, causing the
test to fail intermittently.

Replacing os.Pipe with io.Pipe resolves this issue, as io.Pipe does
not use file descriptors and is not subject to finalizer-based cleanup.

[1] https://github.com/golang/go/blob/1b291b70dff51732415da5b68debe323704d8e8d/src/os/pipe_unix.go#L27
[2] https://github.com/golang/go/blob/1b291b70dff51732415da5b68debe323704d8e8d/src/os/file_unix.go#L224

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2025-12-13 23:30:42 +00:00
Maxim 4ebec265ed Add paginated ListAuthServers/ListProxies (#61702)
* types: Add `ListAuthServers`/`ListProxyServers` to PresenceService

- Add `ListAuthServers` and `ListProxyServers` RPCs to PresenceService

* feat: Implement `ListAuthServers`/`ListProxyServers`

- Implement new funcs
- Mark `GetAuthServers`/`GetProxies` deprecated
- Replace existing usages
2025-12-12 21:42:28 +00:00
rosstimothy 2a5c3077d2 Disable session resumption in TestIntegrations/Disconnection (#62143)
Updates https://github.com/gravitational/teleport/issues/39515
2025-12-11 17:25:21 +00:00
Luke Okraszewski b97757c13c [config] expose auth reconnect retry parameters in configuration (#61835)
* [cfg] expose auth reconnect retry parameters in configuration

The new YAML config is as follows:
```
reconnect_backoff:
    max_period: "90s"
    min_period: "9s"  # When unset max_period / 10
    step: "18s"       # When unset max_period / 5
```

Note that currently this only exposes the existing linear backoff, but
the naming here is generic enough that we could consider other policies if needed.

Changelog: Added a new global configuration section `reconnect_backoff` allowing users to configure the backoff behaviour for instances attempting auth connections.

* better naming

* fix ratios for defaults

* fix default config test

* clarify instance type
2025-12-10 17:52:59 +00:00
Nic Klaassen b1f44e526e improve hsm test cleanup (#61841) 2025-12-09 18:39:39 +00:00
Alan Parra 2740ad632a chore: Bump golangci-lint to v2.7.2 (#62066)
* chore: Bump golangci-lint to v2.7.2

* Update e/ reference

* Fix require.IsType issues

* Reverse require.Equal

* Simplify testWebsockets

* Fix TestCreateResources

* Remove trace.Unwrap
2025-12-09 17:59:21 +00:00
Grzegorz Zdunek cd3c8f84ee Fix unrecoverable ssh cert errors in tsh/Connect (#61322)
* Initialize default Username/HostLogin only in tsh

* Move `Username()` from `api.go` to `tsh.go`

* Remove wrong `Profile.SiteName` default

* Remove resetting `SiteName`

Not sure why it was needed. Perhaps to clear the default that we just removed? But even if add the default back and remove this fix, everything works.

* Gracefully handle missing SSH/TLS certs

* Remove unused `TeleportClient.LoadKeyForClusterWithReissue`

* Revert "Move `Username()` from `api.go` to `tsh.go`"

This reverts commit f7ff0ff6d1.

* Revert "Initialize default Username/HostLogin only in tsh"

This reverts commit ed38babf5e.

* When any of SSH/TLS cert is missing, return partial profile

* Only log non-nil errors

* Revert "Remove wrong `Profile.SiteName` default"

* Revert "Remove resetting `SiteName`"

This reverts commit f54ab3f22a.

* Set `SiteName` when adding cluster

* Improve comments

* Add test

* Fix test

* Add myself to TODO

* Add test for logging out with missing SSH cert

* Lint
2025-11-28 10:12:24 +00:00
Andrew Burke e1a1bf214a Fix runcommand attempt outputs clobbering each other (#61681) 2025-11-25 23:26:57 +00:00
rosstimothy 8075f2ac6d Reduce flakiness of TestIntegrationsRegular (#61740)
The test was reliant on entering \a as input to a
session which signaled to sleep for 1s before writing
the data. This made the test undeterministic because
the 1s delays might not have been long enough for the
second party to have joined and start consuming the
session data.

This changes the test to validate that the appropriate
number of parties are in the session before proceeding
to the next step of the test. All \a have been removed
from terminal input as we now know for certain that the
session contains the appropriate parties before any
input is entered.


Closes https://github.com/gravitational/teleport/issues/25982.
Closes https://github.com/gravitational/teleport/issues/13699.
2025-11-25 18:47:00 +00:00
rosstimothy 30d1f17dbf Improve reliability of waitForSessionToBeEstablished (#61736)
Several integration tests make use of the function to
know that a session was created, a SessionTracker was
created in the backend, and to retrieve the session id.

The function polled the backend for session trackers
until the context deadline set in individual tests
was exceeded. In an effort to reduce flakiness and
make the API easier for callers the helper has been
rewritten. It now leverages a require.Eventually
internally, has a hardcoded limit of 30s instead of
allowing each test to define their own, and validates
the number of expected participants in a session.


Closes https://github.com/gravitational/teleport/issues/17224.
Closes https://github.com/gravitational/teleport/issues/36959.
2025-11-25 16:37:19 +00:00
rosstimothy fdbd386e40 Prevent flakiness in TestKube/Join (#61693)
The test was reliant on all the output of a session being
replicated to all parties before a 5s timer closed the session.
To make the test more resiliant it was rewritten such that
it validates the expected output from one of the parties output,
then exits the session, then when all parties have been closed,
it examines the entire output of the other parties to validate
their output.

Fixes https://github.com/gravitational/teleport/issues/55044
2025-11-22 16:32:28 +00:00
rosstimothy 2428299b47 Reduce flakiness of TestIntegrations/TrustedCluster tests (#61700)
The tests establish trust between two clusters, connect via SSH
to a host in the leaf, tear down trust, reestablish trust, and
then attempt another SSH connection. The flakiness stemmed from
tearing down and and reestablishing trust too quickly without
first properly verifying that the leaf cluster disappeared from
the root before reestablishing trust. While the test did make
use of `helpers.WaitForClusters`, it is satisfied if tunnels
for clusters were healthy within the last 10s. But this could
be true of a stale cluster that was not yet cleaned up. To
remedy this the test was updated to first wait for the reverse
tunnel for the leaf cluster to be completely gone before
reestablishing trust and proceeding.

Closes https://github.com/gravitational/teleport/issues/60836.
Closes https://github.com/gravitational/teleport/issues/48823.
2025-11-22 00:16:27 +00:00
rosstimothy 3fb1534f88 chore: integration test improvements (#61615)
The changes here are meant to reduce resources consumed by
integration tests and eliminate the footgun of connecting to
a host before its been populated in the appropriate caches.

`(integrationTestSuite) defaultServiceConfig` now disables more services
by default. Host user creation, the Web UI and Web Service, and the
Database Proxy are all now turned off by default. The tests that require
them can opt into turning them on.

`(TeleInstance) Start` now blocks until the processes SSH server is present
in caches before returning. Most tests were already calling this manually
after Start, however, not all of them were. This is frequently forgotten
in new tests and causes flakes if client connections are attempted as
soon as Start returns. There are still cases where calling WaitForNodeCount
directly applies - tests that spin up additional nodes or tests that create
nodes in a leaf cluster.
2025-11-21 18:31:56 +00:00
Luke Okraszewski 6d8fca2157 [chore] disable debug service in integration tests (#61529)
The datadir in this test consists of TempDir
and typically suffix which exceeds the
BSD socket limits causing the test to fail on MacOS.

This commit disables the debug service in the failing tests,
for testing the debug service specifically it should be
enabled in the test itself.
2025-11-19 17:55:41 +00:00
Luke Okraszewski 3215c089bc [chore] fix race in TwoClustersTunnel (#61474)
This test previously passed in CI, relying
on slower machines and fails locally on both
Mac and in buildbox on macbook pro m3 with:

```
cluster site-A is offline
```

Adding the wait resolves the issue.
2025-11-18 15:34:46 +00:00
Nic Klaassen 3ef19859f7 enable verbose logging in HSM integration tests (#61458) 2025-11-18 12:34:05 +00:00
Grzegorz Zdunek 6615e42ecc Connect: close cluster clients when profile changes (#61090)
* Include expiration time in `LoggedInUser`

This will allow the profile watcher to detect when the user relogged.

* Display expiration time in UI

* Add `ClearStaleClusterClients` RPC

* Implement `ClearStaleClusterClients`

* Clear stale clients when profile changes

* Improve session expiration component

* Move refresh button back to top

* `ClearCachedStaleClientsForRoot` -> `ClearStaleCachedClientsForRoot`

* `unchanged` -> `stale`

* Make "closing stale clients" a subtest

* Add `clientcache` test

* Remove `getProfile` error wrapping

* Improve comment

* Convert story to controls
2025-11-17 11:02:40 +00:00
Andrew Burke 5fa63c3a7e Fix sftp using wrong addr for signing proxy headers (#61077)
This change fixes a bug where file uploads/downloads in the web ui
would fail if proxy protocol was active and the web listen addr
was unset.
2025-11-14 19:22:45 +00:00