-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide option/always to canonicalise hostname even when fully qualified when building SPN for Kerberos #1296
Comments
Hi @quom, thanks for contacting us. I have a vague idea of what you're trying to describe, but I'm not clear on how the driver should behave in this scenario. Could you provide a sample scenario (with your CNAME/SPN/etc) that describes the situation above, and the expected/actual behavior of the driver currently? Thanks. |
Hi @peterbae, here's an example of how the driver behaves which I don't think is intended: In this scenario the driver resolved the CNAME to the A record to the IP and does a rDNS to find the host name and constructs the SPN from that - successfully matching the registered SPN. Now, changing This becomes an issue where the default search domain is not If we could agree on expected behaviour then I am happy to create a PR for it. I believe the expected behaviour is that the driver should make efforts (in all cases) to resolve the serverName and do a rDNS on it before constructing the SPN. If this fails then it can use the domain as is. |
Hi @quom, thank you very much for a detailed explanation. I think you should be able to use |
Hi @peterbae, |
Thanks for the explanation @quom. I'm not exactly sure if this would be a breaking change for some of the existing users, but if you could provide a PR for this, the team will test it internally to see if we can include this in the next preview. We appreciate your contribution. |
If memory serves, the SQLOLEDB provider and {SQL Server} driver (SQL 2000 time-frame) do the reverse lookup every time. However, that was changed for SQL 2005 (Provider=SQLNCLI) as a security risk due to DNS spoofing. The newer drivers concatenate the default DNS suffix to a NETBIOS name or use a fully-qualified name as-is. It is up to the app developer to get the server name correct, or if set in a config file of some sort, then it can be set by the machine admin. I suspect the JDBC behavior may follow similar reasoning. |
Client Operating System
Linux
Problem description
An SPN is registered on the hostname of the sql server machine under the service user of the machine but not for the CNAME which corresponds to the alias (I've been told this is because its more troublesome to migrate the database to another server transparently).
Consequences of this behaviour:
When an unqualified CNAME is used as the serverName it must be canonicalised to construct the SPN (to find the correct realm). When the CNAME is provided fully qualified there is no attempt to resolve and therefore the SPN constructed is not valid. This is not so much an issue when everything is running under a single domain as the domain can be ommitted from the serverName and the DNS resolution for the connection still works correctly. When the application is running in a different domain then the CNAME cannot be resolved without being qualified with the correct domain and in this case the SPN is not constructed correctly.
I cannot see that this is expected behaviour of the SPN construction and can see two possible fixes:
Is either of these options palatable or is it the recommended setup to have SPNs created for the alias serverNames too?
The text was updated successfully, but these errors were encountered: