Use Integrated Authentication over Kerberos when connecting to MSSQL on Linux

Troubleshooting Databases

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

The content on this page relates to platforms which are not supported. Consequently, Atlassian Support cannot guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.

This page will help guide you with setting up Kerberos authentication to an external MSSQL server from Linux. More information about using an external MSSQL database can be found at Connecting Stash to SQL Server.

Create a Kerberos configuration file

Create a krb5.conf file with the appropriate configuration for your instance. A sample from Microsoft is provided below.

krb5.conf
[libdefaults]
default_realm = YYYY.CORP.CONTOSO.COM
dns_lookup_realm = false
dns_lookup_kdc = true
ticket_lifetime = 24h
forwardable = yes

[domain_realm]
.yyyy.corp.contoso.com = YYYY.CORP.CONTOSO.COM
.zzzz.corp.contoso.com = ZZZZ.CORP.CONTOSO.COM

[realms]
        YYYY.CORP.CONTOSO.COM = {
  kdc = krbtgt/YYYY.CORP. CONTOSO.COM @ YYYY.CORP. CONTOSO.COM
  default_domain = YYYY.CORP. CONTOSO.COM
}

        ZZZZ.CORP. CONTOSO.COM = {
  kdc = krbtgt/ZZZZ.CORP. CONTOSO.COM @ ZZZZ.CORP. CONTOSO.COM
  default_domain = ZZZZ.CORP. CONTOSO.COM
}

See Using Kerberos Integrated Authentication to Connect to SQL Server from Microsoft for more information.

Configure JAVA to use the Kerberos configuration

Modify <Stash Installation>/bin/setenv.sh and add the following to JVM_REQUIRED_ARGS:

-Djava.security.krb5.conf=<PATH_TO>/krb5.conf

Update the JDBC URL to use Kerberos and Integrated Authentication

Update $STASH_HOME/shared/stash-config.properties to change the JDBC URL so that it uses Kerberos and Integrated Authentication by changing the jdbc.url:

jdbc.url=jdbc:jtds:sqlserver://<MSSQL_HOST:1433;databaseName=<DB_NAME>;domain=<DOMAIN>;integratedSecurity=true;authenticationScheme=JavaKerberos

Stash will need to be restarted after making these changes.

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.