Chapter 1 Securing Your Server and Network(1):选择SQL Server运行账号

本文介绍了如何选择和配置SQLServer服务运行所需的Windows账号,包括LocalSystem、NetworkService等内置账号,以及如何创建和使用实际Windows账号来提高安全性。
原文出处:http://blog.csdn.net/dba_huangzj/article/details/37924127  ,专题目录:http://blog.csdn.net/dba_huangzj/article/details/37906349

未经作者同意,任何人不得以“原创”形式发布,也不得已用于商业用途,本人不负责任何法律责任。

 

前言:

 

SQL Server是一个Windows 服务,以某个Windows用户或系统用户权限运行在Windows操作系统上。选择合适的帐号运行SQL Server是非常重要的,本系列文章只关注安全性方面。

选择合适的帐号之所以非常重要,其中一个原因是如果权限不恰当,用户(客户端)可以通过SQL Server对Windows OS或其他资源进行非预期使用。

 

实现:

 

首次选择帐号发生在安装过程中,但是在安装过后可以更改,如何安装SQL Server超出本文范围,所以这里跳过安装过程中选择帐号部分。在安装完毕之后,可以根据下面步骤实现。

 

实现步骤:

 

1. 在命令行输入:services.msc 打开服务管理器。找到SQL Server服务,如图:

image2. 右键这个服务,选择【属性】,并查看当前运行帐号 :

 

image

 

image

 

3. 打开SQL Server 配置管理器,找到SQL Server对应实例名的选项,本人机上有两个实例,一个是2008R2,一个是2012,2012为命名实例,所以选择SQL Server(SQL2012)这个服务,并右键选择【属性】,如图:

 

image

 

4. 打开【属性】页之后,选择【登录】页,如图:

 

image

5. 选择【内置帐户】,下拉框中有三种可选项,后续部分将介绍这些帐号:

 

image

6. 当修改了帐号之后,点击【确定】按钮,会提示需要重启SQL Server服务,点击【是】,然后重启服务,由于修改运行帐号必须重启服务,所以如果在正式环境下,需要谨慎,并且计划性地修改。

 

image

7. 至此,我们演示了如何修改SQL Server的运行帐号。接下来将介绍一些原理及注意事项。

 

原理:

 

SQL Server服务继承了底层操作系统(即Windows OS)上Windows帐号的权限。它并不一定需要有所在机器上的管理员权限。只需要有对数据文件/事务日志文件、错误日志文件、备份文件所在目录的权限和少量系统权限即可。

如果在安装SQL Server之后修改服务帐号,强烈建议使用SQL Server配置管理器实现,而不要用Windows 服务控制管理器,因为后者并不能很好地进行权限管控。

在Windows Server 2008 R2中,在安装SQL Server过程中默认使用虚拟帐号(Virtual Account,将在后续文章介绍)作为启动帐号。如果在步骤5中选择了【内置帐号】,不需要提供密码,这些密码由操作系统管理和预设。下面简要介绍一下步骤5中的两类帐号:

  • Local System:这是一个拥有所在计算机上管理员权限的Windows 系统帐号,在网络中显示为(<Domain>\<Machine>)形式,如果机器存在于域环境中,可以对这类帐号授予访问网络资源的权限。
  • Network Service:这个帐号相对于Local System而言,有很多本机权限限制,但是可以和Local System一样访问网络资源。

你可以选择一个已经创建的Windows或域帐号,以全名形式((<Domain>\<Account>)作为运行帐号,但是要确保这个帐号没有受到WIndows上的“密码过期策略”影响,否者可能在系统运行了一段时间之后由于密码过期而导致整个SQL Server服务停止。

作为实践,建议使用实际Windows 帐号替代内置帐号,因为内置帐号被多种服务所共享,权限管控不如实际WIndows 帐号。比如攻击者可以使用管理员权限登录SQL Server,并用xp_cmdshell等外部存储过程进行操作系统级别的攻击。使用实际Windows帐号能减少这种情况的发生机会。

 

更多信息:

 

要允许一个Windows帐号能用于运行一个服务(不是所有帐号都能运行服务),需要授予【Log on as a service right】(中文为【信任计算机和用户帐户可以执行委派】)权限,步骤如下:

 

1. 在本机上,打开管理工具,并选择【Local Security Policy】,中文为【本地安全策略】,Win8 系统可以控制面板→【系统和安全】中找到【Log on as a service right】(中文为【信任计算机和用户帐户可以执行委派】):

image

2.添加所需帐号,如图:

image

如果使用WIndows Server Core版本,由于没有GUI可以修改,也有可能你不能直接登录目标服务器用GUI操作(非core版本)时,可以在另外一些机器上实现配置:

 

步骤:

 

1. 打开计算机管理器(compmgmt.msc)右键根目录,选择【连接到另一台计算机】,输入服务器地址,如图:

 

image

 

image

 

成功连接之后会变成下图,注意【计算机管理(本地)】 已经变成了【计算机管理(SQL-A)】:

 

image

 

2.在【服务和应用程序】节点可以找到SQL Server配置管理器,然后就可以进行前面所说的配置了。

 

image

 

创建域用户作为服务帐号:

 

如果在域环境下,可以在活动目录服务器(Active Directory Server)上通过【Active Directory 管理中心】(Active Directory Administrative Center)上的【Active Directory 用户和计算机】(Active Directory Users and Computers )工具添加用户到域环境的机器上。如图:

 

image

在创建时,用户选项只勾选下图即可,除非特殊需要,否则不建议勾选【用户下次登录须更改密码】:

 

image

如果希望用于服务帐号的密码超时,建议使用Windows Server 2008出现的【托管服务帐号】(managed service accounts),这部分在后续文章介绍。

 

扩展阅读:

 

配置 Windows 服务帐户和权限(http://msdn.microsoft.com/zh-cn/library/ms143504.aspx


Protect your data from attack by using SQL Server technologies to implement a defense-in-depth strategy, performing threat analysis, and encrypting sensitive data as a last line of defense against compromise. The multi-layered approach in this book helps ensure that a single breach doesn’t lead to loss or compromise of your data that is confidential and important to the business. Database professionals in today’s world deal increasingly often with repeated data attacks against high-profile organizations and sensitive data. It is more important than ever to keep your company’s data secure. Securing SQL Server demonstrates how administrators and developers can both play their part in the protection of a SQL Server environment. This book provides a comprehensive technical guide to the security model, and to encryption within SQL Server, including coverage of the latest security technologies such as Always Encrypted, Dynamic Data Masking, and Row Level Security. Most importantly, the book gives practical advice and engaging examples on how to defend your data — and ultimately your job! — against attack and compromise. Covers the latest security technologies, including Always Encrypted, Dynamic Data Masking, and Row Level Security Promotes security best-practice and strategies for defense-in-depth of business-critical database assets Gives advice on performing threat analysis and reducing the attack surface that your database presents to the outside world What You Will Learn Perform threat analysis Implement access level control and data encryption Avoid non-reputability by implementing comprehensive auditing Use security metadata to ensure your security policies are enforced Apply the latest SQL Server technologies to increase data security Mitigate the risk of credentials being stolen
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值