Updated on 2024-10-10 GMT+08:00

Configuring Plaintext or Ciphertext Access to Kafka Instances

You can access a Kafka instance in plaintext or ciphertext. This section describes how to change the access mode on the console.

  • Plaintext access: Clients connect to the Kafka instance without SASL authentication.
  • Ciphertext access: Clients connect to the Kafka instance with SASL authentication.
  • When you change the access mode for the first time, some instances will restart. You can see the actual situation on the console. The restart takes about 75–80s. The instance will not be restarted when the access mode is changed again.
  • In the ME-Riyadh, LA-Sao Paulo1, and LA-Santiago regions, the instance access mode cannot be changed.
  • For a single-node instance, you can only enable or disable plaintext for public network access.
  • The access mode cannot be changed for instances with IPv6 enabled.

Prerequisites

You can change the access mode of a Kafka instance only when the instance is in the Running state.

Enabling Plaintext Access

  1. Log in to the console.
  2. Click in the upper left corner to select a region.

    Select the region where your Kafka instance is located.

  3. Click and choose Middleware > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
  4. Click a Kafka instance to go to the Basic Information page.
  5. An instance can be accessed in plaintext over the private network and public network. For details about how to enable plaintext access, see Table 1.

    Table 1 Enabling plaintext access

    Access Method

    Enabling Plaintext Access

    Private network plaintext access

    1. Click next to Plaintext Access in the Private Network Access area. A confirmation dialog box is displayed.
    2. Click OK. The Background Tasks page is displayed. If the status of the task turns to Successful, plaintext access is successfully enabled.

    Public network plaintext access

    1. Check that Public Access is enabled. If it is not enabled, enable it. For details, see Configuring Kafka Public Access.
    2. Click next to Plaintext Access in the Public Network Access area. A confirmation dialog box is displayed.
    3. Click OK. The Background Tasks page is displayed. If the status of the task turns to Successful, plaintext access is successfully enabled.

