MINOR: fix failing system test delegation_token_test#10237
MINOR: fix failing system test delegation_token_test#10237cmccabe merged 2 commits intoapache:trunkfrom
Conversation
| if self.is_sasl(self.security_protocol): | ||
| sasl_mechanisms += [self.client_sasl_mechanism] | ||
| # .csv is supported so be sure to account for that possibility | ||
| sasl_mechanisms += self.client_sasl_mechanism.strip().split(',') |
There was a problem hiding this comment.
Not sure if we should bother in this PR, but the usages of client_sasl_mechanism could stand to be cleaned up. In SecurityConfig.__init__ we default it to a simple string, but as you found here (and as seen in SecurityConfig.client_config) we support it being a comma delimited string.
kafka/tests/kafkatest/services/security/security_config.py
Lines 240 to 253 in 58b3b1b
It's probably a lot safer to declare this as a list in the class and not worry about having to do the split(",") everywhere. Though maybe there's a reason why we split it lazily.. not sure.
Either way, this change looks good. However, you might consider doing something like:
sasl_mechanisms += [mechanism.strip() for mechanism in self.client_sasl_mechanism.split(',')]since self.client_sasl_mechanism.strip() won't catch spaces in the middle of the string.
There was a problem hiding this comment.
Not sure if we should bother in this PR, but the usages of client_sasl_mechanism could stand to be cleaned up
I agree it needs to be cleaned up. Given we are past code freeze for 2.8, I've opened https://issues.apache.org/jira/browse/KAFKA-12402 for this and we can address it another time.
Reviewers: Colin P. McCabe <cmccabe@apache.org>, David Arthur <mumrah@gmail.com>
The system test in
delegation_token_test.pybroke due to #10199.That patch changed the logic of
SecurityConfig.enabled_sasl_mechanisms()to only add the inter-broker SASL mechanism when the inter-broker protocol wasSASL_{PLAINTEXT,SSL}. The inter-broker protocol isPLAINTEXTindelegation_token_test.py, so the default inter-broker SASL mechanism ofGSSAPIwas not being added into the set returned byenabled_sasl_mechanisms(). This is actually correct -- it shouldn't be added if it isn't used for inter-broker communication. It should be added because clients use it, of course --SASL_PLAINTEXTis the security protocol on an advertised listener, andclient_sasl_mechanismis set to the .csv value"GSSAPI,SCRAM-SHA-256"indelegation_token_test. Unfortunately in #10199 we did not take into account the possibility thatclient_sasl_mechanismcould be a .csv value, and we therefore fail to create akrb5.conffile, which causeskafka-delegation_tokens.shto fail. This bug of .csv omission therefore uncovered a different bug -- we were relying on the default inter-broker SASL mechanism to signal that Kerberos was being used even though the inter-broker protocol wasn't SASL. This patch explicitly includes the elements of theclient_sasl_mechanism.csv value (which in most cases is just a single value but indelegation_token_testit is not).Committer Checklist (excluded from commit message)