Site icon Tutorial

Built-in Tomcat support

Kerberos (the basis for integrated Windows authentication) requires careful configuration. If the steps in this guide are followed exactly, then a working configuration will result. There may be some flexibility in some of the steps below but further testing is required to explore this. From the testing to date it is known that:

The areas where further testing is required include:

There are four components to the configuration of the built-in Tomcat support for Windows authentication. The domain controller, the server hosting Tomcat, the web application wishing to use Windows authentication and the client machine. The following sections describe the configuration required for each component.

The names of the three machines used in the configuration examples below are win-dc01.dev.local (the domain controller), win-tc01.dev.local (the Tomcat instance) and win-pc01.dev.local (client). All are members of the DEV.LOCAL domain.

Note: In order to use the passwords in the steps below, the domain password policy had to be relaxed. This is not recommended for production environments.

Domain Controller

These steps assume that the server has already been configured to act as a domain controller. Configuration of a Windows server as a domain controller is outside the scope of this how-to. The steps to configure the domain controller to enable Tomcat to support Windows authentication are as follows:

setspn -A HTTP/win-tc01.dev.local tc01

ktpass /out c:\tomcat.keytab /mapuser tc01@DEV.LOCAL

/princ HTTP/win-tc01.dev.local@DEV.LOCAL

/pass tc01pass /kvno 0

The above steps have been tested on a domain controller running Windows Server 2008 R2 64-bit Standard using the Windows Server 2003 functional level for both the forest and the domain.

Tomcat instance (Windows server)

These steps assume that Tomcat and a Java 6 JDK/JRE have already been installed and configured and that Tomcat is running as the tc01@DEV.LOCAL user. The steps to configure the Tomcat instance for Windows authentication are as follows:

[libdefaults]

default_realm = DEV.LOCAL

default_keytab_name = FILE:c:\apache-tomcat-8.0.x\conf\tomcat.keytab

default_tkt_enctypes = rc4-hmac,aes256-cts-hmac-sha1-96,aes128-cts-hmac-sha1-96

default_tgs_enctypes = rc4-hmac,aes256-cts-hmac-sha1-96,aes128-cts-hmac-sha1-96

forwardable=true

[realms]

DEV.LOCAL = {

kdc = win-dc01.dev.local:88

}

 

[domain_realm]

dev.local= DEV.LOCAL

.dev.local= DEV.LOCAL

The location of this file can be changed by setting the java.security.krb5.conf systm property.

 

com.sun.security.jgss.krb5.initiate {

com.sun.security.auth.module.Krb5LoginModule required

doNotPrompt=true

principal=”HTTP/win-tc01.dev.local@DEV.LOCAL”

useKeyTab=true

keyTab=”c:/apache-tomcat-8.0.x/conf/tomcat.keytab”

storeKey=true;

};

 

com.sun.security.jgss.krb5.accept {

com.sun.security.auth.module.Krb5LoginModule required

doNotPrompt=true

principal=”HTTP/win-tc01.dev.local@DEV.LOCAL”

useKeyTab=true

keyTab=”c:/apache-tomcat-8.0.x/conf/tomcat.keytab”

storeKey=true;

};

The location of this file can be changed by setting the java.security.auth.login.config system property. The LoginModule used is a JVM specific one so ensure that the LoginModule specified matches the JVM being used. The name of the login configuration must match the value used by the authentication valve.

The SPNEGO authenticator will work with any Realm but if used with the JNDI Realm, by default the JNDI Realm will use the user’s delegated credentials to connect to the Active Directory.

The above steps have been tested on a Tomcat server running Windows Server 2008 R2 64-bit Standard with an Oracle 1.6.0_24 64-bit JDK.

Tomcat instance (Linux server)

This was tested with:

It should work with any Tomcat 8 release although it is recommended that the latest stable release is used.

The configuration is the same as for Windows but with the following changes:

Web application

The web application needs to be configured to the use Tomcat specific authentication method of SPNEGO (rather than BASIC etc.) in web.xml. As with the other authenticators, behaviour can be customised by explicitly configuring the authentication valve and setting attributes on the Valve.

Client

The client must be configured to use Kerberos authentication. For Internet Explorer this means making sure that the Tomcat instance is in the “Local intranet” security domain and that it is configured (Tools > Internet Options > Advanced) with integrated Windows authentication enabled. Note that this will not work if you use the same machine for the client and the Tomcat instance as Internet Explorer will use the unsupported NTLM protocol.

References

Correctly configuring Kerberos authentication can be tricky. The following references may prove helpful. Advice is also always available from the Tomcat users mailing list.

Exit mobile version