You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/11/16 18:35:37 UTC
[GitHub] [kafka] omkreddy commented on a diff in pull request #12843: KAFKA-14375: Remove use of "authorizer-properties" from EndToEndAuthorizerTest
omkreddy commented on code in PR #12843:
URL: https://github.com/apache/kafka/pull/12843#discussion_r1024315000
##########
core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala:
##########
@@ -96,96 +90,52 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas
def clientPrincipal: KafkaPrincipal
def kafkaPrincipal: KafkaPrincipal
- // Arguments to AclCommand to set ACLs.
- def clusterActionArgs: Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--add",
- s"--cluster",
- s"--operation=ClusterAction",
- s"--allow-principal=$kafkaPrincipal")
- // necessary to create SCRAM credentials via the admin client using the broker's credentials
- // without this we would need to create the SCRAM credentials via ZooKeeper
- def clusterAlterArgs: Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--add",
- s"--cluster",
- s"--operation=Alter",
- s"--allow-principal=$kafkaPrincipal")
- def topicBrokerReadAclArgs: Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--add",
- s"--topic=$wildcard",
- s"--operation=Read",
- s"--allow-principal=$kafkaPrincipal")
- def produceAclArgs(topic: String): Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--add",
- s"--topic=$topic",
- s"--producer",
- s"--allow-principal=$clientPrincipal")
- def describeAclArgs: Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--add",
- s"--topic=$topic",
- s"--operation=Describe",
- s"--allow-principal=$clientPrincipal")
- def deleteDescribeAclArgs: Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--remove",
- s"--force",
- s"--topic=$topic",
- s"--operation=Describe",
- s"--allow-principal=$clientPrincipal")
- def deleteWriteAclArgs: Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--remove",
- s"--force",
- s"--topic=$topic",
- s"--operation=Write",
- s"--allow-principal=$clientPrincipal")
- def consumeAclArgs(topic: String): Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--add",
- s"--topic=$topic",
- s"--group=$group",
- s"--consumer",
- s"--allow-principal=$clientPrincipal")
- def groupAclArgs: Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--add",
- s"--group=$group",
- s"--operation=Read",
- s"--allow-principal=$clientPrincipal")
- def produceConsumeWildcardAclArgs: Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--add",
- s"--topic=$wildcard",
- s"--group=$wildcard",
- s"--consumer",
- s"--producer",
- s"--allow-principal=$clientPrincipal")
- def produceConsumePrefixedAclsArgs: Array[String] = Array("--authorizer-properties",
- s"zookeeper.connect=$zkConnect",
- s"--add",
- s"--topic=$topicPrefix",
- s"--group=$groupPrefix",
- s"--resource-pattern-type=prefixed",
- s"--consumer",
- s"--producer",
- s"--allow-principal=$clientPrincipal")
-
def ClusterActionAndClusterAlterAcls = Set(new AccessControlEntry(kafkaPrincipal.toString, WildcardHost, CLUSTER_ACTION, ALLOW),
new AccessControlEntry(kafkaPrincipal.toString, WildcardHost, ALTER, ALLOW))
- def TopicBrokerReadAcl = Set(new AccessControlEntry(kafkaPrincipal.toString, WildcardHost, READ, ALLOW))
def GroupReadAcl = Set(new AccessControlEntry(clientPrincipal.toString, WildcardHost, READ, ALLOW))
def TopicReadAcl = Set(new AccessControlEntry(clientPrincipal.toString, WildcardHost, READ, ALLOW))
def TopicWriteAcl = Set(new AccessControlEntry(clientPrincipal.toString, WildcardHost, WRITE, ALLOW))
def TopicDescribeAcl = Set(new AccessControlEntry(clientPrincipal.toString, WildcardHost, DESCRIBE, ALLOW))
def TopicCreateAcl = Set(new AccessControlEntry(clientPrincipal.toString, WildcardHost, CREATE, ALLOW))
- // The next two configuration parameters enable ZooKeeper secure ACLs
- // and sets the Kafka authorizer, both necessary to enable security.
- this.serverConfig.setProperty(KafkaConfig.ZkEnableSecureAclsProp, "true")
- this.serverConfig.setProperty(KafkaConfig.AuthorizerClassNameProp, authorizerClass.getName)
+
+ def AclClusterAction = new AclBinding(clusterResource,
Review Comment:
Can we remove the ClusterActionAndClusterAlterAcls, AclClusterAction and AclAlter fields now?
##########
core/src/test/scala/integration/kafka/api/SslEndToEndAuthorizationTest.scala:
##########
@@ -81,4 +81,13 @@ class SslEndToEndAuthorizationTest extends EndToEndAuthorizationTest {
props.remove(SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG)
props
}
+ // This test doesn't really care about matching the SSL certificate to a particular principal
+ // We can override the CN and create a principal based on it or on the server SSL
+ // This is really ugly and I'd like a better way to do this.
+ override def superuserSecurityProps(certAlias: String): Properties = {
+ val props = TestUtils.securityConfigs(Mode.CLIENT, securityProtocol, trustStoreFile,
+ certAlias, "server", clientSaslProperties, tlsProtocol)
Review Comment:
Can we use "super-user" CN name?
##########
core/src/test/scala/integration/kafka/api/SslEndToEndAuthorizationTest.scala:
##########
@@ -37,8 +37,8 @@ object SslEndToEndAuthorizationTest {
override def build(context: AuthenticationContext): KafkaPrincipal = {
val peerPrincipal = context.asInstanceOf[SslAuthenticationContext].session.getPeerPrincipal.getName
peerPrincipal match {
- case Pattern(name, _) =>
- val principal = if (name == "server") name else peerPrincipal
+ case Pattern(name, extra) =>
Review Comment:
extra => "cn"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org