Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OIDC issues with GCP #1556

Closed
Rokkart opened this issue Apr 21, 2022 · 11 comments · Fixed by #3417
Closed

OIDC issues with GCP #1556

Rokkart opened this issue Apr 21, 2022 · 11 comments · Fixed by #3417
Milestone

Comments

@Rokkart
Copy link

Rokkart commented Apr 21, 2022

Hi everyone !

I'm working on a deployment solution of Dependency Track for my company. I'm using the docker compose setup.

I'm currently stuck with the authentication. I want to use the OIDC feature to manage the users. But I'm facing an issue about how GCP answers to Dependency Track OIDC requests.

Current Behavior:

When I try to use OIDC to connect to Dependency Track, I get an error in the API container logs telling me that the OIDC profil isn't complete. After a quick look, I see that I don't get any group for my user. So I guess that Dependency Track can't associate my user with a team. I'll put the error logs and configuration details in the 'Additional Details' section.

Steps to Reproduce:

I configured the compose file accordingly to Dependency Track documentation.
On the login form, I click the SSO button and connect to my GSuite account.

Expected Behavior:

I should be able to connect to Dependency Track with OIDC and get the permissions of the team I'm associated with.

Environment:

  • Dependency-Track Version: 4.4.2
  • Distribution: Docker
  • Database Server: PostgreSQL
  • Browser: Google Chrome

Additional Details:

Here is the error I get :
2022-04-21 08:09:17,261 ERROR [OidcAuthenticationService] Unable to assemble complete profile (ID token: OidcProfile{subject='*****************', username='**************@*********', groups=null, email='**************@*********'}, UserInfo: OidcProfile{subject='*****************', username='**************@*********', groups=null, email='**************@*********'}, Merged: OidcProfile{subject='*****************', username='**************@*********', groups=null, email='**************@*********'})

Here is the API Server config:

- ALPINE_OIDC_ENABLED=true
- ALPINE_OIDC_ISSUER=https://accounts.google.com
- ALPINE_OIDC_CLIENT_ID=*****************************.apps.googleusercontent.com
- ALPINE_OIDC_USERNAME_CLAIM=email
- ALPINE_OIDC_TEAMS_CLAIM=groups
- ALPINE_OIDC_USER_PROVISIONING=true
- ALPINE_OIDC_TEAM_SYNCHRONIZATION=true

Here is the Front Server config:

- OIDC_ISSUER=https://accounts.google.com
- OIDC_CLIENT_ID=*****************************.apps.googleusercontent.com
- OIDC_SCOPE=profile openid email https://www.googleapis.com/auth/admin.directory.group.readonly https://www.googleapis.com/auth/admin.directory.user.readonly https://www.googleapis.com/auth/admin.directory.group.member.readonly
- OIDC_FLOW=implicit
- OIDC_LOGIN_BUTTON_TEXT=Google SSO

There is a lot of scopes because I thought I needed all of these to get a group. Apparently it's useless since I need some admin permissions in order to use them.

As a workaround, I thought a default group for all OIDC users would to the trick. Is this possible to create such a group ?

Also, I use "https://accounts.google.com" as my OIDC Issuer. As I was looking for a solution, I saw that the issuer should be "https://accounts.google.com/o/oauth2/auth". I already tried this but Dependency Track can't request this issuer and returns a 404 error.

@AbdelHajou
Copy link
Contributor

Can your users log in when you comment out the TEAM_SYNCHROINZATION and TEAMS_CLAIM properties? Some OIDC providers require additional configuration for group synchronization.

You could also try changing the TEAMS_CLAIM to groupList instead of groups

@AbdelHajou
Copy link
Contributor

@stevespringett I think it would be useful to extend the documentation on OIDC configuration with some example configurations for cloud providers like Azure and GCP. I personally had a lot of trouble configuring Azure AD for my DT instance and it seems to be the same with GCP

@Rokkart
Copy link
Author

Rokkart commented Apr 22, 2022

Hi !
Yes my users can log in if the TEAM_SYNCHRONIZATION and TEAMS_CLAIM properties are commented out. That's the actual setup. That's why I asked if it's possible to create some kind of default group to assign to OIDC users (without these properties)

