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

RDN elements order shouldn't change when NATS server check for the authorization #1571

Closed
nagukothapalli opened this issue Aug 25, 2020 · 6 comments · Fixed by #1577
Closed
Assignees

Comments

@nagukothapalli
Copy link

nagukothapalli commented Aug 25, 2020

NATS server changes the sequence of the DN element in the principal name of the cert while authorization. Also, it removes the after the comma in the principal name string.
It should exact match of the DN from the cert string. And it shouldn’t remove the spaces. Please find the examples below.

Actual cert: CN=hostname, O=company name, OU=ou, L= location, ST=state, C=country
Using certificate subject for auth ["CN=hostname,OU=ou,O=company name,L=location,ST=state,C=country"]
In my above example, we can see that OU and O elements got interchanged which authorization and removed spaces

And the same issue observed with DC elements as well.

Please let me know if you need any more details from my side.
Thank you.

@ColinSullivan1
Copy link
Member

@nagukothapalli , Thank you for raising this issue.

We've identified the problem. Golang has a specific ordering of the RDNs within the DN when serializing the contents to the string. Unfortunately this means that after parsing a certificate, what go programmatically returns as a string representing the subject may differ from the the raw value in the certificate.

We're altering our comparison function in the server to account for ordering and spaces and will have a fix shortly.

@nagukothapalli
Copy link
Author

@ColinSullivan1 Thank you

@wallyqs
Copy link
Member

wallyqs commented Aug 31, 2020

Related: golang/go#40876, golang/go#29040

@wallyqs
Copy link
Member

wallyqs commented Sep 3, 2020

@nagukothapalli thanks for reporting the issue. The next release will include better support and respect the order of the elements as they were present in the original certificate.

@nagukothapalli
Copy link
Author

@wallyqs @ColinSullivan1

How are we planning to release the patch? does this fix applied on 2.1.7 NATS server as a hotfix?
or are we plaining a new release?

@kozlovic
Copy link
Member

kozlovic commented Sep 3, 2020

@nagukothapalli Working on releasing a 2.1.8 release as soon as possible (maybe today).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants