-
Notifications
You must be signed in to change notification settings - Fork 102
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
Create KafkaCredentialStore #530
Conversation
import java.security.MessageDigest | ||
import scala.annotation.tailrec | ||
|
||
package object security { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could consider moving it to a separate module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @LMnet, I did wonder about that. It just seemed like it wasn't that separate from the core. Happy to move it out if that's what people want 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this code is blatantly copied from Secret
in ciris. Perhaps it should be its own library, because I'm sure I've seen code very similar to this in a few different places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially agreed with @LMnet, but I think it's better to keep it in the same module so we can have the withCredentials
helpers on the settings classes.
Thanks for this! I'll take a look soon |
modules/core/src/main/scala/fs2/kafka/security/TrustStoreFile.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: Ben Plommer <ben.plommer@gmail.com>
modules/vulcan/src/main/scala/fs2/kafka/vulcan/AvroSettings.scala
Outdated
Show resolved
Hide resolved
modules/vulcan/src/main/scala/fs2/kafka/vulcan/SchemaRegistryClientSettings.scala
Outdated
Show resolved
Hide resolved
I assume you're happy for this code to be copied over @vlovgr? |
Absolutely. 👍 |
Kafka 2.7.0 adds support for textual SSL credentials, so we may not need this after all: apache/kafka#9345 |
Happy to adapt this PR so that it can handle textual SSL creds or the code in this PR, if that would help |
Thanks, that would be great! I guess you saw the snippet I posted on Slack, but if not here it is: consumerSettings
.withProperties(Map(
"security.protocol" -> "SSL",
"ssl.truststore.type" -> "PEM",
"ssl.truststore.certificates" ->
"""
-----BEGIN CERTIFICATE-----
// CA certificate
-----END CERTIFICATE-----
|""".replace('\n', ' '),
"ssl.keystore.type" -> "PEM",
"ssl.keystore.key" ->
"""
-----BEGIN PRIVATE KEY-----
// access key
-----END PRIVATE KEY-----""".replace('\n', ' ')
,
"ssl.keystore.certificate.chain" ->
"""
-----BEGIN CERTIFICATE-----
// access certificate
-----END CERTIFICATE-----
""".replace('\n', ' ')
)) |
Cool, I'll add a few |
I haven’t forgotten about this! I’ll get to it this weekend. |
I don't think |
Fix for #521
Moving the code in https://github.com/ovotech/ciris-aiven-kafka for credential loading.
Example code using ciris would now be: