-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
allow TLSv1.3 in ZK for FIPS client connection in testCertificates
#10726
Conversation
ssl.ciphersuites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_CHACHA20_POLY1305_SHA256 | ||
ssl.quorum.ciphersuites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_CHACHA20_POLY1305_SHA256 |
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.
The result of
getSupportedCiphers(getGCMCiphers(), getCBCCiphers(), getTLSv13Ciphers())
in this line.
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.
Is this related to the system test issue @im-konge had? Does this really related to UBI9 (versus RHEL9)? I think we need to consider how many things this might break.
docker-images/kafka-based/kafka/scripts/zookeeper_config_generator.sh
Outdated
Show resolved
Hide resolved
Also, this is the wrong place to put this as these fields are user configurable. If we really want this, I think it should be handled in the operator. |
OK, @im-konge , could you follow up with this PR? You can take it over since I'm going to log off and it is blocking some testing. Thank you. |
Signed-off-by: Luke Chen <[email protected]>
testCertificates
@showuon I'm totally fine with this change if the QE folks are fine with it. But I think it indicates larger issues somewhere. As far as I understood from @im-konge everything works in FIPS but this particular test is not passing. What does that mean for the FIPS support? I guess it means that this policy you mentioned does not affect Java in any way and affects only OpenSSL used to gather the certificates? Is the FIPS support in Java broken? Or is it just behind? If these settings are needed only for ZooKeeper does it mean ZooKeeper configuration does not respect some Java settings and is not FIPS compatible? |
All other tests (and basically everything else) work fine and without issues on the FIPS-enabled clusters. However, in this test we are using the certificates that are available for connecting to the Kafka broker and ZK. For the Kafka broker, there is everything fine and without an issue. For the ZK, there is error like this:
Maybe it's just issue with OpenSSL in our tests and we should maybe somehow customize it. But if it would be some bigger issue, I think it would make all other tests that are using ZK failing. And it's an issue just with ZK, in KRaft everything works fine. |
Right, so the way I read it:
So, should we instead of changing this for one particular test, enable TLSv1.2 and TLS v1.3 by default by setting the That should probably:
Knowing how Java FIPS support worked int he past, it is not unlikely that it somehow decides to disable the TLSv1.2 support from one day to anohter. So maybe this is worth doing even for a few motnhs only? However, I'm not entirely sure how the cipher suites fit into it. Is that really needed for the test to pass? if ZooKeeper somewhere hardcodes the cipher suites instead of selecting them based on the enabled protocols, it deserves to die in a very special hell. I do not think we want to set any cipher suites by default. So that might be best addressed in the test only as done in this PR. |
The new FIPS mode supports:
Java connects with the highest supported version in client and server side.
Correct!
Of course it is the better solution, to allow ZK support TLSv1.3 and TLSv1.2. But we might need complete tests for this change to make sure everything works.
This is a bad design in Zookeeper I agree. In the doc, they said:
And from the code in v3.8.4, you can see it assign different order of ciphers based on JAVA 8 or JAVA 9+. And in master branch, they added TLSv1.3 ciphers at the end. So we need to manually add them into the config in v3.8.4. |
Manipulating the exact list of cipher suites is really dangerous. We should definitely not do it by default anywhere. Without it it probably doesn't make sense to enable TLS v1.3 by default :-(. |
I'm fine we only fix the test. At least if there are users having problem with it, we can ask them to enable TLSv1.3 in Zookeeper config like what we did in this PR. |
In that case, it makes sense to me fixing it just in the test. Should we add some note about it into the documentation? |
@@ -124,7 +124,21 @@ void testCertificates() { | |||
KafkaNodePoolTemplates.controllerPoolPersistentStorage(testStorage.getNamespaceName(), testStorage.getControllerPoolName(), testStorage.getClusterName(), 3).build() | |||
) | |||
); | |||
resourceManager.createResourceWithWait(KafkaTemplates.kafkaEphemeral(testStorage.getNamespaceName(), testStorage.getClusterName(), 3).build()); | |||
resourceManager.createResourceWithWait(KafkaTemplates.kafkaEphemeral(testStorage.getNamespaceName(), testStorage.getClusterName(), 3) |
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 think you cannot do it like this, as the test is running in both ZK and KRaft mode.
So I would do something like this instead
KafkaBuilder kafkaBuilder = KafkaTemplates.kafkaEphemeral(testStorage.getNamespaceName(), testStorage.getClusterName(), 3);
if (!Environment.isKRaftModeEnabled()) {
// in order to make the connection work on FIPS-enabled cluster, we need to enable TLSv1.3 on the ZooKeeper side
kafkaBuilder = kafkaBuilder
.editSpec()
.editOrNewZookeeper()
.addToConfig("ssl.protocol", "TLSv1.3")
.addToConfig("ssl.quorum.protocol", "TLSv1.3")
.addToConfig("ssl.enabledProtocols", "TLSv1.3,TLSv1.2")
.addToConfig("ssl.quorum.enabledProtocols", "TLSv1.3,TLSv1.2")
.addToConfig("ssl.ciphersuites", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256," +
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256," +
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA," +
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384," +
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_CHACHA20_POLY1305_SHA256"
)
.addToConfig("ssl.quorum.ciphersuites", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256," +
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256," +
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA," +
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA," +
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_CHACHA20_POLY1305_SHA256"
)
.endZookeeper()
.endSpec();
}
resourceManager.createResourceWithWait(kafkaBuilder.build());
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.
You're right! Updated.
Signed-off-by: Luke Chen <[email protected]>
c9cde07
to
14f7d42
Compare
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! :) LGTM
/azp run zookeeper-regression |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run zookeeper-regression |
Azure Pipelines successfully started running 1 pipeline(s). |
Thanks for the PR. |
Type of change
Select the type of your PR
Description
In RHEL 9, there is a new policy forced in FIPS mode:
The Extended Master Secret TLS Extension is now enforced on FIPS-enabled systems
The result is that:
Legacy clients that do not support EMS or TLS 1.3 now cannot connect to FIPS servers running on RHEL 9.
This is the case we saw in the test.
So, to allow the client connect to FIPS server, we need to enable TLSv1.3 in zookeeper.
In v3.8.x, it only enables TLSv1.2 by default. We need to enable it manually. To enable TLSv1.3 in ZK, we need to set some configurations. You can see the default value of
ssl.protocol
andssl.quorum.protocol
isTLSv1.2
. We need to update them.For the
ssl.ciphersuites
, we need to addTLSv13Ciphers
manually, too. Compared v3.8.4 with master branch, we can see theTLSv13Ciphers
is missed in v3.8.4 branch. I added them into the config, too.With this change, the
SecurityST#testCertificates
can pass in FIPS enabled cluster.Checklist
Please go through this checklist and make sure all applicable tasks have been done