Kafka Connect authorization
Ranger policies control which Kafka Connect operations each user can perform and determine which Connect clusters and connectors are visible and manageable in Cloudera Surveyor.
Authorization model
A Ranger policy for Kafka Connect specifies a resource, a set of permitted operations, and the principals the policy applies to. A principal is a user's Cloudera Anywhere Cloud Console login username. An administrator configures these policies in the Kafka Connect Ranger service to define who can access the Connect clusters, the connectors, and what they can do with them.
In Cloudera Anywhere Cloud, direct programmatic access to the Kafka Connect REST API is not available. Users monitor and manage Kafka Connect strictly through the Cloudera Surveyor UI. When a user attempts operations such as viewing clusters and connectors, creating connectors, or pausing a connector, Cloudera Surveyor evaluates the request against the Ranger policies in the Kafka Connect Ranger service. If a matching allow policy exists for the requesting principal, the request proceeds. If no matching policy exists, the request is denied. A user who has no policies has no access to Kafka Connect.
Cloudera Surveyor access and Kafka Connect authorization
Because Cloudera Surveyor enforces the Ranger policies for every request, a user's Ranger policies determine both what they can see in Cloudera Surveyor and what management actions they can perform. There is no separate Cloudera Surveyor authorization configuration for Kafka Connect, so setting up a user's Kafka Connect access in Ranger also sets up their Cloudera Surveyor access.
Ranger permissions affect Cloudera Surveyor in two distinct ways:
- Visibility: View permission on a resource controls whether that resource appears in Cloudera Surveyor. View on Cluster is the mandatory entry point. Without it, the Connect cluster and all of its connectors are hidden, regardless of what other permissions the user holds. No connector permission implies View on Cluster. For connectors within a visible cluster, View on each individual connector controls whether that connector appears. Resources the user cannot access are filtered from view.
- Management actions: Action permissions such as Create, Edit, Delete, and Validate control whether the corresponding operations are authorized. Cloudera Surveyor does not check these permissions until the user attempts the action. If the user lacks the permission, Cloudera Surveyor rejects the request and displays an error.
Connector access to Kafka
Connectors access Kafka as the Connect cluster's service account, not as the user who deployed the connector. All connectors in a Connect cluster share this identity. When a sink connector consumes from a topic or a source connector produces to one, Kafka evaluates the request against the policies of the Connect service account in the Kafka Ranger service, not in the Kafka Connect Ranger service.
Two separate Ranger services are involved, and each one authorizes a different identity:
- Kafka Connect Ranger service: Controls which users can create and manage connectors.
- Kafka Ranger service: Controls which Kafka resources connectors can access, through the policies of the Connect service account.
When a Connect cluster is deployed, its service account is automatically added to the default Kafka policies, which grant all permissions on all Kafka resources. You do not need to grant connectors access to Kafka. Every connector in the Connect cluster can access any Kafka topic, regardless of which topics it reads from or writes to.
Because connectors run with the permissions of the Connect service account, a user's own Kafka policies do not limit what their connectors can do. A user who has the Create or Edit permission on the Connector resource in the Kafka Connect Ranger service can configure a connector to read from or write to any Kafka topic in the cluster. These two permissions therefore effectively extend to full access to Kafka data. Take this into account when you grant them.
Kafka Connect resources and Ranger permissions
Ranger controls Kafka Connect access through two resource types, each with a distinct set of permissions that control which operations a principal can perform.
The Kafka Connect resources are as follows:
- Cluster
- Connector
For each resource, a set of permissions controls which operations principals can perform. The following sections and tables collect available permissions and the access they grant.
Cluster permissions
The Cluster resource represents the Kafka Connect cluster, the group of workers that run connectors and their tasks.
| Permission | Cloudera Surveyor access |
|---|---|
| View | Connect cluster appears in the Connect clusters list, and its details are accessible, including the installed plugins, connector and task counts, and alerts. Required for any access to its connectors |
| Validate | Can validate a connector configuration with the Validate option, both when creating a connector and when editing the configuration of an existing connector |
| Manage | No effect |
Each Kafka Connect Ranger service belongs to a single Connect cluster. The only valid value
for the Cluster resource is *, which refers to the Connect cluster that the
service belongs to.
Cloudera recommends that you grant the Validate permission on the Cluster resource to all users who have the Create or Edit permission on the Connector resource.
With the Validate permission, users can check a connector configuration using the Validate option in the UI before they create the connector or apply their changes. Cloudera Surveyor then highlights each invalid property.
Without the Validate permission, users cannot check the configuration in advance. If Kafka Connect rejects a new connector or a configuration change, Cloudera Surveyor displays an error but does not highlight the properties that caused it.
Connector permissions
The Connector resource represents Kafka Connect connectors, the components that move data between Kafka and external systems.
| Permission | Cloudera Surveyor access |
|---|---|
| View | Connector appears in the connector list; connector details are accessible. |
| Manage | Can start, stop, pause, and restart connectors, and restart individual connector tasks. |
| Edit | Can edit connector configuration |
| Create | Can deploy connectors. Evaluated against the name of the new connector, so a policy can limit the connector names a user may create |
| Delete | Can delete connectors |
Implied grants
Ranger defines implied grants for Kafka Connect. Every permission other than View implies View on the same resource type, so you do not need to grant View separately when granting any other permission on that resource. Implied grants do not cross resource types. For example, a permission on Connector never implies View on Cluster.
The following table lists all implied grants:
| Permission | Implies |
|---|---|
| Manage on Cluster | View on Cluster |
| Validate on Cluster | View on Cluster |
| Manage on Connector | View on Connector |
| Edit on Connector | View on Connector |
| Create on Connector | View on Connector |
| Delete on Connector | View on Connector |
