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

Update SAML Endpoint #1936

Closed
wants to merge 1 commit into from
Closed

Conversation

hpkuppuraj
Copy link

@hpkuppuraj hpkuppuraj commented Jul 13, 2022

I am setting up v2.1 cluster with saml authentication, all the configuration seems to be correct however when i try to login and found out that saml authrequest still builds ACS URL with _opendistro/_security/saml/acs instead of /_plugin/_security/saml/acs.
Below is what we extracted from the saml tracer plugin.

<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="ONELOGIN_XYZ"
Version="2.0"
IssueInstant="2022-07-13T08:55:10Z"
Destination="https://domain/trust/saml2/http-redirect/sso/"
ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
AssertionConsumerServiceURL="https://domain/_opendistro/_security/saml/acs"
>
saml:Issueropensearch-saml</saml:Issuer>
<samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
AllowCreate="true"
/>
</samlp:AuthnRequest>

Seems like after version 2.1.0 both enpoints: /_opendistro/_security/saml/acs and /_plugins/_security/saml/acs not working.
If using first-one as IDP acs URL getting: {"statusCode":404,"error":"Not Found","message":"Not Found"} - probbably expected after opensearch-project/security-dashboards-plugin#895
But if switching to 2nd one /_plugins/_security/saml/acs getting {"statusCode":500,"error":"Internal Server Error","message":"Internal Error"}

Rolling back Kibana to version 2.0.1 but leaving Opensearch version: 2.1.0 helps the issue a bit as /_opendistro/_security/saml/acs starts to work again

Description

[Describe what this change achieves]

  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)
  • Bug Fix
  • Why these changes are required?
  • Login Dashboard v2.1 with SAML authentication
  • What is the old behavior before changes and new behavior after changes?
  • Old behaviour doesnt allow dashboard v2.1 to login with saml authentication

Issues Resolved

[List any issues this PR will resolve]

Is this a backport? If so, please add backport PR # and/or commits #

Testing

[Please provide details of testing done: unit testing, integration testing and manual testing]

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@hpkuppuraj hpkuppuraj requested a review from a team July 13, 2022 10:08
@peternied
Copy link
Member

@hpkuppuraj Thanks for this pull request, could you please see about fixing the DCO errors, link?

@peternied peternied changed the title 2.1 Update SAML Endpoint Jul 13, 2022
@peternied peternied changed the base branch from 2.1 to main July 13, 2022 17:06
@peternied
Copy link
Member

Note; I said that this changed was set against the 2.1 branch, lets merge this against main and then the maintainers will backport the change to the next release version

@cliu123
Copy link
Member

cliu123 commented Jul 13, 2022

@hpkuppuraj Thank you so much for the finding and the PR!
This would be a breaking change with changing things like ACS URL even though it would align the behavior with the documentation. If an old version cluster without this change gets upgraded to a new version with this change, the SAML authN would be broken. So IMHO, this will be a great change for 3.0.0 release, and the documentation should be fixed instead till 3.0.0.

@hpkuppuraj
Copy link
Author

@peternied , Thanks for highlighting the signoff part which i have missed at commits. I think i have signed the commits that I have made. Looks like still DCO error there.

@codecov-commenter
Copy link

codecov-commenter commented Jul 14, 2022

Codecov Report

Merging #1936 (bc2c87f) into main (d9bd0dd) will decrease coverage by 0.01%.
The diff coverage is 50.00%.

@@             Coverage Diff              @@
##               main    #1936      +/-   ##
============================================
- Coverage     61.00%   60.99%   -0.02%     
  Complexity     3233     3233              
============================================
  Files           256      256              
  Lines         18088    18088              
  Branches       3224     3224              
