Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

Chapter 1. SSO with Kerberos Deeper Dive

1.1. What are SSO and Kerberos?

A basic background of SSO and Kerberos are provided in the Single Sign On (SSO) section of the Red Hat JBoss Enterprise Application Platform 6 Security Architecture document.

1.2. Kerberos Components

Kerberos itself is a network protocol that enables authentication for users of client/server applications through the use of secret-key cryptography. Kerberos is usually used for authenticating desktop users on networks, but through the use of some additional tools, it can be used to authenticate users to web applications and to provide SSO for a set of web applications. This essentially allows users who have already authenticated on their desktop network to seamlessly access secured resources in web applications without having to re-authenticate. This concept is known as Desktop-Based SSO since the user is being authenticated via a desktop-based authentication mechanism, and their authentication token (or ticket) is being used by the web application as well. This differes from other SSO mechanisms such as Browser-Based SSO, which authenticates users and issues tokens all via the browser.

The Kerberos protocol defines several components that it uses in authentication and authorization:

Tickets

A Ticket is a form of a security token that Kerberos uses for issuing and making authentication and authorization decisions about principals.

Authentication Service

The Authentication Service (AS) challenges principals to log in when they first log into the network. The authentication service is responsible for issuing a Ticket Granting Ticket (TGT), which is needed for authenticating against the Ticket Granting Service and subsequent access to secured services and resources.

Ticket Granting Service

The Ticket Granting Service (TGS) is responsible for issuing Service Tickets and specific session information to principals and the target server they are attempting to access. This is based on the TGT and destination information provided by the principal. This service ticket and session information is then used to establish a connection to the destination and access the desired secured service or resource.

Key Distribution Center

The Key Distribution Center (KDC) is the component that houses both the TGS and AS. The KDC, along with the client (principal) and server (secured service), are the three pieces required to perform Kerberos authentication.

Ticket Granting Ticket

A Ticket Granting Ticket (TGT) is a type of ticket issued to a principal by the AS. The TGT is granted once a principal successfully authenticates against the AS using their username and password. The TGT is cached locally by the client (principal), but is encrypted such that only the KDC can read it (i.e. it is unreadable by the client). This allows the AS to securely store authorization data and other information in the TGT for use by the TGS and enabling the TGS to make authorization decisions using this data.

Service Ticket

A Service Ticket (ST) is a type of ticket issued to a principal by the TGS based on their TGT and the intended destination. The principal provides the TGS with their TGT and the intended destination, and the TGS verifies the principal has access to the destination based on the authorization data in the TGT. If successful, the TGS issues an ST to the client (principal) for both the client as well as the destination server (server containing secured service/resource), which grants the client access to the destination server. The ST, which is cached by the client and readable by both the client and server, also contains session information that allows the client and server to communicate securely.

Note

There is a tight relationship between Kerberos and the DNS settings of the network. For instance, certain assumptions are made when clients access the KDC based on the name of the host it is running on. As a result, it is important that all DNS settings in addition to the Kerberos settings are properly configured to ensure that clients can connect.

1.3. Additional Components

In addition to the Kerberos components, several other items are needed to enable Kerberos SSO with JBoss EAP 6.

1.3.1. SPNEGO

Simple and Protected GSSAPI Negotiation Mechanism (SPNEGO) provides a mechanism for extending a Kerberos-based Single Sign On (SSO) environment for use in Web applications.

SPNEGO is an authentication method used by a client application to authenticate itself to the server. This technology is used when the client application and server are trying to communicate with each other, but neither are sure of the authentication protocol the other supports. SPNEGO determines the common GSSAPI mechanisms between the client application and the server and then dispatches all further security operations to it.

When an application on a client computer, such as a web browser, attempts to access a protected page on the web server, the server responds that authorization is required. The application then requests a service ticket from the Kerberos KDC. After the ticket is obtained, the application wraps it in a request formatted for SPNEGO, and sends it back to the web application, via the browser. The web container running the deployed web application unpacks the request and attempts to authenticate the ticket. Upon successful authentication, access is granted.

SPNEGO works with all types of Kerberos providers, including the Kerberos service included in Red Hat Enterprise Linux and the Kerberos server which is an integral part of Microsoft Active Directory.

1.3.2. JBoss Negotiation

JBoss Negotiation is a framework that ships with JBoss EAP 6 that provides an authenticator and JAAS login module to support SPNEGO in JBoss EAP 6. For more information on JAAS login modules, please see the Declarative Security and JAAS and Security Domains sections of the Red Hat JBoss Enterprise Application Platform 6 Security Architecture guide.

Note