I don't have any groupList value with these scopes either.

I found an article of Rancher about this subject: https://rancher.com/docs/rancher/v2.5/en/admin-settings/authentication/google/
They are creating a Service Account to get the groups of their users. But it seems like they created this feature as a workaround.

@AbdelHajou
Copy link
Contributor

@Rokkart I don’t think that’s possible yet, but that sounds like a good enhancement idea. Maybe every user should just be added to a Default group to make it easier for admins to manage permissions for new users

@valentijnscholten
Copy link
Contributor

I have seen the error Unable to assemble complete profile when using Azure AD. I think in my case it was some kind of mismatch between frontend and api pod. After restarting them both it started to work. You probably already tried that, just mentioning it.

It might be useful to see if the error message thrown by DT can be made more descriptive. Maybe an error came back from the IdP causing the problem of not being able to assemble the profile? Or some data is missing in some token?

@nscuro
Copy link
Member

nscuro commented Apr 24, 2022

@AbdelHajou I think it would be useful to extend the documentation on OIDC configuration with some example configurations for cloud providers like Azure and GCP.

The issue is that no one who successfully set up OIDC on these platforms has contributed documentation yet. Most of these services require subscriptions of some kind, which makes it impractical for maintainers to just go through all them and write docs for them.

@valentijnscholten Maybe an error came back from the IdP causing the problem of not being able to assemble the profile?

The error means that neither the ID token nor the /userinfo endpoint of the IdP provided enough info to assemble a complete profile. "Complete profile" refers to the sub claim (subject in the logs), the username claim and the teams claim (if configured). The claims can be present in either ID token, /userinfo or both. If you configure ALPINE_OIDC_TEAMS_CLAIM=groups and groups is not present in either of those locations, you'll see the Unable to assemble complete profile error in the logs.

@AbdelHajou
Copy link
Contributor

@nscuro You’re right, I’ll try to contribute some documentation on how to set up Azure AD

@Rokkart
Copy link
Author

Rokkart commented Apr 25, 2022

@valentijnscholten I have seen the error Unable to assemble complete profile when using Azure AD. I think in my case it was some kind of mismatch between frontend and api pod. After restarting them both it started to work. You probably already tried that, just mentioning it.

Indeed, while I was trying to make it work, I restarted multiple times the stack, without any improvement.

As @nscuro said, the "groups" property is not returned by google with the scopes I configured. So it makes sense that in the error message "groups" is null. That's why in this article (https://rancher.com/docs/rancher/v2.5/en/admin-settings/authentication/google/) a Service Account is configured to get the groups with these scopes:

But DT is just not meant to work like this I guess.

Anyway thank you guys for your help. If anyone contributes to the doc or find a way to make it work, let me know ;)

@antrix
Copy link

antrix commented Dec 21, 2022

@Rokkart I don’t think that’s possible yet, but that sounds like a good enhancement idea. Maybe every user should just be added to a Default group to make it easier for admins to manage permissions for new users

Hi @AbdelHajou - this feature would still be useful. Should I create a new issue to track it? I found #979 that can be re-opened?

@nscuro nscuro removed the in triage label Jan 28, 2024
@nscuro nscuro added this to the 4.11 milestone Jan 28, 2024
@nscuro nscuro closed this as completed in f3529f4 Jan 28, 2024
@AkselAllas
Copy link

@nscuro Is there working group mapping for gcp?

Or when will 4.11 be released?

Copy link
Contributor

github-actions bot commented Mar 4, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2024
mikael-carneholm-2-wcar pushed a commit to mikael-carneholm-2-wcar/dependency-track that referenced this issue Mar 15, 2024
Introduces:

* Ability to assign default groups to OIDC users (stevespringett/Alpine#535)
* Tracking of `created` and `lastUsed` timestamps for API keys (stevespringett/Alpine#537)
* Addition of `comment` field to API keys (stevespringett/Alpine#537)

Closes DependencyTrack#1068
Fixes DependencyTrack#1556
Closes DependencyTrack#3349

Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: Mikael Carneholm <mikael.carneholm.2@wirelesscar.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants