tags:

views:

152

answers:

3

I have a requirement from a customer that only DNS aliases may be used in application connection strings when connecting to SQL Server. Is there any way to enforce this from the server side? The point of doing this is to prevent hardcoding of IP addresses in applications, which may change with time.

+1  A: 

There is no way to enforce this from the server side.

IP addresses (or server names) should not be hard coded into applications. They should reside in a config file (encrypted if necessary).

Mitch Wheat
+2  A: 

Rather than enforce this (as it appears you may not be able to easily), how about auditing it instead.

You should be able to build a little application that will monitor a trace of successful logins. The application could then alert the sys admin / developers etc when a login happens that uses something other than a DNS alias.

This resources may help in terms of tracing this :

http://blogs.msdn.com/sqlprogrammability/archive/2006/08/16/703079.aspx

Cheers

Jayden
A: 

When you say 'alias' do you mean 'not an IP address' or 'CNAME record and not A record'? If you mean the latter it's possible you could do a forward DNS lookup, then a reverse lookup on the IP address returned. If the name returned is the same as that from the original lookup it's most likely not an alias. That should solve the requirement, but it doesn't really solve the fact that it is something of a weird requirement :)