sqlserver关闭c2审核模式

sqlserver关闭c2审核模式

𝓓𝓸𝓷 Lv6

一、c2 audit mode简介

https://learn.microsoft.com/zh-cn/sql/database-engine/configure-windows/c2-audit-mode-server-configuration-option?view=sql-server-ver16&redirectedfrom=MSDN
https://learn.microsoft.com/zh-cn/sql/database-engine/configure-windows/common-criteria-compliance-enabled-server-configuration-option?view=sql-server-ver16

  • 可以通过 SQL Server Management Studio 或使用 sp_configure 中的“c2 审核模式”选项来配置 C2 审核模式。 选择此选项将配置服务器,以记录对语句和对象的失败和成功的访问尝试。 这些信息可以帮助您了解系统活动并跟踪可能的安全策略冲突。

  • C2 审核模式数据保存在实例的默认数据目录中的某个文件内,文件名默认以audittrace+日期时间.trc格式组成, 如果审核日志文件达到了 200 MB 的大小限制,SQL Server 将创建新文件、关闭旧文件并将所有新的审核记录写入新文件。 此过程将继续下去,直到审核数据目录已满或审核被关闭。 若要确定 C2 跟踪的状态,请查询 sys.traces 目录视图。

  • C2 审核模式将大量事件信息保存在日志文件中,可能会导致日志文件迅速增大。 如果保存日志的数据目录空间不足,SQL Server 将自行关闭。 如果将审核设置为自动启动,则必须使用 -f 标志(跳过审核)重新启动该实例或为审核日志释放更多磁盘空间。

  • C2审计是SQL Server的一种安全审计机制,能够监控和记录用户的操作。这种审计方式遵循了C2安全标准,主要用于高安全性需求的系统中。在默认情况下,C2审计会记录所有的数据访问和数据修改操作,包括INSERT、UPDATE和DELETE等。

二、查看审核模式

1
2
3
4
5
6
7
8
9
10
11
12
select * from sys.configurations where name='show advanced options';
select * from sys.configurations where name like '%audit%';

value: 值为1表示已启用, 0表示未启用

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
go
EXEC sp_configure 'C2 audit mode';
go

config_vlaue: 为值1表示已启用, 0表示未启用

三、启用C2 审核模式

1
2
3
4
5
6
7
8
9
sp_configure 'show advanced options', 1 ;  
GO
RECONFIGURE ;
GO

sp_configure 'c2 audit mode', 1 ;
GO
RECONFIGURE ;
GO

四、关闭C2 审核模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
sp_configure 'show advanced options', 1 ;  
GO
RECONFIGURE ;
GO

sp_configure 'c2 audit mode', 0 ;
GO
RECONFIGURE ;
GO

sp_configure 'show advanced options', 0 ;
GO
RECONFIGURE ;
GO

五、重启数据库

关闭C2 审核模式需要重启数据库才能生效

六、查看活动跟踪

1
SELECT * FROM sys.traces;

七、彩旦

在 SQL Server的未来版本中将删除此功能。 请避免在新的开发工作中使用该功能,并着手修改当前还在使用该功能的应用程序。 C2 安全标准已经由通用准则认证所取代。 请参阅 启用了通用准则合规性的服务器配置选项

1.查看通用标准合规性配置
1
select * from sys.configurations where name like '%common%';
2.启用通用标准合规性配置
1
2
3
4
5
6
7
8
9
10
11
12
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'common criteria compliance enabled', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
sp_configure 'show advanced options', 0 ;
GO
RECONFIGURE ;
GO
3.重启数据库

启用通用标准合规性配置,需要重启数据库

  • Title: sqlserver关闭c2审核模式
  • Author: 𝓓𝓸𝓷
  • Created at : 2025-02-23 12:30:26
  • Updated at : 2025-02-25 13:55:32
  • Link: https://www.zhangdong.me/sqlserver-c2-audit-mode.html
  • License: This work is licensed under CC BY-NC-SA 4.0.
评论