Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Implementing RBAC Expand / Collapse
Author
Message
Posted Friday, March 22, 2013 9:57 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, December 5, 2014 8:02 PM
Points: 422, Visits: 2,662
All,

We are implementing RBAC(Role Based Access Control)....and I have to create number of customized DB roles with permission in all the instances/databases. Anyone have suggestions/script to accomplish this? Please advise.

Thanks,
SueTons.


Regards,
SQLisAwe5oMe.
Post #1434351
Posted Friday, March 22, 2013 10:06 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 5:38 PM
Points: 31,368, Visits: 15,834
SQL Server roles won't help here. Row based access means you're using joins to help accomplish this.

A couple links that might help:
http://technet.microsoft.com/en-us/library/cc966395.aspx
http://stackoverflow.com/questions/1122513/how-to-implement-database-access-control-on-row-basis







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1434361
Posted Friday, March 22, 2013 10:10 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, December 5, 2014 8:02 PM
Points: 422, Visits: 2,662
Steve Jones - SSC Editor (3/22/2013)
SQL Server roles won't help here. Row based access means you're using joins to help accomplish this.

A couple links that might help:
http://technet.microsoft.com/en-us/library/cc966395.aspx
http://stackoverflow.com/questions/1122513/how-to-implement-database-access-control-on-row-basis


I think you misunderstood my question, since you mentioned row based and I said role based? Are we talking about the same here?

SueTons.



Regards,
SQLisAwe5oMe.
Post #1434370
Posted Friday, March 22, 2013 10:42 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 5:38 PM
Points: 31,368, Visits: 15,834
You are right, I did. I was thinking row and misread that. I've seen RBAC mostly as row based, not role.

In terms of roles, there isn't a script to do this because the roles will have disparate requirements. Ultimately you need to map roles to specific tables and rights. Build a grid of the roles (admin, manager, developer, reporting user, data entry, etc), the tables, and rights( select, insert, update, delete).

You can do this a few ways, but essentially drop two of these on the axis and the third in the middle.

Once you've determined who gets what rights, it's easy. Create the roles. Add the rights to the roles for the objects, move people into roles.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1434391
Posted Friday, March 22, 2013 11:07 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, December 5, 2014 8:02 PM
Points: 422, Visits: 2,662
Steve Jones - SSC Editor (3/22/2013)
You are right, I did. I was thinking row and misread that. I've seen RBAC mostly as row based, not role.

In terms of roles, there isn't a script to do this because the roles will have disparate requirements. Ultimately you need to map roles to specific tables and rights. Build a grid of the roles (admin, manager, developer, reporting user, data entry, etc), the tables, and rights( select, insert, update, delete).

You can do this a few ways, but essentially drop two of these on the axis and the third in the middle.

Once you've determined who gets what rights, it's easy. Create the roles. Add the rights to the roles for the objects, move people into roles.


Maybe I am still not clear with my requirement, I think there has to be a way that I can do this using script....because we have hundreds of insances and maybe 1000 or more databases, and I need to create these roles in every database.

Basically, we are looking to create some customized roles that will replace the SQL standard roles, for example db_datareader, etc......

So, you are saying this won't be doable?

SueTons.



Regards,
SQLisAwe5oMe.
Post #1434412
Posted Friday, March 22, 2013 11:19 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 7:23 PM
Points: 20,860, Visits: 32,883
SQLCrazyCertified (3/22/2013)
Steve Jones - SSC Editor (3/22/2013)
You are right, I did. I was thinking row and misread that. I've seen RBAC mostly as row based, not role.

In terms of roles, there isn't a script to do this because the roles will have disparate requirements. Ultimately you need to map roles to specific tables and rights. Build a grid of the roles (admin, manager, developer, reporting user, data entry, etc), the tables, and rights( select, insert, update, delete).

You can do this a few ways, but essentially drop two of these on the axis and the third in the middle.

Once you've determined who gets what rights, it's easy. Create the roles. Add the rights to the roles for the objects, move people into roles.


Maybe I am still not clear with my requirement, I think there has to be a way that I can do this using script....because we have hundreds of insances and maybe 1000 or more databases, and I need to create these roles in every database.

Basically, we are looking to create some customized roles that will replace the SQL standard roles, for example db_datareader, etc......

So, you are saying this won't be doable?

SueTons.



What you want to do is doable, you just have to write the scripts. There is no magic script that is going to create the roles you need with the proper permissions for each role on each of the objects in each of the databases on hundreds of instances on an unknown number of servers. This is something you will need to determine. It will take time and effort to implement.




Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1434424
Posted Friday, March 22, 2013 12:10 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, December 5, 2014 8:02 PM
Points: 422, Visits: 2,662
I know this is doable by using sp_msforeachdb and a loop, but not really sure where to begin with.

SueTons.


Regards,
SQLisAwe5oMe.
Post #1434453
Posted Friday, March 22, 2013 1:05 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 7:23 PM
Points: 20,860, Visits: 32,883
The way I would start, is do the first one manually creating the scripts as I went along using SSMS. Then it is just a matter of automating those scripts.

But you still need to start where Steve said before you even start appling these changes.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1434488
Posted Friday, March 22, 2013 1:34 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, December 5, 2014 8:02 PM
Points: 422, Visits: 2,662
Lynn Pettis (3/22/2013)
The way I would start, is do the first one manually creating the scripts as I went along using SSMS. Then it is just a matter of automating those scripts.

But you still need to start where Steve said before you even start appling these changes.


Ok, Thank you, I will look into it.

SueTons.


Regards,
SQLisAwe5oMe.
Post #1434501
Posted Friday, March 22, 2013 6:17 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 5:38 PM
Points: 31,368, Visits: 15,834
Are you saying you want a read only and a read/write role? Separate from db_Datereader/writer?

That's easy to script.
loop through all tables in all databases, grant rights to a standard named role (MyReadRole).
Add users to the role.

However if you want something that's not a pattern, you have to do it manually.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1434555
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse