Implementing Auditing in SQL Server SQLSAT74
Implementing Auditing in SQL Server SQLSAT74
David Dye
SQL Server
Implementing Auditing in SQL Server
Introduction
What is Auditing
Overview of auditing options
Introduction to SQL Audit
SQL Audit Objects
Implementing SQL Audit
Audit
Introduction
David Dye
[email protected]
HTTP://SQLSAFETY.BLOGSPOT.COM
What is auditing
Tracking and logging of events
◦ Security events
◦ DDL events
◦ DML events
◦ Data access events
Often required by oversight or governance
◦ HIPPA
◦ SOX
◦ PCI
Overview of auditing options
C2 Auditing
Common Criteria Compliance
SQL Trace
DDL/DML Triggers
SQL Audit
C2 Auditing
Introduced in SQL 2000
Meets Department of Defense C2 security
requirements
Configured at the server level
Audit logs are stored in the SQL folder
structure
Audit logs viewed through SQL Profiler or
fn_trace_gettable function
C2 Auditing Cons
ALL events are defined and non-configurable
Instance wide auditing
Logs can ONLY be stored in default instance
data directory
Rollover file size is non-configurable
Inability to write to log file results in SQL shut
down
Enabling C2 Auditing
Common Criteria Compliance
Introduced in SQL 2005
◦ SQL 05 SP1 Evaluation Assurance Level 1 (EAL1)
◦ SQL 05 SP2/SQL 08 EAL4++
Does not include all C2 audit mode
functionality
Includes
functionality
Can degrade performance
EAL4++ requires running additional scripts
Enabling Common Criteria
Compliance
SQL Trace
Traces can be scripted or created through
profiler
Traces are highly configurable and can be
selective
Results saved to file or table
Templates can be utilized
SQL Trace Cons
Can degrade performance
Trace scope can not be efficiently limited to
◦ Can be expensive!
◦ Trigger fails-Transaction FAILS
◦ Can’t capture all events
DDL Trigger Demo
Introduction to SQL Audit
What is SQL Audit
SQL Audit Background
What is SQL Audit
editions
SQL Audit Background
Uses extended events
Created through T-SQL, PowerShell or SSMS
Audits can have the following scopes:
◦ Server level
Include server operations, Logon, Logoff, etc.
◦ Database level
Database action, DML, or DDL
◦ Audit level
Alter, Create, Drop, etc. audits
Audits can be synchronous or asynchronous and logged
to
◦ File
◦ Windows application log
◦ Windows security log
Full management, configuration, and administration
available through .NET using SMO
SQL Audit Objects
Server Audit
Server Level Audit Groups
Database Level Audit Groups