Skip to content

Comments

249: Introduce basic and extended ssl settings#312

Closed
capuccinofan wants to merge 3 commits intoKarelCemus:masterfrom
capuccinofan:issue-249-update-ssl-settings
Closed

249: Introduce basic and extended ssl settings#312
capuccinofan wants to merge 3 commits intoKarelCemus:masterfrom
capuccinofan:issue-249-update-ssl-settings

Conversation

@capuccinofan
Copy link
Contributor

No description provided.

@capuccinofan
Copy link
Contributor Author

@KarelCemus Could u please have a look?

Copy link
Owner

@KarelCemus KarelCemus left a comment

Choose a reason for hiding this comment

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

I am not comfortable with this PR as it is binary incompatible and you are introducing plenty of breaking changes, and I am not about to release a new major anytime soon. And it is not appreciated making incompatible changes in minor or even patch releases

I am surprised you proposed changes to your own PR one day after your PR was merged. It makes me feel that your changes were not well thought through, and I probably accepted them to the lib prematurely.

def verifyPeerMode: Option[VerifyPeerMode]

def toOptions: SslOptions = {
override val enabled: Boolean = true
Copy link
Owner

Choose a reason for hiding this comment

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

Why do you need this? Feels redundant given SSLConfig is optional, meaning if you want to disable it, then don't provide it. This would complicate debugging and I am not sure what the benefits of this would be


sealed abstract class VerifyPeerMode(val name: String, val value: SslVerifyMode) extends Product with Serializable

object VerifyPeerMode {
Copy link
Owner

Choose a reason for hiding this comment

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

For some weird unknown reason, I cannot put the comment at the correct line, it belongs here

    def none: VerifyPeerMode = NONE
    def full: VerifyPeerMode = FULL
    def ca: VerifyPeerMode = CA

Why do you need these aliases?


sealed abstract class VerifyPeerMode(val name: String, val value: SslVerifyMode) extends Product with Serializable

object VerifyPeerMode {
Copy link
Owner

Choose a reason for hiding this comment

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

another case

      config.getOption(path, _.getString) match {
        case Some(NONE.name) => Some(none)
        case Some(FULL.name) => Some(full)
        case Some(CA.name)   => Some(ca)
        case _               => None
      }

unrecognized matches shouldn't be ignored silently, it is illegal configuration, I believe it should fail but check other places, how it is usually done there

}

object SslResource {
final case class BasicRedisSslSettingsImpl(enabled: Boolean, verifyPeerMode: Option[VerifyPeerMode]) extends BasicRedisSslSettings
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we need 2 types of settings?

@capuccinofan
Copy link
Contributor Author

I am not comfortable with this PR as it is binary incompatible and you are introducing plenty of breaking changes, and I am not about to release a new major anytime soon. And it is not appreciated making incompatible changes in minor or even patch releases
I am not comfortable with this PR as it is binary incompatible and you are introducing plenty of breaking changes, and I am not about to release a new major anytime soon. And it is not appreciated making incompatible changes in minor or even patch releases

I am surprised you proposed changes to your own PR one day after your PR was merged. It makes me feel that your changes were not well thought through, and I probably accepted them to the lib prematurely.

Yeah, I am sorry, that I didn't take some things into account. The thing is, I need to have an option to enable ssl settings without any settings.

  1. First thought was to make all arguments optional and having something like this:
play.cache.redis.ssl-settings {}

Like existence of object means that ssl should be enabled

But it doesn't look very clear,
2) the next idea was to add the field enabled: boolean to this object
But I am a bit uncomfortable that we can have something like this (disabled ssl with defined settings):

play.cache.redis.ssl-settings {
   a: 1,
   b: 2,
   enabled: false
}

And going to the fact that enabled is responsible for withSsl for RedisURI builder and SslOptions are set on ClientOptions level we can end up in the situation when we disabled SSL with enabled: false but still SslOptions went to ClientOptions. Of course we can check in the ClientOptions builder whether enabled: true|false and then either bring SslOptions to ClientOptions or not. I have just thought it gave us not clear picture of what is going on.

  1. That is why I came up with the idea, that either we have object with enabled:true|false or the settings for ClientOptions that imply that SSL is enabled.

That is what I would like to achieve. Probably we can make it with the second approach. What do you think?

@KarelCemus
Copy link
Owner

I need to have an option to enable ssl settings without any settings.

This is very suspicious, how is that possible? Which configuration would be used then? Isn't this basically the extended one with defaults? Could you elaborate more on this?

However, I agree that empty object is not the best option but also having enabled: false is not welcome either

Btw there is still the issue of the compatibility to make your changes binary compatible with your previous attempt

@capuccinofan
Copy link
Contributor Author

capuccinofan commented Jun 20, 2025

I need to have an option to enable ssl settings without any settings.

This is very suspicious, how is that possible? Which configuration would be used then? Isn't this basically the extended one with defaults? Could you elaborate more on this?

As far as I understood, we should be able to connect using ssl only by enabling withSsl(true) on RedisURI, as stated here:
https://github.com/redis/lettuce/wiki/SSL-Connections
So the idea of having all defaults doesn't seem to work, because we don't need them at all if we wanna just enable it on the RedisURI level. Maybe then we can just define another setting?

play.cache.redis.ssl-settings {...} // filled as in the previous PR or not defined at all
play.cache.redis.ssl = { enabled: boolean, verifyPeer: string }

It will be backward compatible as well

However, I agree that empty object is not the best option but also having enabled: false is not welcome either

Btw there is still the issue of the compatibility to make your changes binary compatible with your previous attempt

@capuccinofan
Copy link
Contributor Author

@KarelCemus Friendly reminder :)

@KarelCemus
Copy link
Owner

Not nice but ok

@capuccinofan
Copy link
Contributor Author

Not nice but ok

Let me think more about this topic, maybe I can come up with something else

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 this pull request may close these issues.

2 participants