Skip to main content

Enable and configure SASL authentication for Apache Kafka®

Aiven for Apache Kafka® supports multiple authentication methods, including Simple Authentication and Security Layer (SASL) over SSL.

Enable SASL authentication

To allow clients to authenticate with SASL, enable kafka_authentication_methods.sasl on your Aiven for Apache Kafka service.

  1. In the Aiven Console, select your Aiven for Apache Kafka service.
  2. Click Service settings.
  3. Scroll to Advanced configuration and click Configure.
  4. Click Add configuration options.
  5. Select kafka_authentication_methods.sasl from the list and set the value to Enabled.
  6. Click Save configurations.

The Connection information on the Overview page now shows connection details for SASL and client certificate authentication.

note

SASL and client certificate connections use different ports. The host, CA, and user credentials remain the same.

Configure SASL mechanisms

After enabling SASL authentication, choose which SASL mechanisms clients can use.

Supported mechanisms

Aiven for Apache Kafka supports the following SASL mechanisms:

  • PLAIN: Enabled by default. Controlled by kafka_sasl_mechanisms.plain.

  • SCRAM-SHA-256: Enabled by default. Controlled by kafka_sasl_mechanisms.scram_sha_256.

  • SCRAM-SHA-512: Enabled by default. Controlled by kafka_sasl_mechanisms.scram_sha_512.

  • OAUTHBEARER: Set kafka.sasl_oauthbearer_jwks_endpoint_url to enable OAuth 2.0/OIDC authentication. PLAIN, SCRAM-SHA-256, and SCRAM-SHA-512 remain enabled by default. Each client selects one SASL mechanism when it connects.

    To allow only OAuth 2.0/OIDC authentication, disable kafka_sasl_mechanisms.plain, kafka_sasl_mechanisms.scram_sha_256, and kafka_sasl_mechanisms.scram_sha_512.

    Optional OIDC parameters include kafka.sasl_oauthbearer_expected_issuer, kafka.sasl_oauthbearer_expected_audience, and kafka.sasl_oauthbearer_sub_claim_name.

note

When SASL authentication is enabled, at least one SASL mechanism must be available. OAUTHBEARER satisfies this requirement when kafka.sasl_oauthbearer_jwks_endpoint_url is set. If you disable PLAIN, SCRAM-SHA-256, and SCRAM-SHA-512 without setting kafka.sasl_oauthbearer_jwks_endpoint_url, the update fails because no SASL mechanism is available.

Enable or disable PLAIN, SCRAM-SHA-256, and SCRAM-SHA-512

Use kafka_sasl_mechanisms to enable or disable these mechanisms using one of the following methods.

  1. In the Aiven Console, select your Aiven for Apache Kafka service.

  2. Click Service settings.

  3. Scroll to Advanced configuration and click Configure.

  4. In the Advanced configuration window, configure PLAIN, SCRAM-SHA-256, and SCRAM-SHA-512:

    • To enable or disable PLAIN, set kafka_sasl_mechanisms.plain to Enabled or Disabled.
    • To enable or disable SCRAM-SHA-256, set kafka_sasl_mechanisms.scram_sha_256 to Enabled or Disabled.
    • To enable or disable SCRAM-SHA-512, set kafka_sasl_mechanisms.scram_sha_512 to Enabled or Disabled.
  5. Click Save configurations.

Enable public CA certificates for SASL authentication

After you enable SASL authentication, you can enable public CA certificates for clients that cannot install or trust the default project CA.

Enable public CA certificates using one of the following methods.

  1. In the Aiven Console, select your Aiven for Apache Kafka service.

  2. Click Service settings.

  3. Go to the Cloud and network section and click Actions > More network configurations.

  4. In the Network configuration dialog:

    1. Click Add configuration options.
    2. Find letsencrypt_sasl (or letsencrypt_sasl_privatelink for PrivateLink).
    3. Select the configuration option.
    4. Set the value to Enabled.
    5. Click Save configurations.

The Connection information on the Overview page now supports SASL connections using either Project CA or Public CA.

note
  • The public certificate is issued and validated by Let's Encrypt, a widely trusted certification authority. For details, see How it works.

  • When enabling the public CA over a PrivateLink connection, network configuration may take several minutes before clients can connect. A new port must be allocated and the load balancer route table updated before clients can connect.

Related pages