db_ddladmin和db_owner
从我所测试和阅读的内容中可以看出,除了db_ddladmin
DOES允许,您的清单在大多数情况下看起来都是准确的CREATE SCHEMA
。我确实确认确实拒绝了您列出的其他安全权限。
仅拒绝DDLADMIN:
[ALTER ANY USER]
[BACKUP DATABASE]
,[BACKUP LOG]
,[CHECKPOINT]
[ALTER ANY APPLICATION ROLE]
, [ALTER ANY ROLE]
[DROP DATABASE]
注意到了。。。
db_datareader
将允许SELECT
访问所有表
db_datarwriter
将允许INSERT
,UPDATE
和DELETE
访问所有表
db_executor
将允许EXECUTE
访问所有可执行对象
另外,拥有db_ddladmin角色权限可能意味着。。。
注意: 由于您在2005年至2014年之间有许多不同版本的SQL Server,因此最好是由一小组用户对其进行初步测试,以查看谁尖叫来消除类似问题,等等。
此外,没有DBO角色权限可能意味着。。。
注意: 由于您在2005年至2014年之间有许多不同版本的SQL Server,因此最好是由一小组用户对其进行初步测试,以查看谁尖叫来消除类似问题,等等。
其他注意事项
由于您声明正在逐案审查
当前受限制的权限之一是db_owner权限。
该权限将根据具体情况进行审查,但是一个常见的更改是将db_owner权限替换为以下内容:
- db_datareader
- db_datawriter
- db_ddladmin
- db_executor
您是否考虑过为每个人需要的更多“全对象”数据库级访问创建其他自定义角色,而不是授予他们该db_ddladmin
角色,因为这样做可能会给他们带来比实际需要的更多的数据库级对象。
我通常会给出确切需要的内容,而他们所做的工作仅此而已,并且如果需要“正常”或“标准”的数据库级别对象访问数据库中的所有对象,我会创建一个类似于db_executor
但请参阅下面的示例。这样,如果您没有在数据库中获得明确的对象级别以确保他们的安全性,就可以向人们授予特定数据库中所有DB对象真正需要的东西。
----Custom Database Roles
/* CREATE A NEW ROLE -- Execute to all stored procs including newly created ones*/
-- Database specific
CREATE ROLE db_All_StoredProc_Execute
GRANT EXECUTE TO db_All_StoredProc_Execute
/* CREATE A NEW ROLE -- Alter to all stored procs including newly created ones*/
-- Database specific
CREATE ROLE db_All_StoredProc_Alter
GRANT ALTER ANY SCHEMA TO db_All_StoredProc_Alter
/* CREATE A NEW ROLE -- View Definition to all stored procs including newly created ones*/
-- Database specific
CREATE ROLE db_All_StoredProc_View
GRANT VIEW DEFINITION TO db_All_StoredProc_View
/* CREATE A NEW ROLE - Any schema alter and create procedure permissions */
-- Database specific
CREATE ROLE db_All_CreateProc_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateProc_AlterSchema
GRANT CREATE PROCEDURE TO db_All_CreateProc_AlterSchema
GO
/* CREATE A NEW ROLE - Any schema alter and create table permissions */
-- Database specific
CREATE ROLE db_All_CreateTable_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateTable_AlterSchema
GRANT CREATE TABLE TO db_All_CreateTable_AlterSchema
/* CREATE A NEW ROLE - Any schema alter and create function permissions */
-- Database specific
CREATE ROLE db_All_CreateFunction_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateFunction_AlterSchema
GRANT CREATE FUNCTION TO db_All_CreateFunction_AlterSchema
/* CREATE A NEW ROLE - Any schema alter and create aggregate permissions */
-- Database specific
CREATE ROLE db_All_CreateAggregate_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateAggregate_AlterSchema
GRANT CREATE AGGREGATE TO db_All_CreateAggregate_AlterSchema
/* CREATE A NEW ROLE - Any schema alter and create view permissions */
-- Database specific
CREATE ROLE db_All_CreateView_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateView_AlterSchema
GRANT CREATE VIEW TO db_All_CreateView_AlterSchema
/* CREATE A NEW ROLE - Any schema alter and create schema permissions */
-- Database specific
CREATE ROLE db_All_CreateSchema_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateSchema_AlterSchema
GRANT CREATE SCHEMA TO db_All_CreateSchema_AlterSchema
我还想共享一个db_DDLAdmin_Restriction角色,您可能要考虑考虑使用其他方式创建显式对象,DENY
以限制db_ddladmin
授予访问权限的对象,因此您至少可以在授予该角色并DENY
为实际对象类型设置显式对象的DB上创建它,等等。您不希望他们访问。
例如,如果你知道他们一定会创建存储过程和函数,可以排除DENY CREATE FUNCTION
,DENY CREATE PROCEDURE
,DENY ALTER ANY SCHEMA
。
---Create ddladmin restriction custom DB role
DENY ALTER ANY ASSEMBLY TO db_DDLAdmin_Restriction
DENY ALTER ANY ASYMMETRIC KEY TO db_DDLAdmin_Restriction
DENY ALTER ANY CERTIFICATE TO db_DDLAdmin_Restriction
DENY ALTER ANY CONTRACT TO db_DDLAdmin_Restriction
DENY ALTER ANY DATABASE DDL TRIGGER TO db_DDLAdmin_Restriction
DENY ALTER ANY DATABASE EVENT NOTIFICATION TO db_DDLAdmin_Restriction
DENY ALTER ANY DATASPACE TO db_DDLAdmin_Restriction
DENY ALTER ANY FULLTEXT CATALOG TO db_DDLAdmin_Restriction
DENY ALTER ANY MESSAGE TYPE TO db_DDLAdmin_Restriction
DENY ALTER ANY REMOTE SERVICE BINDING TO db_DDLAdmin_Restriction
DENY ALTER ANY ROUTE TO db_DDLAdmin_Restriction
DENY ALTER ANY SCHEMA TO db_DDLAdmin_Restriction
DENY ALTER ANY SERVICE TO db_DDLAdmin_Restriction
DENY ALTER ANY SYMMETRIC KEY TO db_DDLAdmin_Restriction
DENY CHECKPOINT TO db_DDLAdmin_Restriction
DENY CREATE AGGREGATE TO db_DDLAdmin_Restriction
DENY CREATE DEFAULT TO db_DDLAdmin_Restriction
DENY CREATE FUNCTION TO db_DDLAdmin_Restriction
DENY CREATE PROCEDURE TO db_DDLAdmin_Restriction
DENY CREATE QUEUE TO db_DDLAdmin_Restriction
DENY CREATE RULE TO db_DDLAdmin_Restriction
DENY CREATE SYNONYM TO db_DDLAdmin_Restriction
DENY CREATE TABLE TO db_DDLAdmin_Restriction
DENY CREATE TYPE TO db_DDLAdmin_Restriction
DENY CREATE VIEW TO db_DDLAdmin_Restriction
DENY CREATE XML SCHEMA COLLECTION TO db_DDLAdmin_Restriction
DENY REFERENCES TO db_DDLAdmin_Restriction
GO