Skip to main content

Configure SCRAM authentication

Advanced Managed Kafka supports SASL/SCRAM, which authenticates clients that access a cluster with a username and password. Store the username and password used for authentication in a KakaoCloud Secrets Manager secret. When you associate the secret with a cluster, Advanced Managed Kafka reads the secret values and registers them as a Kafka user. To associate or disassociate a secret, you need the Advanced Managed Kafka Security Manager role.

info
  • If you select SCRAM authentication as the client authentication method when creating a cluster, clients cannot connect to the cluster until you associate a secret.
  • Advanced Managed Kafka supports the SCRAM-SHA-512 SASL/SCRAM mechanism. Other mechanisms are not supported.
  • You can associate up to 100 secrets with one cluster. The number of secrets you can associate follows the project's secret quota. If you increase the quota, you can associate the corresponding number of additional secrets. For more information, see Secrets Manager quotas.

Secret requirements​

A secret that you associate with Advanced Managed Kafka must meet all of the following requirements.

ItemDescription
ProjectThe secret must be created in the same project as the cluster.
NameThe name must begin with amk-. Secrets with other names do not appear in the association list. You cannot change a secret name after creation. If the name is incorrect, create a new secret.
Value formatThe secret must use key-value format and contain the username and password keys.
LengthEach key and value must be no more than 128 characters.
StatusThe default version of the secret must have the Active status. You cannot associate a secret that has the Deactivated or Destroyed status.
Access controlIf access control is configured for the secret, grant the Advanced Managed Kafka service agent permission to view the secret.

The following is an example of the secret values.

KeyValue
usernamekafka-app
password********
caution

Advanced Managed Kafka reads the default version of a secret. When you change a secret value, the new version becomes the default version. Update the client configuration at the same time to prevent authentication failures.

Step 1. Create secret​

  1. Go to the KakaoCloud console > Security > Secrets Manager.
  2. Click [Create secret].
  3. Enter the following information, and then click [Create].
ItemDescription
NameEnter a name that begins with amk-. Example: amk-order-service
Secret valueAdd username and password as keys, and enter the username and password to use for authentication as their values.
Encryption keySelect the KMS key used to encrypt the secret.

For more information about creating a secret, see Create and manage secrets.

Step 2. Configure access control (optional)​

Complete this step only if access control is configured for the secret. If access control is not configured, go to Step 3.

  1. Go to the KakaoCloud console > Security > Secrets Manager > Secret, and select the secret you created.
  2. On the Access control tab, click [Add access control].
  3. For the target type, select Service agent account, and then add the Advanced Managed Kafka service agent account.

For more information about access control, see Configure access control.

Step 3. Associate secret with cluster​

  1. Go to the KakaoCloud console > Analytics > Advanced Managed Kafka > Cluster.
  2. Click the name of the cluster with which to associate the secret.
  3. In the message at the top of the details page or on the Security tab, click [Associate].
  4. In the Associate secret popup, select the secret, and then click [Associate].
info
  • You can associate a secret only when the cluster has the Active status.
  • The association list shows only active secrets in the current project whose names begin with amk-. If you created a secret, click the refresh button to update the list.
  • Associating a secret does not change the cluster status. Synchronizing the associated secret across all brokers can take up to 10 minutes. You can authenticate with the username and password after synchronization is complete.

After association is complete, you can view the name, description, and association date and time of the secret in the client authentication section of the Security tab.

Step 4. Configure client connection​

Configure the client with the username and password values from the associated secret. The following is an example Kafka client properties file.

security.protocol=SASL_PLAINTEXT
sasl.mechanism=SCRAM-SHA-512
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
username="kafka-app" \
password="********";
caution

Set security.protocol according to the listener configuration of the cluster.

Disassociate secret​

  1. Go to the Security tab on the cluster details page.
  2. In the client authentication section, click [Disassociate].
  3. Review the information in the popup, and then click [Disassociate].
info
  • You can disassociate a secret only when the cluster has the Active status.
  • Disassociating a secret does not change the cluster status. Synchronizing the change across all brokers can take up to 10 minutes.
caution

When you disassociate a secret, all clients that authenticate with the secret's username and password can no longer connect to the cluster. Authentication also fails if you disable or destroy the secret in Secrets Manager.