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

feat: enable specifying root ca for oidc (#6712) #6712

Merged

Conversation

clive-jevons
Copy link
Contributor

@clive-jevons clive-jevons commented Jul 14, 2021

When configuring an external OIDC provider which uses a private PKI
for its certificates it was not possible to properly verify the certificate
being served. Also, when using ArgoCD in insecure mode, e.g. when running
behind istio for providing mTLS, this resulted in errors.

Closes [6713]

Issue: #6713

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

@clive-jevons clive-jevons changed the title enable specifying root ca for oidc [6713] enable specifying root ca for oidc Jul 14, 2021
@jannfis jannfis self-requested a review July 15, 2021 10:35
@jannfis jannfis self-assigned this Jul 15, 2021
@jannfis jannfis added the security Security related label Jul 15, 2021
@codecov
Copy link

codecov bot commented Jul 16, 2021

Codecov Report

Merging #6712 (c48c569) into master (1ab85de) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6712      +/-   ##
==========================================
- Coverage   41.12%   41.10%   -0.03%     
==========================================
  Files         157      157              
  Lines       21010    21021      +11     
==========================================
  Hits         8640     8640              
- Misses      11141    11152      +11     
  Partials     1229     1229              
Impacted Files Coverage Δ
util/oidc/oidc.go 19.21% <0.00%> (+0.18%) ⬆️
util/settings/settings.go 46.57% <0.00%> (-0.82%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ab85de...c48c569. Read the comment docs.

@clive-jevons clive-jevons force-pushed the enable-specifying-root-ca-for-oidc branch from bacc7cb to 2cc3377 Compare July 17, 2021 10:41
Copy link
Member

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

Thanks, I think this is useful! I had some comment, please see below.

Comment on lines 1386 to 1404
if !ok {
panic("bad oidc root ca cert")
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this does not justify a panic. My suggestion here would be to log an error, and just proceed returning an empty &tls.Config{}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense 😁 Have updated accordingly 👍 Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jannfis <- have you had a chance to check out the newest version? 😬

@clive-jevons clive-jevons force-pushed the enable-specifying-root-ca-for-oidc branch from 2cc3377 to 6124d21 Compare July 17, 2021 13:06
@clive-jevons clive-jevons force-pushed the enable-specifying-root-ca-for-oidc branch from 6124d21 to a69e725 Compare August 6, 2021 08:36
@dcarlet
Copy link

dcarlet commented Aug 13, 2021

@clive-jevons

So, I'm just a random user who just spent a significant number of hours beating my head against the wall trying to figure out why I couldn't get ArgoCD to integrate with my cluster's Keycloak...I suppose I should have looked in the issues sooner! Thank you for this!

Reading through your changes, it looks like the way this would be implemented is that you have to specify the root CA cert in the OIDC.config block as raw text?

@clive-jevons
Copy link
Contributor Author

@dcarlet yes, the PR, as it stands, would allow you to simply include the PEM block of the root CA to be used for trusting the Keycloak's cert.

@jannfis
Copy link
Member

jannfis commented Aug 14, 2021

Sorry for coming back so late to this! Just one minor thing: Would this maybe require some documentation, so that it's not a hidden feature?

@jannfis jannfis added the cherry-pick/2.1 Candidate for cherry picking into the 2.1 release branch label Aug 14, 2021
@jannfis
Copy link
Member

jannfis commented Aug 16, 2021

Also, can you please rebase to HEAD so that the CI can successfully run? Thanks.

When configuring an external OIDC provider which uses a private PKI
for its certificates it was not possible to properly verify the certificate
being served. Also, when using ArgoCD in insecure mode, e.g. when running
behind istio for providing mTLS, this resulted in errors.

Signed-off-by: Clive Jevons <clive@jevons-it.net>
@clive-jevons clive-jevons force-pushed the enable-specifying-root-ca-for-oidc branch from a69e725 to c48c569 Compare August 16, 2021 12:23
@clive-jevons
Copy link
Contributor Author

@jannfis I've rebased and also added a section to the docs 👍 Thnx 😁

Copy link
Member

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

LGTM @clive-jevons

Sincere apologies for the very long cycle on this one. Somehow, this PR has slipped off my focus :(

@jannfis jannfis changed the title [6713] enable specifying root ca for oidc feat: enable specifying root ca for oidc (#6712) Dec 20, 2021
@jannfis jannfis merged commit fcaa8ab into argoproj:master Dec 20, 2021
@jannfis jannfis removed the cherry-pick/2.1 Candidate for cherry picking into the 2.1 release branch label Dec 20, 2021
@clive-jevons
Copy link
Contributor Author

LGTM @clive-jevons

Sincere apologies for the very long cycle on this one. Somehow, this PR has slipped off my focus :(

@jannfis <- Thanks for accepting and using the PR 😁🙏🏻

crenshaw-dev pushed a commit that referenced this pull request Jun 29, 2022
When configuring an external OIDC provider which uses a private PKI
for its certificates it was not possible to properly verify the certificate
being served. Also, when using ArgoCD in insecure mode, e.g. when running
behind istio for providing mTLS, this resulted in errors.

Signed-off-by: Clive Jevons <clive@jevons-it.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security Security related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants