Commit graph

159 commits

Author SHA1 Message Date
dependabot[bot] 5edbc7bdf5
Bump the go group in /integrations/kube-agent-updater with 1 update (#35301)
Bumps the go group in /integrations/kube-agent-updater with 1 update: [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry).

- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.16.1...v0.17.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-04 14:23:41 +00:00
rosstimothy 85c29d1cf4
Implement and use UpsertOIDCConnectorV2 (#35144)
While the api client already had support for the new upsert method
it was unimplemented server side and would always fallback to the
legacy UpsertOIDCConnector RPC. This implements the RPC handler
and updates the signature of UpsertOIDCConnector to return the
upserted connector in the same manner that Create and Update do.
2023-12-01 19:22:41 +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
rosstimothy 88bb9cfd96
Implement and use UpsertSAMLConnectorV2 (#35208)
While the api client already had support for the new upsert method
it was unimplemented server side and would always fallback to the
legacy UpsertSAMLConnector RPC. This implements the RPC handler
and updates the signature of UpsertSAMLConnector to return the
upserted connector in the same manner that Create and Update do.
2023-11-30 19:09:44 +00:00
rosstimothy b2bc325703
Implement and use UpsertGithubConnectorV2 (#35132)
While the api client already had support for the new upsert method
it was unimplemented server side and would always fallback to the
legeacy UpsertGithubConnector RPC. This implements the RPC handler
and updates the signature of UpsertGithubConnector to return the
upserted connector in the same manner that Create and Update do.
2023-11-30 15:01:40 +00:00
Edward Dowling 722e82ccdd
Make Opsgenie plugin update statussink on healthcheck (#35047)
* Make Opsgenie plugin update statussink on healthcheck

* Update integrations/access/opsgenie/client.go

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

* Simplify logger use in opsgenie client

---------

Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>
2023-11-30 13:32:40 +00:00
Cam Hutchison b7a951bea4
operator: Fix GHA Dockerfile with new/old paths (#35187)
Fix the operator `Dockerfile.gha` to copy the correct paths from the
context for the build. These paths changed pretty much at the same time
as `Dockerfile.gha` was added - just an overlap in development - in
commit f31a90d4a4, which modified the
original `Dockerfile` on which `Dockerfile.gha` is based.
2023-11-30 09:37:17 +00:00
Noah Stride 634de05c42
Remove Dialer(client.Config) from Credential interface (#34833)
* Remove `Dialer(client.Config)` from Credential interface

* Re-add support for address-less configuration

* Only use profile address if none are explicitly provided

* Try all methods with credential provided address

* Fall back to address from credential

* Remove log message

* Adjust log message

* Spell explicitly correctly

* Formalize CredentialsWithDefaultAddrs interface

* GetDefaultAddrs -> DefaultAddrs
2023-11-29 08:43:07 +00:00
Bernard Kim 717e5969e3
Return one of result or err (#35024) 2023-11-28 17:50:35 +00:00
Lisa Kim 6ade117e9a
Adds IGS related fields to feature, module, and license objects (#34868)
* Revert "Deprecate field AdvancedAccessWorkflows to AccessRequest.Enabled (#34792)"

This reverts commit 79d1a5d16e.

* Add IGS related fields to features and modules

* Boiler plate for enabling access monitoring through modules

* Add IGS related license fields

* Use access monitoring feature flag instead

* Fix test

* Add backwards comp without deprecating field

* Address CR

* Address CR
2023-11-27 18:22:49 +00:00
Edward Dowling 44b868ffbb
Retry jira getIssue status if result mismatches webhook payload (#34622)
* Retry jira getIssue status if result mismatches webhook payload

* Fix formatting

* Move initial getIssue call to retry loop

* Update tests for jira plugin to include status in webhook response
2023-11-24 15:22:14 +00:00
Hugo Shaka f31a90d4a4
integrations/operator: Standalone operator with reusable client (#34482)
* Standalone operator using tbot

* Update integrations/operator/embeddedtbot/bot.go

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>

* make teleportClient private

* lint

---------

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
2023-11-23 17:23:18 +00:00
Noah Stride 37dc6b4cb9
Machine ID: Docker image for Spacelift environments (#34877)
* Working docker image for building tbot with buildbox

* Build from centos builder and chmod binary

* Pin gcompat version

* Add README

* Switch to GHA based build

* Minor style adjustments

* Run dronegen
2023-11-23 13:59:13 +00:00
Cam Hutchison 18ddc39019
operator: Add Dockerfile for use with GitHub Actions (#34875)
Add a new `Dockerfile.gha` alongside the existing `Dockerfile` that can
build the operator container image without any build args. The build
args it had could be determined from inside the Dockerfile, so doing
this removes the need to pass them in. This in turn makes it simpler to
call from CI and to build locally.

In particular, `GOLANG_VERSION` and `PROTOC_VERSION` are taken from
`build.assets/versions.mk`, and `COMPILER_NAME` is determined from the
predefined `$TARGETARCH` arg.

Once Drone no longer builds the operator on any branch, this
`Dockerfile` will replace the previous one, with the `Makefile` updated
to remove the build args. It is done this way as previous changes to the
build of the operator were not backported to v12 and v13, complicating
backporting changes to existing files.
2023-11-23 00:46:17 +00:00
Noah Stride 22584cbdf0
Machine ID: Add experimental ClientCredentialOutput for Operator's use (#34442)
* Start writing out rough plan

* More progress

* Refactor tbot/identity.Identity

* Fix TBot main test

* Add real Insecure rather than using tls.InsecureSkipVerify

* Fix Imports

* Restore integrations/operator

* Remove unused field

* Unnecessary sprintf

* Use facade in integration/operator

* Don't forget License!

* Another license file

* Correctly set Insecure for authclient.Connect

* Fix Insecure status with `tsh` profile

* Add GoDocs for DestinationNop

* GoDoc UnstableClientCredentialOutput
2023-11-22 19:20:44 +00:00
Hugo Shaka f67478dd9d
integrations/operator: split mutator interface in two (#34728)
- MutateExisting for resource update
- Mutate for resource creation
2023-11-22 18:38:05 +00:00
Lisa Kim 79d1a5d16e
Deprecate field AdvancedAccessWorkflows to AccessRequest.Enabled (#34792)
* Deprecate AdvancedAccessWorkflows proto field

* Remove AdvancedAccessWorkflows feature module field

* Rename fields

* Rename fields for all plugins

* Test ping proto response

* Address CR
2023-11-21 18:59:02 +00:00
dependabot[bot] 004bbd19c5
Bump the go group in /integrations/kube-agent-updater with 1 update (#34748)
Bumps the go group in /integrations/kube-agent-updater with 1 update: [k8s.io/api](https://github.com/kubernetes/api).

- [Commits](https://github.com/kubernetes/api/compare/v0.28.3...v0.28.4)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-20 14:10:55 +00:00
Noah Stride 885f411934
Machine ID: Spacelift delegated joining (#34292)
* Spacelift joining

* Add token structure for spacelift

* Add JoinAuditattributes for spacelift idtoken

* Add Spacelift token validator

* Add ProvisionToken fields for Spacelift

* Validation for Spacelift ProvisionToken fields

* Add join handling for spacelift method

* Reorganise spacelift package

* Setup default spacelift validator on auth bootstrap

* Add Spacelift token sourcing to Register

* Add tests for `spacelift` package

* Regenerate operator CRDs

* Add test for join code within auth package

* Add tests for ProvisionToken CheckAndSetDefaults

* Add godocs
2023-11-20 12:28:55 +00:00
fheinecke 83b6062220
Fixed additional license format issues (#34726) 2023-11-17 21:14:08 +00:00
Michael Wilson 2dbb2b4d4b
Access list app in plugin ceases to run when endpoints not implemented. (#34669)
When access list endpoints are not implemented, the access list app in the
access plugins will cease to run. This could happen if the integration is
being run against an open source server.
2023-11-16 20:39:31 +00:00
Michael Wilson f1c3fae146
Add Slack access list reminders. (#34461)
* Add Slack access list reminders.

Access list review reminders will now be sent to owners via Slack every week
until the access list is reviewed. Some small modifications were made to the
access list application to support partial success. Additionally, some changes
were made to the way access applications are instantiated to maintain
compatibility with enterprise.

* Tweak error returns, debug statements.

* Notify once per day after the next audit date has passed, remove access list name from slack notifications.

* Fix for day notifications.
2023-11-16 15:34:45 +00:00
Edward Dowling fa5c373f6c
Add auto approval flow for servicenow plugin (#33885)
* Add initial servicenow auto approval

* Stop servicenow healthcheck exiting early

* Update servicenow plugin tests to handle auto approval flow

* Add comment clarifying choice of identifier for servicenow plugin

* Fix healthcheck error handling in servicenow plugin

* Fix formatting errors

* Add more context to logs

* Fix logging in servicenow plugin

* Update integrations/access/servicenow/config.go

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

* Remove supurfluous reqId in log

* Remove unused sentinal error

* Fix imports

* Remove unused field

* Fix formating

* Change servicenow plugin to always post review updates

* Refactor servicenow plugin auto approval flow

* Update integrations/access/servicenow/app.go

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>

* Add mock for healthcheck endpoint

* Add missing check to skip test in OSS version

---------

Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>
Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>
2023-11-11 01:08:43 +00:00
dependabot[bot] eca1d01746
Bump github.com/sigstore/cosign/v2 from 2.2.0 to 2.2.1 in /integrations/kube-agent-updater (#34428)
* Bump github.com/sigstore/cosign/v2 in /integrations/kube-agent-updater

Bumps [github.com/sigstore/cosign/v2](https://github.com/sigstore/cosign) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/sigstore/cosign/releases)
- [Changelog](https://github.com/sigstore/cosign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/cosign/compare/v2.2.0...v2.2.1)

---
updated-dependencies:
- dependency-name: github.com/sigstore/cosign/v2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Run `go mod tidy` which bumps go version

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Jensen <mike.jensen@goteleport.com>
2023-11-10 19:08:08 +00:00
Michael Wilson 30490419f7
Introduce scaffolding for access list Slack notification. (#33415)
* Introduce scaffolding for access list Slack notification.

The initial scaffolding for notification of the need for reviews for access
lists has been introduced. This is not expected to do anything just yet, but
will do so in a follow on PR.

This has additionally separated the plugin data from the dynamic access core,
as it no longer is tightly coupled to access requests. No effort was made to
refactor the existing plugin data backend logic.

* Ensure that the context is cancelled on process termination.

* Remove debug hour addition.

* Correct notification date calcs, add test for notifications.

* Expire the access list after two weeks, use a single map instead of multiple plugin data keys.

* Run GCI.

* Tune tests, retry period is now a duration.

* Get rid of gocron, use intervals, test using intervals.

* GCI.

* Renames, test tweaks.

* Refactor access plugins.

* GCI.

* Adjust tests, remove generics, plugin data uses JSON marshal instead of custom marshaling.

* Move recipient back to common.

* Missed a few recipients imports.

* Tweaks to logic, auto registration of apps, commenting and cleanup.
2023-11-09 17:14:20 +00:00
Noah Stride f2f864f9c0
Machine ID: More rules to gitlab joining and add globby matching to some fields (#34290)
* Add fields for to-be-supported token claims

* Modify validation to include new field

* Add comparisons for new fields to joining logic

* Add support for globby matching for sub, ref, namespace_path and project_path

* Document which fields support globby matching

* Add tests for join rule engine changes

* Regenerate operator CRDs

* Add docs for new fields

* Correct punctuation in error message

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

* Correctly use GoDoc-esque comments

* Address docs comments

* Reuse glob matching code

* Correct type of RunnerID field

---------

Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>
2023-11-09 16:52:04 +00:00
Hugo Shaka df257bed9c
integrations/operator: re-use the teleport client instead of creating a new one (#34050)
* integrations/operator: re-use the teleport client instead of creating a new one

* fix race condition

* address feedback + add godocs
2023-11-07 22:05:42 +00:00
Hugo Shaka 0a51fa01b9
integrations/operator: remove require checks from Eventually funcs (#34270)
* use eventuallyWithT

* integrations/operator: remove require checks from Eventually funcs

* fixup! integrations/operator: remove require checks from Eventually funcs
2023-11-07 20:40:02 +00:00
Hugo Shaka 3a8a07f158
integrations/operator: propagate revision + fix tests (#34265)
* operator: propagate revision info + fix tests

* fixup! operator: propagate revision info + fix tests
2023-11-07 17:48:20 +00:00
dependabot[bot] 7ce3d7a102
Bump the go group in /integrations/kube-agent-updater with 1 update (#34229)
Bumps the go group in /integrations/kube-agent-updater with 1 update: [golang.org/x/mod](https://github.com/golang/mod).

- [Commits](https://github.com/golang/mod/compare/v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2023-11-06 22:38:58 +00:00
rosstimothy d5a796c056
Enable testify lint (#34222)
Updates our golangci-lint configuration to enable testifylint and
fixes all issues found.

Bump e ref to include gravitational/teleport.e#2567
2023-11-06 20:38:38 +00:00
Tiago Silva 9750a455e5
Fix Teleport update reconciliation on status updates (#34063)
* Fix Teleport update reconciliation on `status` updates

This pull request addresses the issue where the Teleport operator reconciliation runs every time the operator updates the `status` subresource.
This continuous reconciliation has led to an infinite loop, causing millions of reconciliations per minute.
When an error occurs, such as having invalid role properties, the Operator updates the status and returns an error, which should trigger a rescheduled reconciliation with exponential backoff. The problem arises because the operator failed to enforce a resource generation change, resulting in an immediate trigger of a new reconciliation when the `status` field is updated.

This pull request modifies the operator to avoid updating subresources and only trigger updates when there is a change in resource generation.

Special thanks to @strideynet for confirming my hypothesis and giving
the solution!

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

* return proper status conditions on failures

* enforce condition update on silentUpdateStatus

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2023-11-02 22:27:23 +00:00
Noah Stride 516e15db56
Access Plugins: Support dynamic credential reloading (#32974)
* Refactor client creation in access plugins

* Remove unnecessary client creation

* Remove unused constant

* Fix imports

* Add dynamic watcher mode

* Export NewIdentityFileWatcher

* Add godoc for exported func

* Americanize Speling

* Change username used by dynamic ssh credentials
2023-11-01 16:53:36 +00:00
dependabot[bot] a9ca4d0a58
Bump github.com/docker/docker in /integrations/kube-agent-updater (#34033)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 24.0.0+incompatible to 24.0.7+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v24.0.0...v24.0.7)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 16:06:32 +00:00
Mike Jensen ce5075eb08
Fix missed gRPC 1.58.3 updates (#33981)
`examples/go-client` and `integrations/kube-agent-updater` appear to be the only usage of gRPC using a version older than 1.58.3
examples/go-client is primarily addressed through updating the `api` module.
2023-10-30 15:06:40 +00:00
dependabot[bot] 393d506d76
Bump the go group in /integrations/kube-agent-updater with 1 update (#34016)
Bumps the go group in /integrations/kube-agent-updater with 1 update: [github.com/sigstore/sigstore](https://github.com/sigstore/sigstore).

- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.7.4...v1.7.5)

---
updated-dependencies:
- dependency-name: github.com/sigstore/sigstore
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 14:02:08 +00:00
dependabot[bot] 121d013796
Bump the go group in /integrations/kube-agent-updater with 1 update (#33804)
Bumps the go group in /integrations/kube-agent-updater with 1 update: [k8s.io/api](https://github.com/kubernetes/api).

- [Commits](https://github.com/kubernetes/api/compare/v0.28.2...v0.28.3)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 22:38:36 +00:00
Edward Dowling 439e5dcdca
Add suggested reviewers as assingee to servicenow incidents (#33704)
* Add suggested reviewers as assingee to servicenow incidents

* Fix suggested reviewers encoding

* Update comment for serviceno assigned_to field
2023-10-23 16:37:52 +00:00
rosstimothy 2087a2fda8
Implement Create/UpdateRole on the auth server (#33491)
In addition to adding server and backend handling for create and
update roles, the services.Access interface was updated to return
a role from the existing Create/UpsertRole methods. Bumps the e
ref to incorporate the associated changes needed there to prevent
breaking the build.
2023-10-18 17:06:50 +00:00
Edward Dowling 5c44cbac8e
Fix issue with ServiceNow incidents not including link to access request (#33565)
* Fix issue with ServiceNow incidents not including link to access request

* Add cluster to incident desciption and include user as caller

* Add status sink to servicenow client

* Fix formatting

* Undefer status updating in servicenow plugin

* Add log of plugin status

* Update integrations/access/servicenow/client.go

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

* Fix bug caused by caller_id field being a different type on response

* Change format for description for resource requests

* Fix mock servicenow to use seperate incident response type

* Update integrations/access/servicenow/client_test.go

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

* Fix formating

* Update tests

---------

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>
2023-10-17 17:25:43 +00:00
dependabot[bot] 07eafb5bcd
Bump the go group in /integrations/kube-agent-updater with 1 update (#33504)
Bumps the go group in /integrations/kube-agent-updater with 1 update: [github.com/sigstore/sigstore](https://github.com/sigstore/sigstore).

- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.7.3...v1.7.4)

---
updated-dependencies:
- dependency-name: github.com/sigstore/sigstore
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-16 18:51:37 +00:00
Gabriel Corado 9582262a82
Add PostgreSQL auto-user deletion (#32792)
* feat: add auto-user deletion postgres

* refactor: change to IsEnabled func to check auto-user

* test: fix linting and test

* refactor(db): code review suggestions

* refactor: rename option to best effort drop

* refactor(api): rename createa database user mode property

* refactor(services): review suggestions

* feat(postgres): add log for user deletion result

* refactor(integrations): regenerate crd manifests

* feat(examples): update operator role spec

* refactor(db): use common sql state codes
2023-10-16 17:03:45 +00:00
Mike Jensen cd34f3b5f8
Update remaining google.golang.org/grpc to v1.57.1 (#33486)
This are primarily examples, but we still want to update to ensure coverage against CVE-2023-44487.
2023-10-16 15:08:48 +00:00
Marek Smoliński f3545eba3f
Security Reports (#30853) 2023-10-16 10:11:54 +00:00
dependabot[bot] ca146072cd
Bump golang.org/x/net in /integrations/kube-agent-updater (#33338)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.14.0...v0.17.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-10-12 12:55:30 +00:00
Andrew Burke c4b2861f70
Show resources in Slack notification for access requests (#32887)
This change updates Slack notifications for resource-based access
requests to include the resources being requested.
2023-10-10 21:01:32 +00:00
rosstimothy b60ea81d54
Update users interface (#32987)
services.UsersService now takes a context and returns the user
from write operations as shown in the diff below. The bulk of the
changes are from modifying code to account for the additional
parameter and/or return value. Functional changes to better make
use of the new API will come in follow up PRs.

```diff
// UserGetter is responsible for getting users
type UserGetter interface {
	// GetUser returns a user by name
-	GetUser(user string, withSecrets bool) (types.User, error)
+	GetUser(ctx context.Context, user string, withSecrets bool) (types.User, error)
}

// UsersService is responsible for basic user management
type UsersService interface {
	UserGetter
	// CreateUser creates user, only if the user entry does not exist
-	CreateUser(user types.User) error
+	CreateUser(ctx context.Context, user types.User) (types.User, error)
	// UpdateUser updates an existing user.
-	UpdateUser(ctx context.Context, user types.User) error
+	UpdateUser(ctx context.Context, user types.User) (types.User, error)
	// UpdateAndSwapUser reads an existing user, runs `fn` against it and writes
	// the result to storage. Return `false` from `fn` to avoid storage changes.
	// Roughly equivalent to [GetUser] followed by [CompareAndSwapUser].
	// Returns the storage user.
	UpdateAndSwapUser(ctx context.Context, user string, withSecrets bool, fn func(types.User) (changed bool, err error)) (types.User, error)
	// UpsertUser updates parameters about user
-	UpsertUser(user types.User) error
+	UpsertUser(ctx context.Context, user types.User) (types.User, error)
	// CompareAndSwapUser updates an existing user, but fails if the user does
	// not match an expected backend value.
	CompareAndSwapUser(ctx context.Context, new, existing types.User) error
	// DeleteUser deletes a user with all the keys from the backend
	DeleteUser(ctx context.Context, user string) error
	// GetUsers returns a list of users registered with the local auth server
-	GetUsers(withSecrets bool) ([]types.User, error)
+	GetUsers(ctx context.Context, withSecrets bool) ([]types.User, error)
	// DeleteAllUsers deletes all users
-	DeleteAllUsers() error
+	DeleteAllUsers(ctx context.Context) error
}
```

Depends on gravitational/teleport.e#2346
Implements step 3 of #32949
2023-10-10 14:07:46 +00:00
dependabot[bot] 446f6688f2
Bump the go group in /integrations/kube-agent-updater with 2 updates (#33118)
* Bump the go group in /integrations/kube-agent-updater with 2 updates

Bumps the go group in /integrations/kube-agent-updater with 2 updates: [github.com/docker/distribution](https://github.com/docker/distribution) and [golang.org/x/mod](https://github.com/golang/mod).


Updates `github.com/docker/distribution` from 2.8.2+incompatible to 2.8.3+incompatible
- [Release notes](https://github.com/docker/distribution/releases)
- [Commits](https://github.com/docker/distribution/compare/v2.8.2...v2.8.3)

Updates `golang.org/x/mod` from 0.12.0 to 0.13.0
- [Commits](https://github.com/golang/mod/compare/v0.12.0...v0.13.0)

---
updated-dependencies:
- dependency-name: github.com/docker/distribution
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go
...

Signed-off-by: dependabot[bot] <support@github.com>

* Replaced deprecated import

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2023-10-09 16:49:52 +00:00
Jakub Nyckowski e13137016c
Add 'promoted' access request state (#31346)
* This change introduces a new 'promoted' access request state. The state represents that an access request has been promoted to an access list.

Affected code was modified to adjust to the new promoted state and ensure correct system's behavior.

Added a new 'GetAccessRequest' method for internal use to retrieve access request info.
Disallowed direct promotion of access requests. Introduced 'SubmitAccessReviewAllowPromotion' for promotions.
Added 'PromoteAccessRequest' method and updated its usage to restrict direct promotions.
Refactored code for better readability and testing. Renamed some functions, simplified logic, added test helpers.
Introduced 'promoted' state for access requests to handle promotion workflow.
Added 'PromotedAccessListTitle' in 'AccessReview' to track promotion state.

* Refactor function and message names for better clarity

The function and message names related to the promotion of an access request to an access list were restructured for better readability and consistency. Names like 'PromoteAccessReqResponse'  have been replaced with more descriptive names such as 'PromoteAccessRequestResponse'. This increases clarity and consistency across the project.

* Remove the hacky GRPC server implementation

* Change method names to be more descriptive

Renamed all instances of 'PromoteAccessRequest' to 'AccessRequestPromote' in multiple files. The new method name provides a more descriptive and clear understanding of the method's function, which improves code readability and maintenance. This change applies to method definitions, comments, and error messages.

* Refine error message and introduce IsPromoted method

Refined the error message in 'access_request.go' to better indicate that only promoted requests can set the promoted access list title, not just have one. This enhances clarity of error message. Additionally, introduced 'IsPromoted' method in 'access_request.go' file. This method will be useful for quickly checking if a request is in the PROMOTED state.

* Rename variable in SubmitAccessReview method

Renamed the variable "params" to "submission" in the 'SubmitAccessReview' function, in 'auth_with_roles.go' file. The name "submission" provides clearer indictation of its role in submitting access review. This enhances code readability and understandability. No logic changes were made during this update.
2023-09-26 18:46:50 +00:00
Tiago Silva 9a556d8ab1
Add support for Protobuf Enums into Operator CRDs (#32469)
* Add support for Protobuf Enums into Operator CRDs

This PR marks the Teleport enum fields as integer or string values. The
integer option is to ensure we are backwards compatibile with
previously installed CRDs.

Users can now represent their roles in Kubernetes custom resources and
refer enum fields as strings while their protobuf wire type is int32.

Fixes #29686

* add tests

* fix unit test
2023-09-26 13:43:50 +00:00