Server Audit، Data Classification و Vulnerability Assessment
یادداشت حقوقی: کاربر حق ترجمه و بازنشر این اثر را برای پروژه تأیید کرده است.PAGE-368Server Audit
SQL Server Audit رویدادهای مشخص Server/Database را در Target ثبت میکند. Audit شیء مقصد و تنظیمات Queue/Failure را تعریف میکند و Audit Specification مجموعه Action Group یا Actionهایی را که باید ثبت شوند مشخص میکند.
گزینههای اصلی Audit| گزینه | معنا |
|---|
| QUEUE_DELAY | حداکثر تأخیر ارسال Event به Target |
| ON_FAILURE | رفتار در صورت عدم امکان نوشتن Audit |
| AUDIT_GUID | شناسه Audit |
| STATE | فعال/غیرفعال بودن |
Table 10-4 — بازنمایی متن فنی جدول منبع--- PDF PAGE 368 ---
353
Security log, then it is important that you consider, and potentially increase, the size of
these logs before you begin using them for your audit. Also, work with your Windows
administration team to decide on how the log will be cycled when full and if you will be
achieving the log by backing it up to tape.
The SQL Server Audit can then be associated with one or more server audit
specifications and database audit specifications. These specifications define the activity
that will be audited at the instance level and the database level, respectively. It is helpful
to have multiple server or database audit specifications if you are auditing many actions,
because you can categorize them to make management easier while still associating
them with the same server audit. Each database within the instance needs its own
database audit specification if you plan to audit activity in multiple databases.
Creating a Server Audit
When you create a server audit, you can use the options detailed in Table 10-4.
Table 10-4. Server Audit Options
Option
Description
FILEPATH
Only applies if you choose a file target. Specifies the file path, where the
audit logs will be generated.
MAXSIZE
Only applies if you choose a file target. Specifies the largest size that the
audit file can grow to. The minimum size you can specify for this is 2MB.
MAX_ROLLOVER_
FILES
Only applies if you choose a file target. When the audit file becomes full, you
can either cycle that file or generate a new file. The MAX_ROLLOVER_FILES
setting controls how many new files can be generated before they begin to
cycle. The default value is UNLIMITED, but specifying a number caps the
number of files to this limit. If you set it to 0, then there will only ever be one
file, and it will cycle every time it becomes full. Any value above 0 indicates
the number of rollover files that will be permitted. So, e.g., if you specify 5,
then there will be a maximum of six files in total.
(continued)
Chapter 10 SQL Server Security Model
--- PDF PAGE 369 ---
354
Table 10-4. (continued)
Option
Description
MAX_FILES
Only applies if you choose a file target. As an alternative to MAX_
ROLLOVER_FILES, the MAX_FILES setting specifies a limit for the number
of audit files that can be generated, but when this number is reached, the
logs will not cycle. Instead, the audit fails and events that cause an audit
action to occur are handled based on the setting for ON_FAILURE.
RESERVE_DISK_
SPACE
Only applies if you choose a file target. Preallocate space on the volume
equal to the value set in MAXSIZE, as opposed to allowing the audit log to
grow as required.
QUEUE_DELAY
Specifies if audit events are written synchronously or asynchronously. If set
to 0, events are written to the log synchronously. Otherwise, specifies the
duration in milliseconds that can elapse before events are forced to write.
The default value is 1000 (1 second), which is also the minimum value.
ON_FAILURE
Specifies what should happen if events that cause an audit action fail to be
audited to the log. Acceptable values are CONTINUE, SHUTDOWN, or FAIL_
OPERATION. When CONTINUE is specified, the operation is allowed to
continue. This can lead to unaudited activity occurring. FAIL_OPERATION
causes auditable events to fail, but allows other actions to continue.
SHUTDOWN forces the instance to stop if auditable events cannot be written
to the log.
AUDIT_GUID
Because server and database audit specifications link to the server
audit through a GUID, there are occasions when an audit specification
can become orphaned. These include when you attach a database to an
instance or when you implement technologies such as database mirroring.
This option allows you to specify a specific GUID for the server audit, as
opposed to having SQL Server generate a new one.
It is also possible to create a filter on the server audit. This can be useful when
your audit specification captures activity against an entire class of object, but you are
only interested in auditing a subset. For example, you may configure a server audit
specification to log any member changes to server roles; however, you are only actually
interested in members of the sysadmin server role being modified. In this scenario, you
can filter on the sysadmin role.
Chapter 10 SQL Server Security Model
|
PAGE-369Target میتواند File، Windows Application Log یا Security Log باشد. نوشتن در Security Log به User Right و Audit Policy مناسب Windows نیاز دارد. ON_FAILURE میتواند CONTINUE، FAIL_OPERATION یا در برخی سناریوها SHUTDOWN باشد؛ انتخاب سختگیرانه باید با Availability سازمان هماهنگ شود.
PAGE-370در SSMS صفحه General مسیر File، Maximum Rollover Files، Maximum File Size و Queue Delay را تنظیم میکند. برای File Target باید ACL مسیر به Service Account SQL Server اجازه Write بدهد.
Figure 10-6 — شکل/تصویر منبع، صفحه PDF 370PAGE-371CREATE SERVER AUDIT [Audit-ProSQLAdmin]
TO FILE (FILEPATH = N'C:\SQLAudit\')
WITH (QUEUE_DELAY = 1000, ON_FAILURE = CONTINUE);
Audit بعد از Create الزاماً فعال نیست و باید STATE = ON شود.
PAGE-372Server Audit Specification
CREATE SERVER AUDIT SPECIFICATION [ServerAuditSpec]
FOR SERVER AUDIT [Audit-ProSQLAdmin]
ADD (AUDIT_CHANGE_GROUP),
ADD (SERVER_ROLE_MEMBER_CHANGE_GROUP);
Action Groupها مجموعه رویدادهای مرتبط را ثبت میکنند؛ انتخاب بیش از حد میتواند Volume Audit را بالا ببرد.
Figure 10-7 — شکل/تصویر منبع، صفحه PDF 372PAGE-373ALTER SERVER AUDIT [Audit-ProSQLAdmin] WITH (STATE = ON);
ALTER SERVER AUDIT SPECIFICATION [ServerAuditSpec] WITH (STATE = ON);
پس از فعالسازی، عملیات آزمایشی مانند تغییر Role یا Audit Config اجرا و نتیجه در Log Viewer/Functionهای Audit بررسی میشود.
PAGE-374Database Audit Specification
برای Actionهای Database مانند SELECT/INSERT روی Object یا تغییر Role، Database Audit Specification به Server Audit موجود متصل میشود. Specification در همان Database ساخته میشود و میتواند Action Groupهای Database یا Action دقیق روی Object/Principal را ثبت کند.
Figure 10-8 — شکل/تصویر منبع، صفحه PDF 374PAGE-375کتاب Database جدا برای Audit میسازد و Server Audit File Target را آماده میکند تا رویدادهای Database در فایل ثبت شوند. جدا بودن Specification از Audit اجازه میدهد چند Database از Target مشترک بهره ببرند.
PAGE-376Dialog مربوط به Database Audit Specification امکان افزودن Audit Action Type، Object Class، Object Name و Principal را فراهم میکند. دامنه محدودتر Audit هم Noise و هم Storage را کاهش میدهد.
Figure 10-9 — شکل/تصویر منبع، صفحه PDF 376PAGE-377CREATE DATABASE AUDIT SPECIFICATION [DbAuditSpec]
FOR SERVER AUDIT [Audit-ProSQLAdmin]
ADD (SELECT ON OBJECT::dbo.SensitiveData BY public);
ALTER DATABASE AUDIT SPECIFICATION [DbAuditSpec] WITH (STATE = ON);
فهرست کامل Action Classها از Catalog/System Viewهای Audit قابل مشاهده است.
PAGE-378آزمون با EXECUTE AS
EXECUTE AS اجازه میدهد DBA بدون ورود جداگانه Context یک User/Login را شبیهسازی کند و سپس REVERT انجام دهد. این روش برای تست Permission و Audit بسیار مفید است.
EXECUTE AS USER = 'SomeUser';
SELECT * FROM dbo.SensitiveData;
REVERT;
PAGE-379برای ممیزی خود Audit نیز میتوان AUDIT_CHANGE_GROUP را ثبت کرد؛ در این صورت تغییر تنظیمات Audit بهعنوان رویداد Audit ثبت میشود و Tampering قابل تشخیصتر است.
PAGE-380Security Reports و Data Classification
SQL Server ابزارهای گزارش امنیتی و Data Discovery/Classification دارد. Classification به DBA کمک میکند Columnهای حساس مانند نام، آدرس، شماره کارت یا داده شخصی را Label کند و سپس گزارش استفاده/دسترسی را هدفمندتر بررسی کند. مثالها از WideWorldImporters استفاده میکنند.
Figure 10-10 — بازنمایی از صفحه اصلی PDF 380PAGE-381Classification Recommendationها Columnهایی را که احتمالاً Sensitive هستند پیشنهاد میکنند. DBA باید Recommendation را بررسی و Label/Information Type مناسب را تأیید کند؛ ابزار نمیتواند Context حقوقی و Business را بهطور کامل جایگزین کند.
Figure 10-11 — شکل/تصویر منبع، صفحه PDF 381PAGE-382Vulnerability Assessment
Vulnerability Assessment پیکربندی Database را در برابر مجموعه Ruleها بررسی و Findingهایی مانند Permission گسترده، Configuration ضعیف یا Feature پرریسک را گزارش میکند. هر Finding Severity، Explanation و Remediation دارد.
Figure 10-12 — شکل/تصویر منبع، صفحه PDF 382PAGE-383نتایج VA را باید بهعنوان ورودی فرایند Risk Management دید. برخی Ruleها ممکن است با نیاز Business استثنا داشته باشند؛ Baseline امکان میدهد Finding پذیرفتهشده ثبت شود تا تغییرات واقعی بعدی برجسته شوند.
Figure 10-13 — شکل/تصویر منبع، صفحه PDF 383Figure 10-12 — شکل/تصویر منبع، صفحه PDF 383PAGE-384جمعبندی
امنیت SQL Server از Authentication و Principal شروع و تا Server/Database/Object Permission ادامه پیدا میکند. Audit برای Accountability، Classification برای شناخت داده حساس و Vulnerability Assessment برای یافتن ضعفهای Configuration مکمل Least Privilege هستند. هیچکدام جای Patch، Backup، Network Security و Operational Control را نمیگیرند.