View a markdown version of this page

Appendix B: EMR Kerberos Workflow - Amazon EMR Migration Guide

Appendix B: EMR Kerberos Workflow

When Kerberos is enabled in the EMR Security Configuration, Amazon EMR automatically installs MIT's open-source Kerberos Distribution Center (KDC) with default settings. For a detailed explanation of its configuration and operation, refer to the MIT Kerberos documentation. The following subsections walk through how users interact with a Kerberos-enabled EMR cluster and the corresponding message flow.

EMR Kerberos cluster startup flow for KDC with one-way trust

The following figure shows the EMR Kerberos cluster startup flow for a KDC with one-way trust.

Diagram of the Amazon EMR Kerberos cluster startup flow for a KDC with a one-way trust.

Figure 32: EMR Kerberos Cluster Startup Flow for KDC with One-Way Trust

During EMR cluster provisioning, each node runs a provisioning script that performs the following steps.

  • Primary node only — creates the KDC and configures it for one-way trust.

  • All nodes — starts realmd to join Active Directory, which in turn configures SSSD for user and group mapping and generates the node's keytab.

  • All nodes — creates application principals and keytabs for each application and sub-application.

When a new node joins the cluster, its provisioning script performs the same operations: it creates principals in the KDC on the primary node for all locally running applications, generates the keytab file, joins Active Directory (if configured), and starts the applications.

EMR Kerberos flow through Hue access

The following figure shows the EMR Kerberos flow through Hue access.

Diagram of the Amazon EMR Kerberos authentication flow through Hue access.

Figure 33: EMR Kerberos Flow through Hue access

The flow proceeds through the following steps.

  1. The user logs into Hue (or Zeppelin) with their on-premises credentials.

  2. Hue authenticates those credentials against on-premises Active Directory through LDAP or LDAPS.

  3. Once authenticated, the user submits a Hive query through the Hue interface.

  4. Hue forwards the query to HiveServer2 and instructs it to run the job as the user (impersonation).

  5. HiveServer2 submits the job to the Resource Manager for processing.

  6. During execution, Hadoop authenticates and authorizes the user by invoking SSSD to verify the user account on the local node.

EMR Kerberos flow for directly interacting with HiveServer2

The following figure shows the EMR Kerberos flow for directly interacting with HiveServer2.

Diagram of the Amazon EMR Kerberos flow for directly interacting with HiveServer2.

Figure 34: EMR Kerberos flow for directly interacting with HiveServer2

The flow proceeds through the following steps.

  1. The user connects to the primary node over SSH and authenticates with their credentials.

  2. To obtain a Kerberos ticket, the user runs kinit against the local KDC.

    kinit -k -t <keytab> <principal>
  3. The local KDC delegates authentication to the on-premises KDC and returns a ticket to the user.

  4. The user submits a query to HiveServer2, presenting the Kerberos ticket for authentication.

  5. HiveServer2 requests the local KDC to validate the ticket.

  6. The local KDC forwards the validation request to the on-premises KDC.

  7. HiveServer2 submits the job to the Resource Manager, running it as the authenticated user.

  8. During execution, Hadoop uses SSSD to authenticate and authorize the user account on the local node.