Enabling Ciphertext Access

  1. Log in to the console.
  2. Click in the upper left corner to select a region.

    Select the region where your Kafka instance is located.

  3. Click and choose Middleware > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
  4. Click a Kafka instance to go to the Basic Information page.
  5. An instance can be accessed in ciphertext over the private network and public network. For details about how to enable ciphertext access, see Table 2.

    Table 2 Enabling ciphertext access

    Access Method

    Enabling Ciphertext Access

    Private network ciphertext access

    1. Click next to Ciphertext Access in the Private Network Access area. The Private Network Ciphertext Access dialog box is displayed.
    2. Set the Kafka security protocol, SASL/PLAIN mechanism, username, and password, and click OK. The Background Tasks page is displayed. If the status of the task turns to Successful, ciphertext access is successfully enabled.
      NOTE:
      • When enabling ciphertext access for the first time (including through private network and public network), you need to set the Kafka security protocol, SASL/PLAIN mechanism, username, and password. Next time when you enable ciphertext access, you only need to set the Kafka security protocol.
      • Private network ciphertext access cannot be disabled in some regions. In this case, contact customer service.

    Public network ciphertext access

    1. Check that Public Access is enabled. If it is not enabled, enable it. For details, see Configuring Kafka Public Access.
    2. Click next to Ciphertext Access in the Public Network Access area. The Public Network Ciphertext Access dialog box is displayed.
    3. Set the Kafka security protocol, SASL/PLAIN mechanism, username, and password, and click OK. The Background Tasks page is displayed. If the status of the task turns to Successful, ciphertext access is successfully enabled.
      NOTE:

      When enabling ciphertext access for the first time (including through private network and public network), you need to set the Kafka security protocol, SASL/PLAIN mechanism, username, and password. Next time when you enable ciphertext access, you only need to set the Kafka security protocol.

    The Kafka security protocol, SASL/PLAIN mechanism, username, and password are described as follows.

    Table 3 Ciphertext access parameters

    Parameter

    Value

    Description

    Security Protocol

    SASL_SSL

    SASL is used for authentication. Data is encrypted with SSL certificates for high-security transmission.

    SASL_PLAINTEXT

    SASL is used for authentication. Data is transmitted in plaintext for high performance.

    SCRAM-SHA-512 authentication is recommended for plaintext transmission.

    Cross-VPC Access Protocol

    -

    • When Plaintext Access is enabled and Ciphertext Access is disabled, PLAINTEXT is used for Cross-VPC Access Protocol.
    • When Ciphertext Access is enabled and Security Protocol is SASL_SSL, SASL_SSL is used for Cross-VPC Access Protocol.
    • When Ciphertext Access is enabled and Security Protocol is SASL_PLAINTEXT, SASL_PLAINTEXT is used for Cross-VPC Access Protocol.

    Fixed once the instance is created.

    SASL/PLAIN

    -

    • If SASL/PLAIN is disabled, the SCRAM-SHA-512 mechanism is used for username and password authentication.
    • If SASL/PLAIN is enabled, both the SCRAM-SHA-512 and PLAIN mechanisms are supported. You can select either of them as required.

    The SASL/PLAIN setting cannot be changed once ciphertext access is enabled.

    What are SCRAM-SHA-512 and PLAIN mechanisms?

    • SCRAM-SHA-512: uses the hash algorithm to generate credentials for usernames and passwords to verify identities. SCRAM-SHA-512 is more secure than PLAIN.
    • PLAIN: a simple username and password verification mechanism.

    Username and Password

    -

    Username and password used by the client to connect to the Kafka instance.

    A username should contain 4 to 64 characters, start with a letter, and contain only letters, digits, hyphens (-), and underscores (_).

    A password must meet the following requirements:

    • Contains 8 to 32 characters.
    • Cannot start with a hyphen (-) and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, spaces, and special characters `~! @#$ %^&*()-_=+\|[{}];:'",<.>?
    • Cannot be the username spelled forward or backward.

    The username cannot be changed once ciphertext access is enabled.

    The Kafka security protocol, SASL/PLAIN mechanism, username, and password are required when the client accesses a Kafka instance with ciphertext access enabled. For details, see Connecting to Kafka Using the Client (SASL Enabled).

Disabling Plaintext Access

  1. Log in to the console.
  2. Click in the upper left corner to select a region.

    Select the region where your Kafka instance is located.

  3. Click and choose Middleware > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
  4. Click a Kafka instance to go to the Basic Information page.
  5. An instance can be accessed in plaintext over the private network and public network. For details about how to disable plaintext access, see Table 4.

    Table 4 Disabling plaintext access

    Access Method

    Disabling Plaintext Access

    Private network plaintext access

    Once enabled, private network access cannot be disabled. Enable plaintext or ciphertext access, or both. If ciphertext access is disabled, plaintext access cannot be disabled.

    1. Click next to Plaintext Access in the Private Network Access area.
    2. Click OK. The Background Tasks page is displayed. If the status of the task turns to Successful, plaintext access is successfully disabled.

    Public network plaintext access

    1. Click next to Plaintext Access in the Public Network Access area.
    2. Click OK. The Background Tasks page is displayed. If the status of the task turns to Successful, plaintext access is successfully disabled.

Disabling Ciphertext Access

  1. Log in to the console.
  2. Click in the upper left corner to select a region.

    Select the region where your Kafka instance is located.

  3. Click and choose Middleware > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
  4. Click a Kafka instance to go to the Basic Information page.
  5. An instance can be accessed in ciphertext over the private network and public network. For details about how to disable ciphertext access, see Table 5.

    Table 5 Disabling ciphertext access

    Access Method

    Disabling Plaintext Access

    Private network ciphertext access

    In regions where private network ciphertext access cannot be disabled, contact customer service. In regions where it can be disabled, do as follows:

    1. Click next to Ciphertext Access in the Private Network Access area.
    2. Click OK. The Background Tasks page is displayed. If the status of the task turns to Successful, ciphertext access is successfully disabled.

    Public network ciphertext access

    1. Click next to Ciphertext Access in the Public Network Access area.
    2. Click OK. The Background Tasks page is displayed. If the status of the task turns to Successful, ciphertext access is successfully disabled.

    After you disable ciphertext access, the created users will not be deleted. You do not need to create users again when you enable ciphertext access next time.