When using JBoss Negotiation to secure certain applications (such as REST web services), one or more sessions may be created and remain open for the timeout period (default is 30 minutes) when a client makes a request. This differs from the expected behavior of securing an application via basic authentication, which would leave no open sessions. JBoss Negotiation is implemented to use sessions to maintain the state of the negotiation/connection so the creation of these sessions is expected behavior.

1.4. Kerberos Integration

Kerberos is integrated with many operating systems including linux distributions such as Red Hat Enterprise Linux. Kerberos is also an integral part of Microsoft Active Directory and is supported by Red Hat Directory Server and Red Hat IDM.

1.5. How does Kerberos provide SSO for Red Hat JBoss Enterprise Application Platform?

Kerberos provides Desktop-based SSO by issuing tickets from a KDC for use by the client and server. JBoss EAP 6 can integrate with this existing process by using those same tickets in its own authentication and authorization process. Before trying to understand how JBoss EAP 6 can reuse those tickets, its best to first understand in greater detail how these tickets are issued as well as how authentication and authorization works with Kerberos in Desktop-Based SSO without JBoss EAP 6.

1.5.1. Authentication and Authorization with Kerberos in Desktop-Based SSO

To provide authentication and authorization, Kerberos relies on a third party (the KDC), to provide authentication and authorization decisions for clients (principals) accessing servers (secured resources/services). These decisions happen in three steps:

  1. Authentication Exchange
  2. Ticket Granting (Authorization) Exchange
  3. Accessing the Server

1. Authentication Exchange

When a principal first accesses the network or attempts to access a secured service without a Ticket Granting Ticket (TGT), they are challenged to authenticate against the Authentication Service (AS) with their credentials. The AS validates the users’s provided credentials against the configured identity store, and upon successful authentication, the principal is issued a TGT which is cached by the client. The TGT also contains some session information so future communication between the client and KDC is secured.

2. Ticket Granting (Authorization) Exchange

Once the principal has been issued a TGT, they may attempt to access secured services/resources. The principal sends a request to the Ticket Granting Service (TGS), passing the TGT it was issued by the KDC and requesting a Service Ticket (ST) for a specific destination (secured resource/service). The TGS checkes the TGT provided by the principal and verifies they have proper permissions to access the requested resource. If successful, the TGS issues an ST for the principal to access that specific destination. The TGS also creates session information for both the client as well as the destination server to allow for secure communication between the two. This session information is encrypted separately such that the client and sever can only decrypt its own session information using long-term keys separately provided by the KDC to each (from previous transactions). The TGS then repsonds to the client with the ST which includes the session information for both the client and server.

3. Accessing the Server

Now that the principal has an ST for the secured service as well as a mechanism for secure communication to that server, client may now establish a connection and attempt to access the secured resource. Client starts by passing to the destination server the ST (which also contains the server component of the session information) it received from the TGS for that destination. The server attempts to decrypt the session information passed to it by the client using it’s long-term key from the KDC. If it succeeds, the client has been successfully authenticated to the server and the server is also considered authenticated to the client. At this point, trust has been established and secured communication between the client and server may proceed.

Note

Despite the fact that unauthorized principals cannot actually use a TGT, a principal will only be issued a TGT after they first successfully authenticate with the AS. Not only does this ensure that only properly authorized principals are ever issued a TGT, it also reduces the ability for unauthorized third parties to obtain TGTs in an attempt to compromise and/or exploit them (e.g. via offline dictionary/brute-force attacks).

1.5.2. Kerberos and Red Hat JBoss Enterprise Application Platform 6

JBoss EAP 6 can integrate with an existing Kerberos Desktop-Based SSO environment to allow for those same tickets to provide access to web applications hosted on JBoss EAP 6 instances. In a typical setup, an JBoss EAP 6 instance would be configured to have Kerberos and SPNEGO security domains. An application, configured to use those security domains along with JBoss Negotiation, is deployed to that JBoss EAP 6 instance. A user logs in to a desktop, which is governed by the Kerberos, and completes an authentication exchange with the KDC. The user then attempts to access a secured resource in the deployed application on that JBoss EAP 6 instance directly via a web browser. JBoss EAP 6 responds that authorization is required to access the secured resource. The web browser obtains the user’s TGT ticket and then performs the ticket granting (authorization) exchange with the KDC to validate the user and obtain a service ticket. Once the ST is returned to the browser, it wraps the ST in a request formatted for SPNEGO, and sends it back to the Web application running on JBoss EAP 6. JBoss EAP 6 then unpacks the SPNEGO request and performs the authentication using the configured security domains and JBoss Negotiation. If the authentication successeds, the user is granted access to the secured resource.