Hello there!

Need Help? We are right here!

Support Icon
miniOrange Email Support
success

Thanks for your Enquiry. Our team will soon reach out to you.

If you don't hear from us within 24 hours, please feel free to send a follow-up email to info@xecurify.com

Search Results:

×

Configuring Kerberos Authentication with miniOrange LDAP Gateway


Overview

The miniOrange LDAP Gateway supports Kerberos authentication using Java GSS-API. To enable Kerberos authentication, you must:

  • Create a Service Principal Name (SPN) in Active Directory.
  • Generate a keytab for the SPN.
  • Copy the keytab to the LDAP Gateway server.
  • Configure the Kerberos JAAS and krb5 configuration files.
  • Update the LDAP Gateway application.properties.
  • Restart the LDAP Gateway service.

Prerequisites

Before starting, ensure the following:

  • Active Directory Domain Services is configured.
  • A Domain Controller (KDC) is reachable from the LDAP Gateway server.
  • The LDAP Gateway hostname has proper DNS resolution.
  • Time synchronization between the Gateway server and Domain Controller is within 5 minutes.
  • Java 17 or later is installed.

Follow the step-by-step guide below to configure Kerberos Authentication with miniOrange LDAP Gateway.

Step 1: Create the Service Principal Name (SPN)

  • Create or choose a service account in Active Directory (for example svc_kerberos).
  • Register the HTTP SPN for your Gateway host.
setspn -S HTTP/iso.miniorange.in svc_kerberos

Verify it:

setspn -L svc_kerberos

Expected output should contain:

HTTP/iso.miniorange.in

Step 2: Generate the Keytab

Run the following command on a Domain Controller (or a Windows machine with AD administration tools installed).

ktpass ^
 /princ HTTP/iso.miniorange.in@MINIORANGE.IN ^
 /mapuser svc_kerberos ^
 /crypto AES256-SHA1 ^
 /ptype KRB5_NT_PRINCIPAL ^
 /pass <ServiceAccountPassword> ^
 /out spn.keytab

Example:

ktpass ^
 /princ HTTP/iso.miniorange.in@MINIORANGE.IN ^
 /mapuser svc_kerberos ^
 /crypto AES256-SHA1 ^
 /ptype KRB5_NT_PRINCIPAL ^
 /pass Password@123 ^
 /out spn.keytab

This generates:

spn.keytab

Step 3: Copy the Keytab

Copy the generated keytab to the LDAP Gateway bin directory.

Example:

miniorangegateway/
└── bin/
    ├── spn.keytab
    ├── jaas.conf
    └── krb5.conf

Ensure the Gateway process has read permission on the file.


Step 4: Configure JAAS

Create or edit:

bin/jaas.conf
GSSServer {
    com.sun.security.auth.module.Krb5LoginModule required
    useKeyTab=true
    keyTab="/home/dev/miniorangegateway-1.6.0/bin/spn.keytab"
    principal="HTTP/iso.miniorange.in@MINIORANGE.IN"
    storeKey=true
    doNotPrompt=true
    isInitiator=false
    debug=false;
};

Krb5Client {
    com.sun.security.auth.module.Krb5LoginModule required
    principal="HTTP/iso.miniorange.in@MINIORANGE.IN"
    useTicketCache=false
    doNotPrompt=false
    useKeyTab=false
    storeKey=true
    isInitiator=true
    debug=false;
};

GSSClient {
    com.sun.security.auth.module.Krb5LoginModule required
    useTicketCache=false
    doNotPrompt=false
    useKeyTab=false
    storeKey=true
    isInitiator=true
    debug=false;
};

Replace:

  • Keytab path
  • Principal
  • Realm

according to your environment.


Step 5: Configure krb5.conf

Create or edit:

bin/krb5.conf
[libdefaults]
    default_realm = MINIORANGE.IN
    rdns = false
    dns_lookup_kdc = false
    dns_lookup_realm = false
    forwardable = true
    ticket_lifetime = 24h
    udp_preference_limit = 1

    default_tkt_enctypes = aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96
    default_tgs_enctypes = aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96

    allow_weak_crypto = true

