Published on

March 8, 2011

Understanding SQL Server Kerberos Authentication

In the world of SQL Server, configuring Kerberos authentication can be a daunting task for DBAs and system administrators. The complexity arises from the various components that need to work together seamlessly for Kerberos authentication to function properly. In this article, we will explore the intricacies of Kerberos authentication and shed light on why it is essential for secure and efficient database connections.

Why Does Authentication Usually Work Without Configuration?

When it comes to authenticating a login in SQL Server, the authentication process differs depending on whether it is a SQL Server-based login or a Windows-based login. For Windows-based logins, SQL Server delegates the authentication process to the Windows Security Support Provider Interface (SSPI). This means that SQL Server relies on SSPI to validate the login credentials and determine whether the login is successful or not.

SSPI first attempts to authenticate using Kerberos, which is the preferred protocol for Windows 2000 and above. However, for Kerberos authentication to work, a Service Principal Name (SPN) must be in place. If there is no SPN or if Kerberos authentication is not possible due to other reasons, SSPI falls back to the NT LAN Manager (NTLM) security protocol.

By default, NTLM authentication allows a single hop, meaning that it does not support scenarios where multiple “hops” are required, such as connecting to a separate server through SQL Server Reporting Services or establishing a Windows authentication across a linked server connection. In these cases, Kerberos authentication is necessary to enable the desired functionality.

The Limitations of NTLM Authentication

While NTLM authentication is generally secure and effective, it has several drawbacks:

  1. NTLM is susceptible to “replay” attacks, where an attacker captures network traffic and reuses it to gain unauthorized access.
  2. NTLM assumes that the server is trustworthy, without providing a means for the client to verify the server’s identity.
  3. NTLM requires more authentication traffic compared to Kerberos, as it involves frequent checks with a domain controller.
  4. NTLM does not support multiple hops, making it challenging to establish connections that require passing credentials through multiple servers.

Kerberos authentication addresses these limitations by incorporating features such as time-stamped network traffic, server verification through SPNs, efficient ticket-based authentication, and support for delegation to enable multiple hops.

Configuring the Service Principal Name (SPN)

An SPN provides crucial information to the client about the service it is connecting to. It consists of the service type, server name, optional port, and the service account running the service. To enable Kerberos authentication, it is essential to configure the SPN correctly.

Setting up an SPN requires administrative privileges either as a Domain Admin or using the computer System account. Microsoft provides a utility called SETSPN to manage SPNs. The utility offers options to list existing SPNs, add new SPNs, and delete existing SPNs.

To add an SPN, you need to know the service account running SQL Server and the TCP port it is listening on. For default instances, the port is usually 1433, while named instances may have dynamic ports unless a static port is set. It is recommended to specify SPNs for both the NetBIOS name and the fully qualified domain name of the server.

Once the SPNs are set correctly, you can verify the type of authentication used for each connection within SQL Server using a simple query. The query provides information such as session ID, connection time, login time, login name, protocol type, authentication scheme, host name, and program name.

Conclusion

Kerberos authentication plays a vital role in securing and enabling advanced functionality in SQL Server. By understanding the concepts and configuring the necessary components, DBAs and system administrators can ensure secure and efficient database connections. With Kerberos authentication, organizations can mitigate security risks, prevent replay attacks, and facilitate seamless multi-hop connections.

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.