elasticsearch-readonlyrest-plugin
elasticsearch-readonlyrest-plugin copied to clipboard
[RORDEV-594] PEM certificates support
🚀New (ES) Added support for certificates in PEM format
@pielas what's the status of this?
@sscarduzio it's generally ready. I just need to fix issues with tests on pipeline
@pielas sth is wrong with es60x module:
2022-07-13T19:57:00.5198056Z [2022-07-13T19:31:19,069][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [ROR1_2] fatal error in thread [main], exiting
2022-07-13T19:57:00.5198318Z
2022-07-13T19:57:00.5198603Z java.lang.NoClassDefFoundError: org/bouncycastle/openssl/PEMParser
2022-07-13T19:57:00.5198781Z
2022-07-13T19:57:00.5199121Z at tech.beshu.ror.utils.SSLCertHelper$.$anonfun$loadPrivateKey$3(SSLCertHelper.scala:67) ~[?:?]
2022-07-13T19:57:00.5199395Z
2022-07-13T19:57:00.5199745Z at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:87) ~[?:?]
We've excluded several intermediate ES modules from PR tests recently. Please make sure that these modules pass the problematic test locally (on the develop all modules will be tested in the pipeline)
@coutoPL ah, it turns out that BouncyCastle library, which I included to handle PEM files, causes JAR hell like other BouncyCastle libraries. Could we just exclude support for PEM files in es60?
I think that there is no sense to fight with it (assuming that the jarhell is not easy to fix)
Parsing a pem file requires bouncy castle? 😳
@sscarduzio No, it's not required. However parsing it without bouncy castle is more troublesome. Here's loadPrivateKey
function without using BC https://github.com/sscarduzio/elasticsearch-readonlyrest-plugin/pull/826/commits/efc9cde59904de6e021d70f300617244a45e747b#diff-1f6f852b3a8af9460e226a8940a31dd40d6b941674985610d0328e709292c3dd As you can see it requires to do few steps by hand and this code is able to load only RSA keys (because of KeyFactory.getInstance("RSA")
). Handling other types is possible, but requires some more handling. Because such implementation is more error prone I decided to use BouncyCastle lib which takes care of everything
OK, I understand. It's ok if you want to skip 6.x
@pielas not much is left to do on this task, but it is running really late. Can we please wrap this up and close it in Jira ASAP?
@sscarduzio I will close it as soon as possible. However I haven't felt well in recent days. I will try to wrap this up in the following days