[realms]
    MINIORANGE.IN = {
        kdc = 3.23.128.115:88
    }

[domain_realm]
    .miniorange.in = MINIORANGE.IN
    miniorange.in = MINIORANGE.IN

Update the following values:

  • Realm
  • KDC IP/Hostname
  • Domain mappings

to match your Active Directory environment.


Step 6: Configure application.properties

Navigate to:

webapps/miniorangegateway/WEB-INF/classes/application.properties

Update the following properties:

kerberos.enabled=true

kerberos.jaas.server=GSSServer
kerberos.jaas.client=Krb5Client

kerberos.jaas.config.path=/home/dev/miniorangegateway-1.6.0/bin/jaas.conf

kerberos.krb5.config.path=/home/dev/miniorangegateway-1.6.0/bin/krb5.conf

kerberos.service.principal=HTTP/iso.miniorange.in@MINIORANGE.IN

kerberos.krb5.realm=MINIORANGE.IN

kerberos.krb5.kdc=3.23.128.115

Update the following values according to your environment:

  • kerberos.enabled
  • kerberos.service.principal
  • kerberos.krb5.realm
  • kerberos.krb5.kdc
  • JAAS configuration path
  • krb5 configuration path

Step 7: Restart LDAP Gateway

Restart the Gateway after completing the configuration.

Example:

systemctl restart miniorangegateway

or restart the Tomcat service if the Gateway is deployed inside Tomcat.


2. Kerberos Authentication Flow

The authentication process works as follows:

  • A domain user logs into a Windows workstation.
  • Windows authenticates the user against Active Directory and obtains a Kerberos Ticket Granting Ticket (TGT).
  • When the user accesses a resource protected by the LDAP Gateway, the client requests a service ticket for the configured SPN (for example, HTTP/iso.miniorange.in).
  • Active Directory issues the service ticket to the client.
  • The client sends the Kerberos service ticket to the LDAP Gateway using the SPNEGO (Negotiate) protocol.
  • The LDAP Gateway uses the configured spn.keytab to decrypt and validate the ticket.
  • If the ticket is valid, the user's identity is established without prompting for credentials.
  • The LDAP Gateway can then use the authenticated identity to perform LDAP operations or enforce access policies.
Kerberos Authentication with miniOrange LDAP Gateway

3. Verification

Verify the following before testing:

  • SPN is correctly registered.
  • The keytab matches the configured service account.
  • The principal in jaas.conf matches the principal used to generate the keytab.
  • The realm matches the Active Directory realm.
  • The KDC is reachable on port 88.
  • DNS resolution works for both the Domain Controller and the LDAP Gateway hostname.
  • System clocks are synchronized.

Common Issues

Issue Possible Cause
KDC not reachable Incorrect KDC hostname/IP or firewall blocking port 88
Integrity check failed Password changed after generating the keytab; regenerate the keytab
Server not found in Kerberos database SPN not registered or incorrect service principal
Clock skew too great Time difference between Gateway and Domain Controller exceeds Kerberos tolerance
Pre-authentication failed Incorrect service account password used while generating the keytab
GSSException: No valid credentials provided Keytab path, principal, or JAAS configuration is incorrect

4. Validating the Kerberos Configuration (Linux)

After completing the configuration, you can verify the Kerberos setup independently before starting the LDAP Gateway.

1. Verify DNS Resolution

Ensure the Gateway can resolve both the Active Directory Domain Controller and the Gateway hostname.

nslookup iso.miniorange.in

nslookup <domain-controller-hostname>

or

host iso.miniorange.in

Expected result:

  • The Gateway hostname resolves correctly.
  • The Domain Controller resolves correctly.

2. Verify Network Connectivity

Kerberos communicates with the Key Distribution Center (KDC) over TCP/UDP port 88.

nc -zv <kdc-ip> 88

or

telnet <kdc-ip> 88

Example:

nc -zv 3.23.128.115 88

Expected output:

Connection to 3.23.128.115 88 port [tcp/*] succeeded!

3. Verify System Time

Kerberos is sensitive to clock skew. Ensure the Gateway server time is synchronized with the Domain Controller.

date
timedatectl status

If NTP is configured:

timedatectl

The output should indicate:

System clock synchronized: yes

4. Verify the Keytab

List the principals stored in the keytab.

klist -k /home/dev/miniorangegateway-1.6.0/bin/spn.keytab

Example output:

Keytab name: FILE:/home/dev/miniorangegateway-1.6.0/bin/spn.keytab

KVNO Principal
---- -----------------------------------------------
   3 HTTP/iso.miniorange.in@MINIORANGE.IN

If the expected principal is not present, regenerate the keytab.


5. Obtain a Kerberos Ticket Using the Keytab

Authenticate using the generated keytab.

kinit -kt /home/dev/miniorangegateway-1.6.0/bin/spn.keytab \
HTTP/iso.miniorange.in@MINIORANGE.IN

No output generally indicates success.


6. Verify the Ticket Cache

After running kinit, verify that a Kerberos ticket has been obtained.

klist

Example:

Ticket cache: FILE:/tmp/krb5cc_1000

Default principal:
HTTP/iso.miniorange.in@MINIORANGE.IN

Valid starting       Expires              Service Principal
07/23/2026 10:30     07/24/2026 10:30     krbtgt/MINIORANGE.IN@MINIORANGE.IN

7. Destroy Cached Tickets (Optional)

To remove all cached Kerberos tickets:

kdestroy

Verify:

klist

Expected output:

No credentials cache found

8. Verify the Service Principal

If the kvno utility is available, verify that the service principal can obtain a service ticket.

kvno HTTP/iso.miniorange.in

Expected output:

HTTP/iso.miniorange.in@MINIORANGE.IN:
kvno = 3

This confirms that the SPN is correctly registered in Active Directory.


9. Enable Kerberos Debug Logging (Optional)

For troubleshooting, enable Kerberos debug logging by adding the following JVM option:

-Dsun.security.krb5.debug=true

Example:

JAVA_OPTS="$JAVA_OPTS -Dsun.security.krb5.debug=true"

The Gateway logs will include detailed information about:

  • Realm discovery
  • KDC communication
  • Ticket acquisition
  • SPNEGO negotiation
  • Principal validation
  • Encryption type selection

Disable debug logging after troubleshooting, as it generates verbose output.


5. Common Validation Commands

Purpose Command
Check DNS nslookup iso.miniorange.in
Check KDC connectivity nc -zv <kdc-ip> 88
Display system time timedatectl status
List keytab contents klist -k spn.keytab
Authenticate using keytab kinit -kt spn.keytab HTTP/iso.miniorange.in@MINIORANGE.IN
View cached tickets klist
Destroy cached tickets kdestroy
Request service ticket kvno HTTP/iso.miniorange.in

6. Troubleshooting Checklist

If Kerberos authentication fails, verify the following:

  • The SPN is registered exactly as configured in application.properties.
  • The service account password has not changed since the keytab was generated.
  • The keytab contains the expected principal (klist -k).
  • The configured realm exactly matches the Active Directory realm.
  • The KDC is reachable on port 88.
  • DNS resolution is functioning correctly.
  • The Gateway server time is synchronized with the Domain Controller.
  • The principal specified in jaas.conf matches the principal embedded in the keytab.
  • The paths to jaas.conf, krb5.conf, and spn.keytab are correct and readable by the Gateway process.

If debug logging is enabled, review the logs for errors such as:

  • Server not found in Kerberos database
  • Integrity check on decrypted field failed
  • Clock skew too great
  • Pre-authentication failed
  • Cannot locate KDC
  • No valid credentials provided

External References



Want To Schedule A Demo?

Request a Demo
  




Our Other Identity & Access Management Products