SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Security Best Practices - Dealing With User Name Changes


SQL Security Best Practices - Dealing With User Name Changes

Author
Message
ScottPletcher
ScottPletcher
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19962 Visits: 7417
opc.three (1/14/2013)
YSLGuru (1/14/2013)
opc.three (1/12/2013)
AD Groups as SQL Logins and Database Users work great unless you need the User to have a default schema. In SQL 2012 the loop has been closed, but this is a 2008 forum.

@YSLGuru, I would look to rename them so they match the person's new name. Last name changes are pretty common and I rename Database Users and Server Logins all the time to keep up. Are you storing the Database User name in any audit tables? If the Database User name is used to maintain an audit trail then you may have a bit more to consider.


The schema that the app assumes for everything is 'dbo'.

If by 'assume' you meant that the app does not schema-qualify all object references and instead relies heavily on the default schema setup for each Database User then moving to AD Groups will not work for you until you move to SQL 2012.



I don't think that's true. While you cannot assign a default schema to the login, you can to the user. You just have to set it to "dbo" for each db for that group instead of at the login level.

SQL DBA,SQL Server MVP(07, 08, 09) Prosecutor James Blackburn, in closing argument in the Fatal Vision murders trial:
If in the future, you should cry a tear, cry one for them [the murder victims]. If in the future, you should say a prayer, say one for them. And if in the future, you should light a candle, light one for them.
Orlando Colamatteo
Orlando Colamatteo
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40526 Visits: 14413
ScottPletcher (1/14/2013)
opc.three (1/14/2013)
YSLGuru (1/14/2013)
opc.three (1/12/2013)
AD Groups as SQL Logins and Database Users work great unless you need the User to have a default schema. In SQL 2012 the loop has been closed, but this is a 2008 forum.

@YSLGuru, I would look to rename them so they match the person's new name. Last name changes are pretty common and I rename Database Users and Server Logins all the time to keep up. Are you storing the Database User name in any audit tables? If the Database User name is used to maintain an audit trail then you may have a bit more to consider.


The schema that the app assumes for everything is 'dbo'.

If by 'assume' you meant that the app does not schema-qualify all object references and instead relies heavily on the default schema setup for each Database User then moving to AD Groups will not work for you until you move to SQL 2012.



I don't think that's true. While you cannot assign a default schema to the login, you can to the user. You just have to set it to "dbo" for each db for that group instead of at the login level.

From 2008 R2 BOL:

DEFAULT_SCHEMA cannot be specified when you are creating a user mapped to a Windows group, a certificate, or an asymmetric key.


Try it out though. You get an error when trying to set a default schema for a Database User based on a Login created from a Windows Group on 2008 R2 or below.

USE test
CREATE USER [DOMAIN\MyGroup] FROM LOGIN [DOMAIN\MyGroup] WITH DEFAULT_SCHEMA = [dbo];



Msg 15259, Level 16, State 1, Line 2
The DEFAULT_SCHEMA clause cannot be used with a Windows group or with principals mapped to certificates or asymmetric keys.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search