Parse byte array of otherName SANs to string of ASN1 object and OID#943
Parse byte array of otherName SANs to string of ASN1 object and OID#943jksmth wants to merge 1 commit intoopensearch-project:mainfrom
Conversation
|
To update the unit tests, certificates and keystrores need updating in |
Codecov Report
@@ Coverage Diff @@
## main #943 +/- ##
============================================
+ Coverage 64.47% 64.59% +0.11%
+ Complexity 3224 3173 -51
============================================
Files 244 244
Lines 17160 17153 -7
Branches 3040 3042 +2
============================================
+ Hits 11064 11080 +16
+ Misses 4555 4527 -28
- Partials 1541 1546 +5 Continue to review full report at Codecov.
|
debjanibnrj
left a comment
There was a problem hiding this comment.
Thanks for your contribution @jksmth!
You're solution looks good, could you add unit tests to this as well and submit as a PR.
...va/com/amazon/opendistroforelasticsearch/security/ssl/DefaultOpenDistroSecurityKeyStore.java
Show resolved
Hide resolved
|
Hey @jksmth, Friendly ping to see if you need any help with this. Would like to work with you to get this in. |
|
Hello, yes happy to get this finished off. There are quite a few test certs that need generating for the unit tests. I'll try and make a start on it in the next few days. Any helper scripts around to help generate them or is it a manual task? |
|
The cert generation tool mentioned here - https://docs.search-guard.com/latest/offline-tls-tool#tls-tool should help. |
|
Hey @jksmth, Looks like this branch needs to be rebased with main |
Signed-off-by: Jake Smith <jakemgsmith@gmail.com>
40da1f7 to
0840977
Compare
|
Hello @debjanibnrj I have rebased and had to force-push and close/reopen this PR to get it to pickup the changes following the source repo rename to OpenSearch. Please approve the workflow if you are happy and let me know any comments, functionality and tests are now complete. The certs were generated with the offline-tls-tool as you suggested - FYI I also have a PR into that project to add otherName support: floragunncom/search-guard-tlstool#18 |
Codecov Report
@@ Coverage Diff @@
## main #943 +/- ##
============================================
+ Coverage 64.55% 64.57% +0.01%
- Complexity 3165 3173 +8
============================================
Files 244 244
Lines 17124 17153 +29
Branches 3036 3042 +6
============================================
+ Hits 11054 11076 +22
- Misses 4523 4528 +5
- Partials 1547 1549 +2
Continue to review full report at Codecov.
|
debjanibnrj
left a comment
There was a problem hiding this comment.
Thanks for your contribution!
@hardik-k-shah @vrozov Let me know if you can have a look
03e5b9f to
0840977
Compare
|
Hello Are you still interested in this PR? I notice my branch is behaving a bit strangely in GitHub as it was forked before the project rename. Would you like me to refork, rebase and submit a new PR? |
Yes, please resubmit it on OpenSearch repo. Thanks. |
|
Closing this PR - replaced by #1369 |
…ject#943) Signed-off-by: cliu123 <lc12251109@gmail.com> Co-authored-by: Darshit Chanpura <35282393+DarshitChanpura@users.noreply.github.com>
…arch-project#943)" (opensearch-project#950) This reverts commit 6d6c5b7. Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
Signed-off-by: Jake Smith jakemgsmith@gmail.com
opendistro-for-elasticsearch/security pull request intake form
Category: Bug fix
Github Issue SSL certificate hot reload with OtherName in SAN #843
Description of changes:
Checks for type 0 (otherName) Subject Alternate Names (SANs) when validating certificate DNs, if found the byte array is read and if is a valid ASN1 object the OID and value is decoded to provide a string representation of the otherName. This is achieved with the use of bouncycastle lib.
Why these changes are required?
Per SSL certificate hot reload with OtherName in SAN #843
cert.getSubjectAlternativeNames().toString()does not lookup type 0 (otherName) SANs correctly and returns a string representing the byte array which changes on each iteration. This causes hot reload to fail if the certificate includes an otherName in the SAN as the string of the SANs returned bycert.getSubjectAlternativeNames().toString()will never match the current and new certificate in thehasValidDNs()method.What is the old behavior before changes and new behavior after changes?
Old behaviour
Getting currently loaded certificates with
GET /_opendistro/_security/api/ssl/certswould return:Note
[0, [B@6ac191ff]in transport certificate san. Repeated calls to GET /_opendistro/_security/api/ssl/certs shows that the string representation of the OtherName byte array (B@xxxxxxxx) changes each time.New behaviour
Getting currently loaded certificates with
GET /_opendistro/_security/api/ssl/certswill now return:Note
[0, [2.5.4.3, elastic-test-es-node-0]]in transport certificate san is now decoded to a list toString() of [oid, value]Testing done:
Verified by manually testing and unit tests. New test certificates need creating to include an otherName in the SAN.
TO-DOs, if any:
Is it backport from master branch?
No
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.