Skip to content

Access Graph: Entra ID application sync prerequisites#41650

Merged
justinas merged 6 commits intomasterfrom
justinas/entra-id-sso-info2
May 20, 2024
Merged

Access Graph: Entra ID application sync prerequisites#41650
justinas merged 6 commits intomasterfrom
justinas/entra-id-sso-info2

Conversation

@justinas
Copy link
Copy Markdown
Contributor

@justinas justinas commented May 16, 2024

This is a prerequisite to https://github.com/gravitational/teleport.e/pull/4180 .

Adds access graph specific settings to the Entra ID plugin. When the access_graph_settings field is set (and access graph is enabled in the cluster), the Entra ID plugin will synchronize information about Entra ID Enterprise Applications to TAG.

The access graph settings field has a hashmap of pre-fetched information for each SSO-enabled enterprise app. This is required because there is certain information we can not fetch at plugin's runtime using the Microsoft Graph API. See this section of the RFD for more information.

This also adds the required Access Graph protos (Entra "events stream" and EntraApplication structure).

Also fixed a bug where after azure-oidc Integration kind was introduced, this integration was treated as an external audit storage integration by the frontend, and deleting it did not work.

Justinas Stankevicius added 4 commits May 16, 2024 18:46
@justinas justinas marked this pull request as ready for review May 16, 2024 18:23
@justinas justinas requested review from jakule and tigrato May 16, 2024 18:23
@github-actions
Copy link
Copy Markdown
Contributor

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@github-actions github-actions Bot requested review from ravicious and rudream May 16, 2024 18:23
@justinas justinas added the no-changelog Indicates that a PR does not require a changelog entry label May 16, 2024
@justinas justinas removed the request for review from ravicious May 16, 2024 18:24
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcbattirola could you do a quick sanity check on this code, as it seems like you're the original author of the audit storage integration support on the frontend?

rpc GitlabEventsStream(stream GitlabEventsStreamRequest) returns (stream GitlabEventsStreamResponse);

// EntraEventsStream is a stream of commands to the Entra ID SSO importer.
rpc EntraEventsStream(stream EntraEventsStreamRequest) returns (stream EntraEventsStreamResponse);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used to send Entra events, but shouldn't be called Azure as the data comes from Azure and we will probably use it to send more Azure related things in the future?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue here is that this is supposed to be called from Auth server while the other can be from discovery service tho

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is basically called Entra because Azure resources will likely be synced by a different loop in discovery, and thus would use a different stream.

Both processes will be using the azure-oidc integration, but the plugin will only be responsible for the Entra directory part (users, groups, applications, ...)

Comment thread api/proto/teleport/legacy/types/types.proto
//
// This data is stored here because it is not available through traditional methods (MS Graph API).
// Instead, it is fetched once during the plugin's set up using the user's credentials to connect to Azure's private API.
map<string, PluginEntraIDAppSSOSettings> app_sso_settings_cache = 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we change this to repeated field?
IF we need to ensure uniqueness, we can do it manually

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, and then have a map at runtime instead. Are there known pitfalls with map fields in proto? I see that we have quite a few, but mostly for labels.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, if we ever need to support duplicates we need to change the message itself while if it's a replicated field, we do not need to change the message, we just need to change the implementation code which doesn't require any sync.

It's just to prepare for the future.

I also prefer to have the PluginEntraIDAppSSOSettings to include the name instead of the name being shared as a map key

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tigrato done in c59a322

@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from rudream May 20, 2024 16:20
@justinas justinas enabled auto-merge May 20, 2024 18:38
@justinas justinas added this pull request to the merge queue May 20, 2024
Merged via the queue into master with commit 400e076 May 20, 2024
@justinas justinas deleted the justinas/entra-id-sso-info2 branch May 20, 2024 19:14
justinas added a commit that referenced this pull request Jun 6, 2024
* Add access graph settings to Entra ID plugin

* Move Entra ID labels to OSS

* Add Entra resources and RPC to Access Graph proto

* Add azure-oidc integration to web.

Current code assumes that Integration is always either AwsOidc,
or an external audit storage integration

* Change app sso cache to a repeated field
github-merge-queue Bot pushed a commit that referenced this pull request Jun 7, 2024
* Entra ID reconciler: directory reconciler prerequisites (#40778)

* Add Entra ID resource origin

* Ignore ID and Revision from `header` in cmp

* Add e_imports for MS Graph SDK

* Entra ID integration: add proto definitions (#40997)

* Entra ID integration boilerplate (#40998)

* Add e imports for MS Graph SDK

* Add ability to sign Entra ID OIDC JWTs, rework KID handling

- Synthesize Key IDs for our JWT keys. For backwards compatibility, also
  include the same keys with an empty `kid` in JWKS.
- Sign AWS OIDC tokens with a `kid=""` header claim,
  rather than omitting the `kid` claim altogether.
  See comment for details.

* Add validation for Entra ID plugin

* Fix typo in assertion function name

* Update the OIDC JWKS test to expect the same key twice

* Add Entra ID plugin type constant

* go mod tidy

* Fix expected JWKS size in integration test

* Add basic tests for KeyID

* Move Azure auth settings from Plugin to Integration

* Address review comments

* Add a unit test to ensure KeyID compatibility

* Add license header to token_generator.go

* Rename validation function per new conventions

* Access Graph: sync AWS identity providers  (#41368)

* Add AWSSAMLProviderV1 to access graph proto

* Access Graph: sync AWS SAML Providers

* Parse SAML entity descriptor before sending to TAG

* Add protos for AWS OIDC providers

* Fetch AWS OIDC providers

* Fetch signing certificates for AWS SAML providers

* Deflake identity provider fetch test

The concrete implementation of IAM mock uses a map,
resulting in non-deterministic iteration order.
Sort the results before comparing to alleviate.

* Update lib/srv/discovery/fetchers/aws-sync/iam_test.go

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>

---------

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>

* Access Graph: Entra ID application sync prerequisites (#41650)

* Add access graph settings to Entra ID plugin

* Move Entra ID labels to OSS

* Add Entra resources and RPC to Access Graph proto

* Add azure-oidc integration to web.

Current code assumes that Integration is always either AwsOidc,
or an external audit storage integration

* Change app sso cache to a repeated field

* Entra ID integration: add onboarding script (#41811)

* Add Entra ID integration onboarding script

* Adapt after proto update

* Validate names in azure script handler, add test

* Add license headers

* Update Entra plugin test with SSO connector field

* Fix lint

* Remove leftover panics

* Adjust success message

* Downgrade log message level

* Expect exactly 1 SP for MS Graph, improve errors

* Properly extract hostname for enterprise app name

* Comment on assuming the first subscription

* Address review nits

* Factor out sso info fetch into a function

* fixup refactor

* Add retry logic to app role assignment

* Make godoc conventional

* Entra ID integration: integration script updates and web onboarding prerequisites (#42172)

* Remove integration name validation from web script

Not used by the script. It is validated by the "plugins/validate"
endpoint.

* Add required frontend constants for Entra ID

* Support Azure/Entra integrations in the list

* Add IsPolicyEnabled to web config

* Allow custom URL for ButtonLockedFeature

* Add CTA_ENTRA_ID event type

* Expose TAGInfoCache for use in e

* Add LackingIgs option

* Add Entra ID icon

* Add Entra ID plugin to storybook

* Bump e for dev build

* Return underlying error in getPrivateAPIToken

* Find default Azure subscription instead of the first one

* Require user to re-login when provisioning Azure OIDC

* Update prehog protos with Entra ID values

From https://github.com/gravitational/cloud/pull/9111

* Suppress verbose warnings / information from az

* Add an additional message after successful auth

Lets user know that `az login` has completed
and `teleport` is continuing its work.

* Move EntraId constant to the bottom

* Revert unintended changes to usageevents

CTA is 1-to-1 with prehog, but IntegrationEnrollKind is not.

* Remove integrationName validation asserts from test

This parameter is no longer accepted by the endpoint

* Revert "Bump e for dev build"

This reverts commit fc747a0.

* `go mod tidy` secondary modules

---------

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a PR does not require a changelog entry size/md ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants