Delegation token based authentication
An overview on Kafka delegation tokens.
Delegation tokens are lightweight authentication method to complement existing SASL authentication. Kafka is designed to support a high number of clients. However, using Kerberos authentication might be difficult in some environments due to the following reasons:
-
With Kerberos authentication, all clients need access to a keytab or a TGT. Securely distributing the keytabs requires a lot of effort and careful administration. When the TGT is compromised, it has a high blast radius, especially when the same keytabs are used to access multiple services.
-
With Kerberos, client authentication is centralized, and the high number of clients can put a high load on the KDC (Key Distribution Center), resulting in a bottleneck.
Many Hadoop components use delegation tokens to mitigate these problems:
-
Delegation tokens allow these components to secure distributed workloads with low administrative overhead.
-
It is not required to distribute a Kerberos TGT or keytab, which, if compromised, may grant access to all services.
-
A delegation token is strictly tied to its associated service causing less damage if exposed.
-
Delegation tokens make credential renewal more lightweight. This is because the renewal is designed in such a way that only the renewer and the service are involved in the renewal process. The token itself remains the same, so parties already using the token do not have to be updated.
Kafka Delegation Token Basics
Kafka delegation tokens are modeled after Hadoop delegation tokens, and many of their mechanism are the same or very similar. However, this does not mean that they are interchangeable.
Delegation tokens are generated and verified following the HMAC mechanism. There are two basic parts of information in a delegation token, the tokenID (public part) and the HMAC value (private part).
-
The user initially authenticates with the Kafka cluster via SASL, and obtains a delegation token using either the
AdminClient
APIs or thekafka-delegation-token
tool. The principal that created the delegation token is its owner. -
The delegation token details are securely passed to Kafka clients. This can be achieved by sending the token data over an SSL/TLS encrypted connection or writing them to a secure shared storage.
-
Instead of using Kerberos, the Kafka client uses the delegation tokens for subsequent authentication with the brokers.
-
The token is valid for a certain time period, but it can be:
- Renewed
-
A delegation token can be renewed multiple times up until its maximum life before it expires. The token can be renewed by the owner or any other principals the owner sets as “renewer” at time of creation.
- Revoked
- A delegation token can be revoked ahead of its expiry time.
Broker Configuration
Certain delegation token properties can be configured on a service level in Cloudera Manager. You can enable or disable delegation tokens, as well as configure expiry time and maximum lifetime. For more information, see Cloudera Manager Configuration Properties Reference.