============================================
- Hits          11035    11033       -2     
- Misses         5470     5471       +1     
- Partials       1583     1584       +1     
Impacted Files Coverage Δ
...zon/dlic/auth/http/saml/Saml2SettingsProvider.java 61.53% <50.00%> (ø)
...security/auditlog/sink/ExternalOpenSearchSink.java 59.25% <0.00%> (-2.47%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us.

@DarshitChanpura
Copy link
Member

DarshitChanpura commented Jul 14, 2022

@hpkuppuraj I see there are 93 file changes here and some of them are from other PRs. Can you please rebase your branch against main so that the changes you intended to make are the only ones included.

@JustinasKO
Copy link

Maybe better to make both endpoints working? Doesn't seem to be much work and then it would not be breaking change. and in version 3.0 remove _opendistro one.

@peternied
Copy link
Member

Maybe better to make both endpoints working? Doesn't seem to be much work and then it would not be breaking change. and in version 3.0 remove _opendistro one.

I would prefer this approach as suggested by @JustinasKO. @hpkuppuraj is this something you'd be able to pick up or would you like to take this on?

Note; there is another change like this in flight - #1949

@hpkuppuraj
Copy link
Author

Maybe better to make both endpoints working? Doesn't seem to be much work and then it would not be breaking change. and in version 3.0 remove _opendistro one.

I would prefer this approach as suggested by @JustinasKO. @hpkuppuraj is this something you'd be able to pick up or would you like to take this on?

Note; there is another change like this in flight - #1949

Yes sure, let me explore on this and keep both the endpoints working.

@cliu123
Copy link
Member

cliu123 commented Jul 19, 2022

@hpkuppuraj I see there are 93 file changes here and some of them are from other PRs. Can you please rebase your branch against main so that the changes you intended to make are the only ones included.

@hpkuppuraj Would you please follow up with this comment?

@hpkuppuraj
Copy link
Author

hpkuppuraj commented Jul 21, 2022

@cliu123 , I am trying to figure how the PR gets the changes from other commits, but my local branch has just my changes. Could you please help on this. Shall i cancel this PR? and raise a new PR

@JustinasKO
Copy link

JustinasKO commented Jul 22, 2022

@hpkuppuraj just rebase your branch from main branch and only your changes will remain.

@hpkuppuraj
Copy link
Author

@cliu123 , could you please confirm the changes. I believe now only one file change is shown. Also i am seeing DCO author signature mismatch now

@@ -212,11 +212,11 @@ private SingleLogoutService findSingleLogoutService(IDPSSODescriptor idpSsoDescr
}

private String buildAssertionConsumerEndpoint(String dashboardsRoot) {

// Changed to fix bug in 2.1
Copy link

Choose a reason for hiding this comment

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

There is no need to have such comment in the source file, it belongs to the commit message.

Copy link
Member

Choose a reason for hiding this comment

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

+1

@DarshitChanpura
Copy link
Member

@cliu123 , could you please confirm the changes. I believe now only one file change is shown. Also i am seeing DCO author signature mismatch now

I can confirm that I see only 1 file change now. You can fix the DCO error by executing this command: git rebase --signoff HEAD~2 where 2 is the number of commits from current HEAD. Looking at your commit history, you've signed-off your latest commit with Signed-off-by: Hari Prasad Kuppuraj <51482940+hpkuppuraj@users.noreply.github.com> which is not correct. It should be done with your Github user (which is, I believe, what you did in the commit prior to the latest one).

@hpkuppuraj
Copy link
Author

hpkuppuraj commented Jul 26, 2022

@DarshitChanpura , i dont have access to the account(company) i used to commit the first change, hence switched to the personal github account. Hence there is a discrepancy in the signature.

The commit that impacts is 4c432a4 which is not the 2 commit and signoff using different email id. With the rebase signoff to this commit i am not able to signoff with current github account.

Updated the ACS endpoint builder code components. [BUG] v2.1 security plugin is still using _opendistro/_security/saml/acs opensearch-project#1031

Signed-off-by: hari prasad <prasad.hari@lotuss.com>
Signed-off-by: Peter Nied <petern@amazon.com>
@peternied
Copy link
Member

@hpkuppuraj Thanks for your hard work on this pull request, I've cleaned up the commit history and fixed the DCO issues and pushed an update onto your fork, as soon as CI passes this can be merged.

Copy link
Member

@cliu123 cliu123 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!
I have a few questions here:

  1. Should this PR be closed if merging this one?
  2. How was this change tested? Please provide information about testing in the PR description.
  3. With this change, how would the existing clusters built with the old
    ACS endpoint(/_opendistro/_security/saml/acs) work after upgrading to the version with this change?

@DarshitChanpura
Copy link
Member

DarshitChanpura commented Aug 23, 2022

@hpkuppuraj Can you please update on the requested changes? Once they are addressed we can go ahead and merge this PR. Once again, thank you for your contribution!

@peternied
Copy link
Member

@cliu123 Can you shepherd this change along with the frontend to make sure everything is in alignment?

@DarshitChanpura
Copy link
Member

@hpkuppuraj Could you please address @cliu123 's Requested Changes so we can move forward with this PR

@hpkuppuraj
Copy link
Author

hpkuppuraj commented Oct 11, 2022 via email

@peternied
Copy link
Member

@opensearch-project/security this is a breaking change we've been considering for a while how do you feel about us taking it? I'm leaning towards no, while it would be nice to have consistent URLs, I would prefer we don't break folks in a hard to detect way.

Please vote 👍 👎 or comment on this issue, lets revisit this during our next triage.

@peternied peternied added the untriaged Require the attention of the repository maintainers and may need to be prioritized label Oct 19, 2022
@peternied
Copy link
Member

I'm closing this pull request out as we aren't taking steps to get this merged. Thanks again for the contribution sorry it didn't work out on this change.

@peternied peternied closed this Oct 25, 2022
@nerijus
Copy link

nerijus commented Oct 25, 2022

Pity. Then opensearch-dashboards should be patched, because now we have to use every time we update it:

sed -i 's/_plugins/_opendistro/g' /usr/share/opensearch-dashboards/plugins/securityDashboards/server/auth/types/saml/routes.js

@peternied
Copy link
Member

@nerijus from your comment it sounds SAML is broken in security-dashboards-plugin without this change? Can you create an issue

@nerijus
Copy link

nerijus commented Oct 25, 2022

Of course it is broken, that's why this PR was created. I'd still suggest applying this PR instead of changing dashboards.

Edit: I see it is no longer broken in opensearch-dashboards 2.3.0.

@peternied
Copy link
Member

@cliu123 Could you shepherd this PR and determine how to follow up? This seems very bad (tm) and I'm out of the loop on the state of the SAML configuration in dashboards.

@aoguan1990
Copy link

aoguan1990 commented Oct 25, 2022

@cliu123 As per discussion, Endpoint: /_opendistro/_security/saml/acs is also used by Dashboards Security Plugin. Endpoint changed should be planed for both front-end and back-end plugin together.

@cliu123
Copy link
Member

cliu123 commented Oct 25, 2022

This is a documentation issue that I'm creating. Users follow the documentation to configure _plugins/_security/saml/acs in IDP, but in plugins, it still uses /_opendistro/_security/saml/acs.

@cwperks
Copy link
Member

cwperks commented Oct 25, 2022

@cliu123 The documentation website was reverted to reflect this: opensearch-project/documentation-website#877

There was a breaking change to SAML introduced in 2.2 that was reverted in 2.3 with this PR: opensearch-project/security-dashboards-plugin#895

The frontend switched to using /_plugins while this backend change was not applied.

Security dashboards plugin reverted to using /_opendistro/_security/saml/acs for the 2.x line, but it was my understanding that this change is planned for 3.0.0. Now that the main branch is building 3.0.0, what is preventing the merging of this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged Require the attention of the repository maintainers and may need to be prioritized v3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants