Kerberos Authentication for MSSQL and Oracle
Configure Kerberos authentication for Microsoft SQL Server and Oracle databases in Harness Database DevOps using JDBC and Delegate-based execution.
Kerberos authentication enables secure, ticket-based authentication between your Harness Delegate and database servers. This guide explains how to configure Kerberos for:
Microsoft SQL Server (MSSQL)
Oracle Database
It covers Delegate configuration, infrastructure prerequisites, JDBC properties, and connection flow.
What is Kerberos authentication?
Kerberos is a network authentication protocol that uses tickets to allow nodes to prove their identity securely. When you test a database connection using Kerberos, the Delegate does not send a username and password directly to the database. Instead, it uses Kerberos tickets to prove identity in a secure and standardized way.
The authentication flow happens in a predictable sequence:
The Delegate initializes Kerberos configuration using
krb5.conf.The
kinitcommand generates a Ticket Granting Ticket (TGT) using the keytab file or password.The JDBC driver uses the TGT to request a Service Ticket for the target database.
The database validates the Service Ticket against its registered SPN.
If validation succeeds, the connection is established.
This model improves security and aligns with enterprise identity systems:
No passwords are transmitted during connection.
Authentication is validated centrally by the KDC (Active Directory).
Access control is enforced using standard Kerberos policies.
This approach allows you to integrate database authentication into your DevOps pipelines without compromising security or compliance requirements.
Prerequisites
Before you begin, ensure you have the following prerequisites in place:
A Harness account with access to the Database DevOps module.
Network connectivity between Delegate and:
KDC / Active Directory
Database server
Valid Kerberos principal and Keytab file.
Correct
krb5.confconfiguration.Database SPN registered correctly in AD.
1. Configure the Delegate for Kerberos
To enable Kerberos authentication, you need to configure the Delegate with the necessary Kerberos files and settings.
Kerberos authentication is executed from the Delegate. The Delegate must:
Resolve KDC DNS.
Have
krb5.confconfigured.Have access to Keytab file.
Execute
kinit.
1. DNS resolution (required)
The Delegate must resolve the KDC server hostname. This can be checked by running the following command:
This command will attempt to resolve the KDC hostname from the Delegate container. If DNS resolution fails, ensure that the Delegate's network configuration allows access to the KDC and that the correct DNS servers are configured.
2. Kerberos configuration
The Delegate needs access to the krb5.conf file, which contains Kerberos realm and KDC information. You can provide this file by mounting it as a volume in the Delegate's Kubernetes deployment. Add the following Kerberos startup script to the Delegate YAML under the INIT_SCRIPT environment variable:
In above script:
Principal: Enter the account name associated with the Kerberos account
Realm: Enter a realm. A realm is a logical network served by a single Kerberos database and a set of Key Distribution Centers (KDCs).
TGT Generation: Select one of the following options:
Key Tab File: Generates a new TGT from KDC every time you authenticate with the service. Go to Generate a keytab file to create the keytab needed for authentication.
Password: Use Harness encrypted text secrets to save the password and refer to it using this option.
3. Mount required files
The Delegate needs access to the Keytab file for authentication. Under CI_MOUNT_VOLUMES in Delegate environment, add the following configuration to mount both krb5.conf and the Keytab file:
4. Use a base64 encoded keytab file
If your keytab is a binary file, encode it to base64 before mounting. The Harness DB DevOps plugin reads the file at PLUGIN_KERBEROS_KEYTAB_FILE_PATH. If the content is a base64-encoded MIT keytab, the plugin automatically decodes it to a temporary file and runs kinit on that decoded file.
Step 1 - Encode the keytab in INIT_SCRIPT:
Add the following line to your INIT_SCRIPT to encode the raw keytab to a base64 file:
Replace <connector-keytab-path> with the path where the keytab file is mounted inside the delegate container (placed there via a Kubernetes secret or volumeMount in your delegate YAML).
Step 2 - Mount the base64 file via CI_MOUNT_VOLUMES:
Set the Harness connector Keytab file path field to /tmp/final.keytab.b64. The plugin reads from that path at runtime.
MSSQL Kerberos configuration
For Microsoft SQL Server, the JDBC URL must include the following properties to enable Kerberos authentication:
Required properties in JDBC URL:
integratedSecurity=trueauthenticationScheme=JavaKerberos
Ensure SPN is registered in AD (Active Directory):
Oracle Kerberos configuration
Server-side configuration
Oracle requires additional server-side configuration to enable Kerberos authentication at location $ORACLE_HOME/network/admin or $TNS_ADMIN:
Create
sqlnet.orawith the following content:
Create
tnsnames.orawith the following content:
JDBC URL for Oracle
The JDBC URL for Oracle with Kerberos authentication should be formatted as follows:
JDBC connection test
To test the connection, complete the following steps in Harness:
Select the "JDBC Connector" under "Project Settings" > "Connectors" in Harness.
When setting up your database connection in Harness, you need to specify the correct JDBC URL and properties to enable Kerberos authentication:
Principal
Realm
Keytab file path (Mounted path in Delegate) / Password (if using password-based Kerberos).

Select the Delegate that has been configured for Kerberos authentication and test the connection. If everything is configured correctly, you should see a successful connection message.

Next steps
You have configured Kerberos authentication for your database connector. You can now run Database DevOps pipelines using Kerberos-authenticated connections.
Go to Supported platforms and technologies to review which database types support Kerberos authentication.
Go to SSL configuration to add transport-layer encryption on top of Kerberos authentication.
Go to Troubleshooting to resolve common Kerberos connection errors.
Last updated
Was this helpful?