Red Hat JBoss Enterprise Application Platform-7.0-How To Set Up SSO With Kerberos-En-US
Red Hat JBoss Enterprise Application Platform-7.0-How To Set Up SSO With Kerberos-En-US
Platform 7.0
For Use with Red Hat JBoss Enterprise Application Platform 7.0
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is
available at
http://creativecommons.org/licenses/by-sa/3.0/
. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must
provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity
logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other
countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and
other countries.
Node.js ® is an official trademark of Joyent. Red Hat Software Collections is not formally related to
or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks
or trademarks/service marks of the OpenStack Foundation, in the United States and other countries
and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or
sponsored by the OpenStack Foundation, or the OpenStack community.
Abstract
The intent of this guide is to explore the topic of single sign-on (SSO) with Kerberos within Red Hat
JBoss Enterprise Application Platform 7.0 as well as provide a practical guide for setting up SSO
with Kerberos in JBoss EAP. Essentially this guide is providing a deeper dive into what SSO with
Kerberos is as well as how to set up and configure it within JBoss EAP. Before reading this guide,
users should read through the Security Architecture document for Red Hat JBoss Enterprise
Application Platform 7.0 and have a solid understanding of the SSO and Kerberos information
presented in that document. This document also makes use of the JBoss EAP CLI interface for
performing configuration changes. For more information on using the CLI for both standalone JBoss
EAP instances as well as JBoss EAP domains, please consult the Red Hat JBoss Enterprise
Application Platform Management CLI Guide. When completing this document, readers should have
a solid, working understanding of SSO and Kerberos, how it relates to JBoss EAP, and how to
configure it.
Table of Contents
Table of Contents
.CHAPTER
. . . . . . . . .1.. .SSO
. . . .WITH
. . . . . KERBEROS
. . . . . . . . . . .DEEPER
. . . . . . . .DIVE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3. . . . . . . . . .
1.1. WHAT ARE SSO AND KERBEROS? 3
1.2. KERBEROS COMPONENTS 3
1.3. ADDITIONAL COMPONENTS 4
1.3.1. SPNEGO 4
1.3.2. JBoss Negotiation 4
1.4. KERBEROS INTEGRATION 5
1.5. HOW DOES KERBEROS PROVIDE SSO FOR JBOSS EAP? 5
1.5.1. Authentication and Authorization with Kerberos in Desktop-Based SSO 5
1.5.2. Kerberos and JBoss EAP 6
.CHAPTER
. . . . . . . . .2.. .HOW
. . . . .TO
. . .SET
. . . .UP
. . .SSO
. . . .FOR
. . . . JBOSS
. . . . . . .EAP
. . . . WITH
. . . . . KERBEROS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7. . . . . . . . . .
2.1. COMPONENTS 7
2.1.1. JBoss Negotiation Toolkit 7
2.1.2. Kerberos Environment 7
2.1.3. Differences from Configuring Previous Versions JBoss EAP 7
2.1.4. Configuring the JBoss EAP Instance 8
2.1.5. Configuring the Web Application 10
2.2. ADDITIONAL CONSIDERATIONS FOR ACTIVE DIRECTORY 12
2.2.1. Configure JBoss Negotiation for Microsoft Windows Domain 12
.CHAPTER
. . . . . . . . .3.. .ADDITIONAL
. . . . . . . . . . . FEATURES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
...........
3.1. ADDING A FORM LOGIN AS A FALLBACK 14
3.2. SECURING THE MANAGEMENT INTERFACES WITH KERBEROS 17
3.2.1. Connecting to the Management Interface 19
3.3. KERBEROS AUTHENTICATION INTEGRATION FOR REMOTING 19
1
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
2
CHAPTER 1. SSO WITH KERBEROS DEEPER DIVE
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, or AS, challenges principals to log in when they first log into the
network. The authentication service is responsible for issuing a Ticket Granting Ticket or TGT,
which is needed for authenticating against the Ticket Granting Service and subsequent access to
secured services and resources.
Service Ticket
3
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
A Service Ticket, or 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 for both the client as well as the destination server
which is the server containing secured service/resource. This 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.1. SPNEGO
Simple and Protected GSSAPI Negotiation Mechanism or SPNEGO provides a mechanism for
extending a Kerberos-based Single Sign On 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.
4
CHAPTER 1. SSO WITH KERBEROS DEEPER DIVE
NOTE
When using JBoss Negotiation to secure certain applications, such as REST web
services, one or more sessions may be created and left 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. Authentication exchange.
When a principal first accesses the network or attempts to access a secured service without a
Ticket Granting Ticket, they are challenged to authenticate against the Authentication Service
with their credentials. The AS validates the user’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.
5
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
The server attempts to decrypt the session information passed to it by the client using its 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, for example using offline dictionary/brute-force attacks.
6
CHAPTER 2. HOW TO SET UP SSO FOR JBOSS EAP WITH KERBEROS
2.1. COMPONENTS
The following components are needed for setting SSO for JBoss EAP with Kerberos:
A web application
You can download a prebuilt WAR file of the JBoss Negotiation Toolkit here. You should download the
version of JBoss Negotiation Toolkit that matches the version of JBoss Negotiation included in JBoss
EAP. For example, if you are using JBoss EAP 7.0.0, which uses JBoss Negotiation 3.0.2.Final-
redhat-1, you should use jboss-negotiation-toolkit-3.0.2.Final.war. You can determine
which version of JBoss Negotiation is being used by looking at
EAP_HOME/modules/system/layers/base/org/jboss/security/negotiation/main/modul
e.xml.
NOTE
The subsequent sections assume a KDC and Kerberos domain have already been set up
and properly configured.
The NegotiationAuthenticator valve is no longer required in the jboss-web.xml, but there still
must be a <security-constraint> and <login-config> elements to be defined in the
web.xml. These are used to decide which resources are secured.
7
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
NOTE
The management CLI commands shown assume that you are running a JBoss EAP
standalone server. For more details on using the management CLI for a JBoss EAP
managed domain, please see the JBoss EAP Management CLI Guide.
/subsystem=security/security-domain=host:add(cache-type=default)
/subsystem=security/security-domain=host/authentication=classic:add
/subsystem=security/security-
domain=host/authentication=classic/login-
module=Kerberos:add(code=Kerberos, flag=required, module-options=
[storeKey=true, refreshKrb5Config=true, useKeyTab=true,
principal=host/testserver@MY_REALM,
keyTab=/home/username/service.keytab, doNotPrompt=true,
debug=false])
reload
If using the IBM JDK, the options for Kerberos module are different. The
jboss.security.disable.secdomain.option system property must be set to true, see Configure
relevant system properties. In addition, the login module should be updated to the following:
For a complete list of options for configuring the Kerberos login module, refer to the Red Hat
JBoss Enterprise Application Platform Login Module Reference.
8
CHAPTER 2. HOW TO SET UP SSO FOR JBOSS EAP WITH KERBEROS
/subsystem=security/security-domain=app-spnego:add(cache-
type=default)
/subsystem=security/security-domain=app-
spnego/authentication=classic:add
/subsystem=security/security-domain=app-
spnego/authentication=classic/login-module=SPNEGO:add(code=SPNEGO,
flag=required, module-options=[serverSecurityDomain=host])
reload
For a complete list of options for configuring the SPNEGO login module, refer to the Red Hat
JBoss Enterprise Application Platform Login Module Reference.
<system-properties>
<property name="java.security.krb5.kdc" value="mykdc.mydomain"/>
<property name="java.security.krb5.realm" value="MY_REALM"/>
<property name="java.security.krb5.conf"
value="/path/to/krb5.conf"/>
<property name="jboss.security.disable.secdomain.option"
value="true"/>
<property name="sun.security.krb5.debug" value="false"/>
</system-properties>
Value Description
9
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
Value Description
NOTE
For more information about configuring system properties, refer to the Red Hat JBoss Enterprise
Application Platform Management CLI Guide.
If any roles were specified in the <auth-constraint>, those roles should be defined in a
<security-role>.
10
CHAPTER 2. HOW TO SET UP SSO FOR JBOSS EAP WITH KERBEROS
IMPORTANT
<web-app>
<display-name>App1</display-name>
<description>App1</description>
<!-- Define a security constraint that requires the All role to
access resources -->
<security-constraint>
<display-name>Security Constraint on Conversation</display-
name>
<web-resource-collection>
<web-resource-name>exampleWebApp</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>All</role-name>
</auth-constraint>
</security-constraint>
<!-- Define the Login Configuration for this Application -->
<login-config>
<auth-method>SPNEGO</auth-method>
<realm-name>SPNEGO</realm-name>
</login-config>
<!-- Security roles referenced by this web application -->
<security-role>
<description>Role required to log in to the
Application</description>
<role-name>All</role-name>
</security-role>
</web-app>
11
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
<jboss-web>
<security-domain>app-spnego</security-domain>
<jacc-star-role-allow>true</jacc-star-role-allow>
</jboss-web>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.jboss.security.negotiation"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
Manifest-Version: 1.0
Dependencies: org.jboss.security.negotiation
In this section, the hostname that is used to access the server as is referred to as HOSTNAME, realm is
referred to as REALM, domain is referred to as DOMAIN, and the server hosting the JBoss EAP instance
is referred to as MACHINE_NAME.
List the mapping registered with the domain for the computer using the command:
setspn -L MACHINE_NAME
12
CHAPTER 2. HOW TO SET UP SSO FOR JBOSS EAP WITH KERBEROS
NOTE
In the rest of the section the host user name is referred to as USER_NAME.
NOTE
Reset the password for the user name as it is a prerequisite for exporting the
keytab.
4. Export the keytab of the user to the server on which JBoss EAP is installed.
Run the following command to export the keytab:
NOTE
This command exports the ticket for the HTTP/HOSTNAME principal to the keytab
service.keytab, which is used to configure the host security domain on JBoss
EAP.
<module-option name="principal">HTTP/HOSTNAME@REALM</module-option>
13
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
NOTE
The fallback to FORM logic is available in case when no SPNEGO or NTLM tokens are
present or, when a SPNEGO token is present, but from another KDC.
1. Configure JBoss EAP and the web application to use Kerberos and SPNEGO.
You can use the following commands to configure the security domains required by the FORM
login authentication mechanism. For full instructions, see the previous section for the steps
required to configure JBoss EAP and web applications to use Kerberos and SPNEGO for
authentication and authorization.
/subsystem=security/security-domain=app-spnego:add(cache-
type=default)
/subsystem=security/security-domain=app-
spnego/authentication=classic:add
/subsystem=security/security-domain=app-
spnego/authentication=classic/login-module=SPNEGO:add(code=SPNEGO,
flag=required, module-options=[password-stacking=useFirstPass,
serverSecurityDomain=host])
/subsystem=security/security-domain=app-
spnego/authentication=classic/login-
module=UsersRoles:add(code=UsersRoles, flag=required, module-
options=[password-stacking=useFirstPass,
usersProperties="file:${jboss.server.config.dir}/users.properties",
rolesProperties="file:${jboss.server.config.dir}/roles.properties"])
reload
/subsystem=security/security-domain=app-fallback:add(cache-
type=default)
/subsystem=security/security-domain=app-
fallback/authentication=classic:add()
14
CHAPTER 3. ADDITIONAL FEATURES
/subsystem=security/security-domain=app-
fallback/authentication=classic/login-
module=UsersRoles:add(code=UsersRoles, flag=required, module-
options=
[usersProperties="file:${jboss.server.config.dir}/fallback-
users.properties",
rolesProperties="file:${jboss.server.config.dir}/fallback-
roles.properties"])
/subsystem=security/security-domain=app-
spnego/authentication=classic/login-module=SPNEGO:map-
put(name=module-options, key=usernamePasswordDomain, value=app-
fallback)
reload
15
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
</login-module>
</authentication>
</security-domain>
<html>
<head></head>
<body>
<form id="login_form" name="login_form" method="post"
action="j_security_check" enctype="application/x-www-form-
urlencoded">
<center> <p>Please login to proceed.</p> </center>
<div style="margin-left: 15px;">
<p> <label for="username">Username</label> <br /> <input
id="username" type="text" name="j_username"/> </p>
<p> <label for="password">Password</label> <br /> <input
id="password" type="password" name="j_password" value=""/> </p>
<center> <input id="submit" type="submit" name="submit"
value="Login"/> </center>
</div>
</form>
</body>
</html>
<html>
<head></head>
<body>
<p>Login failed, please go back and try again.</p>
</body>
</html>
<web-app>
<display-name>App1</display-name>
<description>App1</description>
<!-- Define a security constraint that requires the All role to
access resources -->
<security-constraint>
16
CHAPTER 3. ADDITIONAL FEATURES
NOTE
The management CLI commands shown assume that you are running a JBoss EAP
standalone server. For more details on using the management CLI for a JBoss EAP
managed domain, please see the JBoss EAP Management CLI Guide.
/core-service=management/security-realm=ManagementRealm/server-
identity=kerberos:add
/core-service=management/security-realm=ManagementRealm/server-
17
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
identity=kerberos/keytab=service-name\/hostname@MY-REALM:add(
path=/home\/username\/service.keytab,debug=true)
reload
IMPORTANT
/core-service=management/security-
realm=ManagementRealm/authentication=kerberos:add
reload
IMPORTANT
Based on the order you have defined in the <authentication> element in the
security realm, JBoss EAP will attempt to authenticate the user in that order when
accessing the management interfaces.
4. Securing Both Interfaces with Kerberos. In cases where you would like to secure both the web-
based management console and management CLI with Kerberos, you need a Kerberos server
identity configured for each.
<security-realm name="ManagementRealm">
<server-identities>
<kerberos>
<keytab principal="HTTP/hostname@MY-REALM"
path="/home/username/http.keytab" debug="true"/>
<keytab principal="remote/hostname@MY-REALM"
path="/home/username/remote.keytab" debug="true"/>
</kerberos>
</server-identities>
<authentication>
<local default-user="$local" skip-group-loading="true"/>
<kerberos/>
<properties path="mgmt-users.properties" relative-
to="jboss.server.config.dir"/>
18
CHAPTER 3. ADDITIONAL FEATURES
</authentication>
...
</security-realm>
When you connect to the web-based management console via a browser, the security realm will attempt
to authenticate you based on that ticket.
When connecting to the management CLI, you will need to use the -
Djavax.security.auth.useSubjectCredsOnly=false parameter, as this allows the GSSAPI
implementation to make use of the identity managed at the OS level. You may also need to use the
following parameters based on how your environment is setup:
-Djava.security.krb5.realm=REALM-NAME
Specifies the realm name.
-Djava.security.krb5.kdc=KDC-HOSTNAME
Specifies the location of the KDC
--no-local-auth
Disables local authentication. This is useful if you are attempting to connect to a JBoss EAP instance
running on the same machine you are running the script from.
Example Command
<security-domain name="krb-remoting-domain">
<authentication>
<login-module code="Remoting" flag="optional">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
<login-module code="RealmDirect" flag="required">
19
Red Hat JBoss Enterprise Application Platform 7.0 How to Set Up SSO with Kerberos
<security-realm name="krbRealm">
<server-identities>
<kerberos>
<keytab principal="remote/[email protected]"
path="/path/to/remote.keytab" debug="true"/>
</kerberos>
</server-identities>
<authentication>
<kerberos remove-realm="true"/>
<properties path="mgmt-users.properties" relative-
to="jboss.server.config.dir"/>
</authentication>
</security-realm>
3. Configure the HTTP connector in the remoting subsystem to use the security realm
In addition, you will need to configure the http connector in the remoting subsystem to use the
newly created security realm.
Example Remoting
<subsystem xmlns="urn:jboss:domain:remoting:3.0">
<endpoint/>
<http-connector name="http-remoting-connector" connector-
ref="default" security-realm="krbRealm"/>
</subsystem>
20
CHAPTER 3. ADDITIONAL FEATURES
21