Commit Graph
31 Commits
Author SHA1 Message Date
Noah StrideandMarco Dinis 0586278cde Migrate GetClusterName to gRPC (#53164)
* Adjust GetClusterName method signature to include context.Context

* Start hacking on gRPC GetClusterName impl

* Fix test mocks to match signature

* Fix integration tests

* Fix integrations tests

* Missing ctx

* New GetClusterName RPC implementatin

* Add fallback cluster name

* Correct godoc comment

* Remove unused method

* Remove unused import

* Fix E2E test

* Fix tests

* Fix deferred context cancel in test conflicting with parallel subtests

* Fix import

* Fix imports

* Update lib/auth/auth_with_roles.go

Co-authored-by: Marco Dinis <marco.dinis@goteleport.com>

---------

Co-authored-by: Marco Dinis <marco.dinis@goteleport.com>
2025-03-20 10:07:02 +00:00
rosstimothy cca83feb66 Convert integrations to use slog (#50921) 2025-01-10 16:08:42 +00:00
Hugo Shaka 3eb6bd0c32 Rename lib/kubernetestoken to lib/kube/token (#49554)
* Rename lib/kubernetestoken to lib/kube/token

* Lint
2024-12-04 22:39:55 +00:00
Nic Klaassen 0a0d4137db eliminate rsa.GenerateKey and lib/auth/native (#47768) 2024-10-21 20:55:22 +00:00
Nic KlaassenandBernard Kim eff0a707d7 split SSH and TLS keys in tsh login (#45995)
* key split wip

* fix piv tests

* fix terraform tests

* spelling fixes

* fix kube benchmark

* fix identity files in integrations tests

* self review

* fix typo in comment

Co-authored-by: Bernard Kim <bernard@goteleport.com>

* speed up device login tests

* use EC keys in TestProxyAppWithIdentity

* faster tsh tests

* fix race on error value

* fix lint

* write out EC SSH keys in OpenSSH format

* fix lint

* fix keyring comparisons

* PrecomputeTestKeys in lib/client

* parallelize TestNoRelogin subtests

* use ecdsa for self-signed TLS certs

* remove redundant GetTrustedCerts

* improve latency of precomputeTestKeys

Instead of waiting for all 25 test keys before returning a single one,
tests can now make use of the first precomputed test key as soon as it's
ready.
In local testing with this change, the first key is ready after ~75ms vs
>350ms on master.

* fix test and lint

---------

Co-authored-by: Bernard Kim <bernard@goteleport.com>
2024-09-12 19:36:32 +00:00
Hugo ShakaandMarco Dinis a9b37a52fb Add fakejoin.KubernetesSigner test helper (#43857)
* Add fakejoin.KubernetesSigner test helper

* fixup! Add fakejoin.KubernetesSigner test helper

* rename file

* Update integrations/lib/testing/fakejoin/kubesigner.go

Co-authored-by: Marco Dinis <marco.dinis@goteleport.com>

* Lint

---------

Co-authored-by: Marco Dinis <marco.dinis@goteleport.com>
2024-07-05 15:19:13 +00:00
Tiago Silva bdb5d1a2a1 chore: chore: Bump golangci-lint to v1.59.1 (#42049)
Update to the latest release.

* https://github.com/golangci/golangci-lint/releases/tag/v1.59.1
* https://github.com/golangci/golangci-lint/releases/tag/v1.59.0
* https://github.com/golangci/golangci-lint/releases/tag/v1.58.2

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-06-10 14:13:18 +00:00
94332f34e9 Add initial condition parser for access monitoring rules (#40659)
* Add initial condition parser for access monitoring rules

* Update integrations/access/accessrequest/app.go

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

* Check previously unchecked error and minor refactor of AMR

* Simplify check for applicable access monitoring rules

* Refactor access monitoring rules plugin integration

* Fix formating and move lock aquisition

* Add methods for listing access monitoring rules with a filter

* Add contains_any predicate expression func

* Add in is_empty func to predicate expression

* Lock AMR cache in plugins while getting initial rules

* Add in check for access monitoring rule version

* Update integrations/access/accessrequest/app.go

Co-authored-by: Roman Tkachenko <roman@goteleport.com>

* Update integrations/access/accessrequest/app.go

Co-authored-by: Roman Tkachenko <roman@goteleport.com>

* Move lock so it doesnt persist over api calls

* Remove unused constant and add more context to logs

* Appease linter

* Update access monitoring rules tests to pass rule validation

* Add in missing access monitoring rules list with filter code

* Appease linter

* Add back validation code for AMRs

* Fix test plugin role and rename listaccessmonitoringrulewithfilter

* Fix local test for AMR crud operations

* Fix end range for listing rules

* Fix unwrapping of resource153 event for monitoring rules

* Refactor AMR cache init into helper function in plugin app

* Add seperate response type for listAccessMonitoringRulesWithfilter

* Add context to log for plugins failing to fetch recipients

* Grab access monitoring rules cache under lock all at once

* Add clarification for which fields are optional in listAMRfilter req

* Update integrations/access/accessrequest/app.go

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

* Update integrations/access/accessrequest/app.go

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

* Add forEach to common recipient set

* Move type check to after AMR event op switch

* Move turn some default parser spec methods to funcs

* Make some predicate func usable as methods as well

* Add len func to common recipient sets

* Add integration test for access monitoring rule and slack plugin

* Fix error types and messages when handling AMRs

* Use generic list resource with filter for AMR

* Add test for generic listResourceWithFilter

* Update listResourceWithFilter to use revision instead of id

* Update generic tests to use revision instead of id

* Fix linting

---------

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2024-05-24 18:45:13 +00:00
Hugo Shaka 90392ca700 Make access plugin tests work with mandatory 2fa (#41412)
* Make access plugin tests work with mandatory 2fa

* fix Access List reminder tests

* lint
2024-05-10 15:13:42 +00:00
Zac Bergquist 8cd1c429f5 Fix up some poor wording (#40832)
Closes #40294
Closes #39172
2024-04-23 22:01:41 +00:00
Hugo Shaka a24216e166 Prepare teleport access plugin enterprise test suite (#40479)
* Make AuthHelper support enterprise

* Split access OSS and Enterprise tets suites

* fix slack tests

* fix race in accesslist reminder tests

* fixup! fix race in accesslist reminder tests
2024-04-11 21:37:11 +00:00
Hugo Shaka b5270e12cd remove unused tests (#40429) 2024-04-10 18:15:43 +00:00
Hugo Shaka 7e9ff5acc2 Vendor teleport-event-handler (#40364)
* Vendor event-forwarder plugin

* fix tests + add Makefile + CI

* lint

* Fix broken test

* use a separate go.mod

* ignore event-handler in flaky tests + update go.mod

* go mod tidy
2024-04-10 15:46:14 +00:00
Hugo Shaka d83cfd154c Copy Terraform provider from teleport-plugins repo (#40224)
* copy terraform provider

* Make dependecy checker happy + use go 1.22

* Run terraform tests in the CI, add Makefile target

* go mod tidy
2024-04-10 05:11:58 +00:00
Hugo ShakaandMarco André Dinis 10a6cbb9d7 Ensure watcherjob always returns an error (#39581)
* Ensure watcherjob always returns an error

* Apply suggestions from code review

Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>

* make testlib tolerate 'context cancelled' errors

* fixup! make testlib tolerate 'context cancelled' errors

* fixup! fixup! make testlib tolerate 'context cancelled' errors

---------

Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>
2024-03-25 14:42:17 +00:00
rosstimothy e5d965e9c2 Fix integrations ssh service tests (#39543)
Similar to https://github.com/gravitational/teleport/pull/39315,
this updates the integrations test suite to use a regular
expression that will match output to know when the ssh_service is
ready now that Teleport is using slog instead of logrus.
2024-03-19 12:13:07 +00:00
rosstimothy 572b64480f Fix integrations tests (#39315)
The change to migrate the TeleportProcess to use slog in
https://github.com/gravitational/teleport/pull/38551 was preventing
the regular expressions used by the operator tests to determine
when auth and proxy were ready. This lead to the tests hanging indefinitely
until the go test framework timed out. To remediate, the regular
expressions have been updated to match the output when using slog.

For example, the test was expecting the output in the format of:

```
Auth service 15.0.0:v15.0.0-0-ge126e8cd is starting on 192.168.50.108:3025. pid:61933.1 service/service.go:2072
```

#38551 moved the listen address to a field instead of being formatted
in the message:

```
Auth service is starting. pid:54159.1 version:16.0.0-dev git_ref:api/v13.4.16-31-g2b9ae35e31 listen_address:127.0.0.1:63152 service/service.go:2107
```
2024-03-13 23:58:12 +00:00
Hugo Shaka 21eac0672d Migrate jira access plugin tests (#38406)
* Migrate jira access plugin tests

* grant the access_request.update permission

* lint

* license
2024-02-20 21:14:44 +00:00
Hugo Shaka e056d00a61 Plugin integration tests: add oss auth helper (#38237)
* Plugin integration tests: add oss auth helper

* address feedback

* lint
2024-02-15 19:15:08 +00:00
Hugo Shaka 262757af74 Introduce new plugin integration helpers (#38175)
* plugin testing framework

* godocs

* lint

* license

* fix oss tests

* revert timer change causing flaky tests

* fix oss tests pt.2
2024-02-14 18:27:54 +00:00
rosstimothy b7318b5c7e Enable errorlint via golangci-lint (#37669)
Adds the new linter and configures it to prevent direct error
comparisions and type assertions in favor of errors.Is and errors.As.
All current violations caught by the linter have been updated
accordingly.
2024-02-02 15:59:24 +00:00
fheinecke b178b8b732 Updated Teleport codebase to AGPL3 license (#35259)
Signed-off-by: Fred Heinecke <fred.heinecke@goteleport.com>
2023-12-01 17:48:14 +00:00
fheinecke 3e7182c4a2 Updated master branch makefile version to 15.0.0-dev (#31220)
* Updated master branch makefile version to 15.0.0-dev

* Updated `docs/config.json`

* Revert "Updated `docs/config.json`"

This reverts commit 4d4c8846b1.

* Updated `docs/config.json`

* Revert e ref update

* revert docs git property removal

* Fixed version check integration test

* Re-ordered imports

* Reverted accidental format change by IDE
2023-09-11 19:54:40 +00:00
Zac Bergquist c3e6173651 Remove use of require assertions inside Eventually calls (#31112)
* Remove use of require assertions inside Eventually calls

require.Eventually runs the predicate function in a background
goroutine. It is invalid to use require to make assertions
inside the eventually, because require will fail the test if the
assertion fails, and tests can only be failed from the test's
main goroutine.

* Use EventuallyWithT
2023-08-30 16:54:53 +00:00
Jakub Nyckowski 18a5327699 Remove most t.Log() from tests (#28453)
The t.Log() function calls have been removed from most tests. This is to keep our test logs cleaner and more focused on error messages. Logging every detail in tests makes it harder to spot actual errors and relevant information.
2023-06-29 15:14:09 +00:00
Justinas Stankevičius ec6295b3cf Compile binaries for access plugin tests (#27819)
* Compile binaries for access plugin tests

* Fix PD test asserts for newer Teleport versions

* Unpin role from V6 in access plugin tests

* Remove license from OSS plugins tests

We now run tests against OSS Teleport in the OSS repo,
and against Enterprise Teleport in the E repo.
So the assumption that CI always needs an enterprise license
is incorrect.

* Only compile the required binaries
2023-06-19 12:36:34 +00:00
Tiago Silva 5bf67192e2 Introduce version v7 to Role resources (#26583)
This PR introduces a new role version - `v7` - to support other
Kubernetes resources such as `Deployments`, `Statefulsets`... while
keeping compatibility with previous role versions.

This PR adds the following validations:
- `v6`, `v5`, `v4`: `kubernetes_resources` can only include `kind: pod`
  resources
- `v7`: `kubernetes_resources` can include wildcards or other
  resourceces (to be introduced by #26244.

It also adds a role version downgrade (v13 clients connecting to v14
auth server) where we downgrade the role's version and remove unsuported
kubernetes_resources from the resource list.

Part of #20811
2023-06-13 08:21:42 +00:00
Trent Clarke 4ebb31c1f0 Vendors the pagerduty plugin source into teleport (#27262)
* Vendors the `pagerduty` plugin source into `teleport`

This commit vendors the PagerDuty Access Plugiun code into the `teleport`
repo (from `teleport-plugins`), with only the minimal set of changes
required to get it to compile and tests to pass.

Changes include:
 - updating the package name (`main` -> `pagerduty`)
 - removing `main.go`
 - removing installation scripts
 - minor testing tweaks to aid local debugging

* Revert test change

* `go mod tidy`

* fmt

* linter appeasement
2023-06-05 07:34:53 +00:00
Nic Klaassen 2568bff9db fix: use errors.Is for all EOF comparisons (#26012)
This commit updates all `err == io.EOF` comparisons to use
`errors.Is(err, io.EOF)`. This is necessary when the error may have been
wrapped and fixes at least one current breakage (in `tsh request ls`).

`golang.org/x/tools/refactor/eg` was very handy for this, I used the
following template:

```go
package teleport
import (
	"errors"
	"io"
)
func before(err error) bool { return err == io.EOF }
func after(err error) bool  { return errors.Is(err, io.EOF) }
```
2023-05-10 19:27:39 +00:00
Justinas Stankevičius 3fbe7f7ff4 Use RUNNER_TEMP for teleport bins in plugin tests (#23773)
When gravitational/teleport-plugins imports this test suite
in CI, the repo root gravitational/teleport/... is not writable.

This uses GitHub's `RUNNER_TEMP` instead, if it is set.
2023-03-31 16:31:49 +00:00
Justinas Stankevičius 6af6e7f566 Vendor slack plugin and supporting libraries (#23045)
* Vendor slack plugin and supporting libraries

* Fix up plugin integration tests (wip)

* Run GCI on vendored code

* Use newtype instead of type alias

golangci-lint currently panics on this,
"skip-files" et al don't help, as it is a linter panic, not an error

See https://github.com/dominikh/go-tools/commit/d717045480130461e1e777ead7f2981621f0d9f0

* Remove long-runing plugins tests from difftest

* Move access plugin tests to unit-tests-integrations
2023-03-22 19:39:07 +00:00