Skip to main content
Enterprise

Overview

Conduktor offers a number of that apply Traffic Control Policies to data. Find out more about Traffic Control Policies
From our blog: Kafka policy enforcement How to move from 50-item policy checklists to automated, enforceable rules at the proxy layer.
You can:

Alter broker config

The alter broker config policy Interceptor will impose limits on configuration changes to ensure that any configuration changed in the cluster adhere to the configured specification. The full list of Kafka configurations that this Interceptor protects is:
  • log.retention.bytes
  • log.retention.ms
  • log.segment.bytes

What happens when sending an invalid request

Any request that doesn’t match the Interceptor’s configuration will be blocked and return the corresponding error message. For example: you want to change the configuration log.retention.ms = 10000, but the Interceptor is being configured minLogRetentionMs=60000. When you send that request to the cluster, the following error is returned: org.apache.kafka.common.errors.PolicyViolationException: Request parameters do not satisfy the configured policy. log.retention.ms is '1', must not be less than '10'

Configuration

The configuration table now includes the updated structure for the configuration values.

BlackList

Long

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • OVERRIDE - execute API with overrideValue values, save in audit the fact that we updated on the fly (with wrong value, and the one we used to fix them).
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example

Alter topic config

The alter topic config policy Interceptor will impose limits on configuration changes to ensure that any configuration changed in the topic adhere to the configured specification. The full list of Kafka configurations that this Interceptor protects is:
  • retention.ms
  • retention.bytes
  • segment.ms
  • segment.bytes
  • segment.jitter.ms
  • flush.messages
  • flush.ms
  • max.message.bytes
  • min.insync.replicas
  • cleanup.policy
  • unclean.leader.election.enable

Sending an invalid request:

Any request that doesn’t match the Interceptor’s configuration will be blocked and return the corresponding error message. For example, you want to change the configuration retention.ms = 10000 but the Interceptor is being configured minRetentionMs=60000. When you send that request to the cluster, the following error is returned:

Configuration

BlackList

Integer

Long

Cleanup policy

Boolean

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • OVERRIDE - execute API with overrideValue (or value for others) values, save in audit the fact that we updated on the fly (with wrong value, and the one we used to fix them).
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example

ClientId required

If client id does not match the specified name convention, it will respond PolicyViolationException when action is BLOCK. Otherwise, fill the client-id with a templating mechanism We support templating such as clientId-{{userIp}}-testing". Here are the values we can expand:
  • uuid
  • userIp
  • vcluster
  • user
  • clientId
  • gatewayIp
  • gatewayHost
  • gatewayVersion
  • apiKey
  • apiKeyVersion
  • timestampMillis

Configuration

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong client id, save in audit.
  • OVERRIDE - execute API with override value with a templating mechanism, save in audit the fact that we updated on the fly.
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example

BLOCK action:
INFO action:
OVERRIDE action:

Consumer group policy

The consumer group policy Interceptor is designed to enhance the reliability and efficiency of Kafka consumer group operations. By enforcing specific configuration policies, it ensures that consumer groups adhere to predefined rules, thereby preventing potential issues.

Sending an invalid request

For example: you configure consumer with groupId is invalid_group_id, but the Interceptor is being configured groupId=conduktor_group_id.*.

Block request

Any request that doesn’t match the Interceptor’s configuration will be blocked and return the corresponding error message. When a consumer sends that configuration to the cluster, the following error is returned:

Info on request

invalid_group_id is still accepted and you will receive an audit record with the following error: Request parameters do not satisfy the configured policy. GroupId 'invalid_group_id' is invalid.

Configuration

Regex

Integer

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • OVERRIDE - execute API with overrideValue values, save in audit the fact that we updated on the fly (with wrong value, and the one we used to fix them).
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example

Create topic policy

Kafka is allowing the creation of topics freely, which leads to invalid topics being created in the cluster. Create topic policy limits on topic creation to ensure that any topics created in the cluster adhere to a minimum/maximum specification for Replication Factor and Partition count, as well as topic-level configs.

Configuration

BlackList

Regex

Integer

Long

Cleanup policy

Compression type

Message timestamp type

Boolean

Compression

  • uncompressed
  • gzip
  • snappy
  • lz4
  • zstd
  • producer

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • OVERRIDE - execute API with overrideValue (or value for others) values, save in audit the fact that we updated on the fly (with wrong value, and the one we used to fix them).
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example

Fetch policy

The fetch policy interceptor will be able to encourage (log) or block fetch requests that do not meet the specified configuration.
With incremental fetch sessions enabled, a fetch policy validates at session open (the initial full fetch) and isn’t re-checked on the incremental fetches within that session — so a policy you tighten on an already-connected consumer takes effect only when its session next re-opens.

Sending an invalid request

Any request that doesn’t match the Interceptor’s configuration will be blocked and return the corresponding error message. For example: you want to send fetch request with isolationLevel=read_committed, but the Interceptor is being configured isolationLevel=read_uncommitted. When you send that request to the cluster, consumer will retry the request and the following error is logged in Gateway:

Configuration

Isolation Level

Boolean

Version

SafeguardIntegerConfig

Isolation

  • read_uncommitted
  • read_committed

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example

Limit commit offset policy

Limit Commit Offset Policy limits commit offset attempts on the same groupId within a minute. If commit offset attempts hit more than limitation in specific duration, it will respond PolicyViolationException.

Configuration

This Interceptor always throttles requests that exceed the rate limit. The throttle duration is calculated dynamically based on how long the client has to wait until the next permit is available.

Example

Limit connection attempts policy

Limit connection policy limits connection attempts within a second because creating a new connection is expensive. If connection attempts hit more than limitation in specific duration, it will respond PolicyViolationException.

Configuration

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example

Limit join group policy

Limit join group policy limits joinGroup attempts on the same groupId within a minute. If joinGroups attempts hit more than limitation in specific duration, it will respond PolicyViolationException.

Configuration

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example

Message header removal policy

This Interceptor cleanup by removing unnecessary record headers when consume message. This supports ‘Fetch Response’ only. This should be run in the end of Interceptor list.

Configuration

Example

Produce policy

The produce policy Interceptor will impose limits on incoming messages to kafka to ensure that messages going to kafka adhere to the configured specification.

Sending an invalid request

Any request that doesn’t match the Interceptor’s configuration will be blocked and return the corresponding error message. For example: you want to send record without header, but the Interceptor is being configured recordHeaderRequired=true. When you send that request to the cluster, the following error is returned:

Configuration

Acks

Boolean

Version

Compression Type

Compression

  • NONE
  • GZIP
  • SNAPPY
  • LZ4
  • ZSTD

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.
The OVERRIDE action (available in other safeguard plugins like CreateTopicPolicy) is not supported by ProducePolicyPlugin.

Example

Producer rate limiting policy

Client throttling (also known as rate limiting or quotas) helps protect your Kafka cluster from selfish clients who use up more than their fair share of network and CPU resources. Throttling can be applied per Gateway instance or more narrowly using Interceptor scoping.

Configuration

Example

The maximum number of bytes that can be produced in any one second, before being throttled. In the above example only 500 bytes are allowed to be produced per second, before being throttled.

Consumer rate limiting policy

Client throttling (also known as rate limiting or quotas) helps protect your Kafka cluster from selfish clients who use up more than their fair share of network and CPU resources. Throttling can be applied per Gateway instance or more narrowly using Interceptor scoping.

Configuration

Example

In the above example only 1000 bytes are allowed to be consumed per second, before being throttled.

Read-only topic policy

The read-only topic policy Interceptor allows you to define some topics to be Read-only. This means that any mutating requests are denied. For example, produce requests are blocked, as are any requests that alter or delete topics. The full list of Kafka API requests that this Interceptor blocks for the specified topics is:
  • ProduceRequest
  • DeleteTopicsRequest
  • AlterConfigsRequest
  • AlterPartitionReassignmentsRequest
  • AlterPartitionRequest
  • CreatePartitionsRequest
  • IncrementalAlterConfigsRequest
  • DeleteRecordsRequest
  • ElectLeadersRequest
  • AlterReplicaLogDirsRequest

Sending a request to a read-only topic

If an attempt is made to send a request to a read-only topic, the following error will be returned, such as:

Configuration

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example

Topic required schema ID policy

Ensuring that all records sent through your Kafka system have a schema associated with them ensures data in a known format for your Kafka consumers. Records with missing schemas can cause application outages, as consumers may be unable to process the unexpected record format. The topic required schema ID policy Interceptor ensures that all records produced to Kafka have a schema set. Learn about schema registry and schema-id .

Sending an invalid record

Topic required schema id policy Interceptor will return the following errors when an invalid record is sent:

Configuration

Action

  • BLOCK - when fail, save in audit and return error.
  • INFO - execute API with wrong value, save in audit.
  • THROTTLE - when fail, save in audit and the request will be throttled with time = throttleTimeMs.

Example