I have configured the MSK cluster and allowed public access through SASL/SCRAM authentication method. Now I am facing the issue where I do not have the necessary permissions when using these credentials (specified in the Secrets Manager created with a custom key). The connecting client can perform certain operations (e.g. retrieve metadata) but fails to fetch or create topics or publish a new message to the existing topic. I am using Confluent as the library and here is a simplified example of the configuration that I am using (this is probably not relevant at all but is here to support an explanation of the issue).
BootstrapServers = Config.KafkaBootstrapServers,
SaslMechanism = SaslMechanism.ScramSha512, // only supported option by AWS
SecurityProtocol = SecurityProtocol.SaslSsl,
SaslUsername = Config.Username, // username from secrets manager
SaslPassword = Config.Password, // password from secrets manager
ClientId = Config.Client,
Acks = Acks.All
The error I get is Confluent.Kafka.Admin.CreateTopicsException: An error occurred creating topics: [topic]: [Authorization failed.]
How can I assign higher permissions? Since it is a managed Kafka service, there is no option to modify this on broker level directly. And since there is no user behind these credentials (since I am not using IAM auth method), I cannot assign a specific policy to it allowing certain operations like topic creation. What are the options here?
This page explains how ACLs are generally configured on Kafka but not on MSK. Am I missing something here?
2
Answers
In MSK with SASL/SCRAM, authorizations are performed using ACLs. However, note that MSK sets "allow.everyone.if.no.acl.found" to true by default
From public docs:
This means that with Amazon MSK clusters, if you don't explicitly set ACLs on a resource, all principals can access this resource. If you enable ACLs on a resource, only the authorized principals can access it.
I suspect there is some existing ACL on these resources which is preventing you to produce/create topics. Would you be able to list ACLs for this cluster and verify this?
Kafka ACLs commands are working perfectly fine with MSK to control authorization policies on a cluster.
Define policies for the user that you are connecting with –
Config.Username
, with appropriate permissions.