User Impersonation

Describes how to disable, enable, and use impersonation with Kafka REST.

User impersonation enables Kafka REST jobs to be submitted as a particular user. Without impersonation, Kafka REST submits jobs as the user that started Kafka REST server.

On a MapR cluster, the impersonated user is typically the mapr user or the user specified in the MAPR_USER environment variable. By default, impersonation and PAM authentication in Kafka REST are enabled on all types of security.

Disabling User Impersonation

To disable user impersonation, you need to first disable the PAM authentication properties in the file and then disable the rest.proxy.enable.doAs property.

  1. Disable PAM authentication. Set the following properties in opt/mapr/kafka-rest/kafka-rest-<version>/config/
    • authentication.method=NONE
    • authentication.realm=""
  2. Once authentication is disabled, set the following property in /opt/mapr/kafka-rest/kafka-rest-<version>/config/
    • rest.proxy.enable.doAs=false

Example: Verify that a list of topics is owned by an impersonated user

This example gets a list of topics from a particular stream and then checks that it is owned by a particular user. Depending on whether or not impersonation is enabled (the default), you may need to use a different curl command.

$  sudo maprcli stream info -json  -path /stream1
  "timeofday":"2017-09-15 10:24:49.855 GMT+0000",

If impersonation is enabled (the default), use the following query, where the query is submitted as the root user.

$ curl -u root  -X GET http://localhost:8082/topics/%2Fstream%3Atopic1
Enter host password for user 'root':

If impersonation is disabled, use the following query, where the query is submitted as the mapr user.

$ curl  -X GET http://localhost:8082/topics/%2Fstream%3Atopic1
{"error_code":40401,"message":"Topic not found."}