StigData/Processed/SqlServer-2016-Instance-1.3.xml

<DISASTIG id="MS_SQL_Server_2016_Instance_STIG" version="1.3" created="1/2/2019">
  <DocumentRule dscresourcemodule="None">
    <Rule id="V-79119" severity="medium" conversionstatus="pass" title="SRG-APP-000001-DB-000031" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine whether any limits have been defined. If it does not, assume a limit of 10 for database administrators and 2 for all other users.
 
If a mechanism other than a logon trigger is used, verify its correct operation by the appropriate means. If it does not work correctly, this is a finding.
 
Otherwise, determine if a logon trigger exists:
 
In SQL Server Management Studio's Object Explorer tree:
Expand [SQL Server Instance] &gt;&gt; Security &gt;&gt; Server Objects &gt;&gt; Triggers
 
OR
 
Run the query:
SELECT name FROM master.sys.server_triggers;
 
If no triggers are listed, this is a finding.
 
If triggers are listed, identify the one(s) limiting the number of concurrent sessions per user. If none are found, this is a finding. If they are present but disabled, this is a finding.
 
Examine the trigger source code for logical correctness and for compliance with the documented limit(s). If errors or variances exist, this is a finding.
 
Verify that the system does execute the trigger(s) each time a user session is established. If it does not operate correctly for all types of user, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79121" severity="medium" conversionstatus="pass" title="SRG-APP-000023-DB-000001" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine whether SQL Server is configured to use only Windows authentication.
 
In the Object Explorer in SQL Server Management Studio (SSMS), right-click on the server instance.
Select "Properties".
Select the Security page.
 
If Windows Authentication Mode is selected, this is not a finding.
 
OR
 
In a query interface such as the SSMS Transact-SQL editor, run the statement:
SELECT CASE SERVERPROPERTY('IsIntegratedSecurityOnly')
WHEN 1 THEN 'Windows Authentication'
WHEN 0 THEN 'Windows and SQL Server Authentication'
END as [Authentication Mode]
 
If the returned value in the "Authentication Mode" column is "Windows Authentication", this is not a finding.
 
Mixed mode (both SQL Server authentication and Windows authentication) is in use. If the need for mixed mode has not been documented and approved, this is a finding.
 
From the documentation, obtain the list of accounts authorized to be managed by SQL Server.
 
Determine the accounts (SQL Logins) actually managed by SQL Server. Run the statement:
 
SELECT name
FROM sys.sql_logins
WHERE type_desc = 'SQL_LOGIN' AND is_disabled = 0;
 
If any accounts listed by the query are not listed in the documentation, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79123" severity="medium" conversionstatus="pass" title="SRG-APP-000023-DB-000001" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>If the SQL Server is not part of an Active Directory domain, this finding is Not Applicable.
 
Obtain the fully qualified domain name of the SQL Server instance:
 
Launch Windows Explorer.
 
Right-click on "Computer" or "This PC" (Varies by OS level), click "Properties".
 
Note the value shown for "Full computer name".
 
*** Note: For a cluster, this value must be obtained from the Failover Cluster Manager. ***
 
Obtain the TCP port that is supporting the SQL Server instance:
 
Click Start &gt;&gt; Type "SQL Server 2016 Configuration Manager" &gt;&gt; From the search results, click "SQL Server 2016 Configuration Manager".
 
From the tree on the left, expand "SQL Server Network Configuration".
 
Click "Protocols for &lt;Instance Name&gt;" where &lt;Instance Name&gt; is the name of the instance (MSSQLSERVER is the default name).
 
In the right pane, right-click on "TCP/IP" and choose "Properties".
 
In the window that opens, click the "IP Addresses" tab.
 
Note the TCP port configured for the instance.
 
Obtain the service account that is running the SQL Server service:
 
Click "Start".
Type "SQL Server 2016 Configuration Manager".
From the search results, click "SQL Server 2016 Configuration Manager".
 
From the tree on the left, select "SQL Server Services".
 
Note the account listed in the "Log On As" column for the SQL Server instance being reviewed.
 
Launch a command-line or PowerShell window.
 
Enter the following command where &lt;Service Account&gt; is the identity of the service account.
 
setspn -L &lt;Service Account&gt;
 
Example: setspn -L CONTOSO\sql2016svc
 
Review the Registered Service Principal Names returned.
 
If the listing does not contain the following two service principal names, this is a finding.
 
MSSQLSvc/&lt;Fully Qualified Domain Name&gt;
MSSQLSvc/&lt;Fully Qualified Domain Name&gt;:&lt;TCP Port&gt;
 
If the MSSQLSvc service is registered for any fully qualified domain names that do not match the current server, this may indicate the service account is shared across SQL Server instances. Review server documentation, if the sharing of service accounts across instances is not documented and authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79125" severity="high" conversionstatus="pass" title="SRG-APP-000033-DB-000084" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine the required levels of protection for DBMS server securables, by type of login.
 
Review the permissions actually in place on the server.
 
If the actual permissions do not match the documented requirements, this is a finding.
 
Use the supplemental file "Instance permissions assignments to logins and roles.sql."</RawString>
    </Rule>
    <Rule id="V-79127" severity="medium" conversionstatus="pass" title="SRG-APP-000080-DB-000063" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Obtain the list of authorized SQL Server accounts in the system documentation.
 
Determine if any accounts are shared. A shared account is defined as a username and password that are used by multiple individuals to log into SQL Server. An example of a shared account is the SQL Server installation account. Windows Groups are not shared accounts as the group itself does not have a password.
 
If accounts are determined to be shared, determine if individuals are first individually authenticated.
 
If individuals are not individually authenticated before using the shared account (e.g., by the operating system or possibly by an application making calls to the database), this is a finding.
 
The key is individual accountability. If this can be traced, this is not a finding.
 
If accounts are determined to be shared, determine if they are directly accessible to end users. If so, this is a finding.
 
Review contents of audit logs, traces and data tables to confirm that the identity of the individual user performing the action is captured.
 
If shared identifiers are found, and not accompanied by individual identifiers, this is a finding.
 
Note: Privileged installation accounts may be required to be accessed by the DBA or other administrators for system maintenance. In these cases, each use of the account must be logged in some manner to assign accountability for any actions taken during the use of the account.</RawString>
    </Rule>
    <Rule id="V-79133" severity="medium" conversionstatus="pass" title="SRG-APP-000089-DB-000064" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the server documentation to determine if any additional events are required to be audited. If no additional events are required, this is not a finding.
 
Execute the following query to get all of the installed audits:
 
SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
All currently defined audits for the SQL server instance will be listed. If no audits are returned, this is a finding.
 
To view the actions being audited by the audits, execute the following query:
 
SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1
 
Compare the documentation to the list of generated audit events. If there are any missing events, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79135" severity="medium" conversionstatus="pass" title="SRG-APP-000090-DB-000065" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Obtain the list of approved audit maintainers from the system documentation.
 
Review the server roles and individual logins that have the following role memberships, all of which enable the ability to create and maintain audit definitions.
 
sysadmin
dbcreator
 
Review the server roles and individual logins that have the following permissions, all of which enable the ability to create and maintain audit definitions.
 
ALTER ANY SERVER AUDIT
CONTROL SERVER
ALTER ANY DATABASE
CREATE ANY DATABASE
 
Use the following query to determine the roles and logins that have the listed permissions:
 
SELECT-- DISTINCT
    CASE
        WHEN SP.class_desc IS NOT NULL THEN
            CASE
                WHEN SP.class_desc = 'SERVER' AND S.is_linked = 0 THEN 'SERVER'
                WHEN SP.class_desc = 'SERVER' AND S.is_linked = 1 THEN 'SERVER (linked)'
                ELSE SP.class_desc
            END
        WHEN E.name IS NOT NULL THEN 'ENDPOINT'
        WHEN S.name IS NOT NULL AND S.is_linked = 0 THEN 'SERVER'
        WHEN S.name IS NOT NULL AND S.is_linked = 1 THEN 'SERVER (linked)'
        WHEN P.name IS NOT NULL THEN 'SERVER_PRINCIPAL'
        ELSE '???'
    END AS [Securable Class],
    CASE
        WHEN E.name IS NOT NULL THEN E.name
        WHEN S.name IS NOT NULL THEN S.name
        WHEN P.name IS NOT NULL THEN P.name
        ELSE '???'
    END AS [Securable],
    P1.name AS [Grantee],
    P1.type_desc AS [Grantee Type],
    sp.permission_name AS [Permission],
    sp.state_desc AS [State],
    P2.name AS [Grantor],
    P2.type_desc AS [Grantor Type],
R.name AS [Role Name]
FROM
    sys.server_permissions SP
    INNER JOIN sys.server_principals P1
        ON P1.principal_id = SP.grantee_principal_id
    INNER JOIN sys.server_principals P2
        ON P2.principal_id = SP.grantor_principal_id
 
    FULL OUTER JOIN sys.servers S
        ON SP.class_desc = 'SERVER'
        AND S.server_id = SP.major_id
 
    FULL OUTER JOIN sys.endpoints E
        ON SP.class_desc = 'ENDPOINT'
        AND E.endpoint_id = SP.major_id
 
    FULL OUTER JOIN sys.server_principals P
        ON SP.class_desc = 'SERVER_PRINCIPAL'
        AND P.principal_id = SP.major_id
 
FULL OUTER JOIN sys.server_role_members SRM
ON P.principal_id = SRM.member_principal_id
 
LEFT OUTER JOIN sys.server_principals R
ON SRM.role_principal_id = R.principal_id
WHERE sp.permission_name IN ('ALTER ANY SERVER AUDIT','CONTROL SERVER','ALTER ANY DATABASE','CREATE ANY DATABASE')
OR R.name IN ('sysadmin','dbcreator')
 
If any of the logins, roles, or role memberships returned have permissions that are not documented, or the documented audit maintainers do not have permissions, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79137" severity="medium" conversionstatus="pass" title="SRG-APP-000091-DB-000066" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit the retrieval of privilege/permission/role membership information.
 
If SQL Server is not required to audit the retrieval of privilege/permission/role membership information, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query. If no records are returned, this is a finding.
 
SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the SCHEMA_OBJECT_ACCESS_GROUP is included in the server audit specification:
 
SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the SCHEMA_OBJECT_ACCESS_GROUP is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79139" severity="medium" conversionstatus="pass" title="SRG-APP-000091-DB-000325" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit the retrieval of privilege/permission/role membership information.
 
If SQL Server is not required to audit the retrieval of privilege/permission/role membership information, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query. If no records are returned, this is a finding.
 
SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the SCHEMA_OBJECT_ACCESS_GROUP is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the SCHEMA_OBJECT_ACCESS_GROUP is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79143" severity="medium" conversionstatus="pass" title="SRG-APP-000093-DB-000052" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if auditing of a session is required.
 
If auditing of a session is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79145" severity="medium" conversionstatus="pass" title="SRG-APP-000101-DB-000044" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>If a SQL Server Audit is not in use for audit purposes, this is a finding unless a third-party product is being used that can perform detailed auditing for SQL Server.
 
Review system documentation to determine whether SQL Server is required to audit any events, and any fields, in addition to those in the standard audit.
 
If there are none specified, this is not a finding.
 
If SQL Server Audit is in use, compare the audit specification(s) with the documented requirements.
 
If any such requirement is not satisfied by the audit specification(s) (or by supplemental, locally-deployed mechanisms), this is a finding.</RawString>
    </Rule>
    <Rule id="V-79147" severity="medium" conversionstatus="pass" title="SRG-APP-000109-DB-000049" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>If the system documentation indicates that availability takes precedence over audit trail completeness, this is not applicable (NA).
 
If SQL Server Audit is in use, review the defined server audits by running the statement:
 
SELECT * FROM sys.server_audits;
 
By observing the [name] and [is_state_enabled] columns, identify the row or rows in use.
 
If the [on_failure_desc] is "SHUTDOWN SERVER INSTANCE" on this/these row(s), this is not a finding. Otherwise, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79149" severity="medium" conversionstatus="pass" title="SRG-APP-000109-DB-000321" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>If the system documentation indicates that availability does not take precedence over audit trail completeness, this is not applicable (NA).
 
If SQL Server Audit is not in use, this is a finding.
 
If SQL Server Audit is in use, review the defined server audits by running the statement:
 
SELECT [name], [max_rollover_files] FROM sys.server_file_audits
WHERE is_state_enabled = 1;
 
By observing the [name] and [max_rollover_files] columns, identify the row or rows in use.
 
If the [max_rollover_files] is greater than zero, this is not a finding. Otherwise, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79157" severity="medium" conversionstatus="pass" title="SRG-APP-000121-DB-000202" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the server documentation for a list of approved users with access to SQL Server Audits.
 
To create, alter, or drop a server audit, principals require the ALTER ANY SERVER AUDIT or the CONTROL SERVER permission. To view an Audit log requires the CONTROL SERVER permission. To use Profiler, ALTER TRACE is required.
 
Review the SQL Server permissions granted to principals. Look for permissions ALTER ANY SERVER AUDIT, ALTER ANY DATABASE AUDIT, CONTROL SERVER, ALTER TRACE:
 
SELECT login.name, perm.permission_name, perm.state_desc
FROM sys.server_permissions perm
JOIN sys.server_principals login
ON perm.grantee_principal_id = login.principal_id
WHERE permission_name in ('CONTROL SERVER', 'ALTER ANY DATABASE AUDIT', 'ALTER ANY SERVER AUDIT','ALTER TRACE')
and login.name not like '##MS_%';
 
If unauthorized accounts have these privileges, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79159" severity="medium" conversionstatus="pass" title="SRG-APP-000122-DB-000203" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the server documentation for a list of approved users with access to SQL Server Audits.
 
To alter, or drop a server audit, principals require the ALTER ANY SERVER AUDIT or the CONTROL SERVER permission.
 
Review the SQL Server permissions granted to principals. Look for permissions ALTER ANY SERVER AUDIT, ALTER ANY DATABASE AUDIT:
 
SELECT login.name, perm.permission_name, perm.state_desc
FROM sys.server_permissions perm
JOIN sys.server_principals login
ON perm.grantee_principal_id = login.principal_id
WHERE permission_name in ('CONTROL SERVER', 'ALTER ANY DATABASE AUDIT', 'ALTER ANY SERVER AUDIT')
and login.name not like '##MS_%';
 
If unauthorized accounts have these privileges, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79161" severity="medium" conversionstatus="pass" title="SRG-APP-000123-DB-000204" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the server documentation for a list of approved users with access to SQL Server Audits.
 
To alter, or drop a server audit, principals require the ALTER ANY SERVER AUDIT or the CONTROL SERVER permission.
 
Review the SQL Server permissions granted to principals. Look for permissions ALTER ANY SERVER AUDIT, ALTER ANY DATABASE AUDIT, CONTROL SERVER:
 
SELECT login.name, perm.permission_name, perm.state_desc
FROM sys.server_permissions perm
JOIN sys.server_principals login
ON perm.grantee_principal_id = login.principal_id
WHERE permission_name in ('CONTROL SERVER', 'ALTER ANY DATABASE AUDIT', 'ALTER ANY SERVER AUDIT')
and login.name not like '##MS_%';
 
If unauthorized accounts have these privileges, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79163" severity="medium" conversionstatus="pass" title="SRG-APP-000133-DB-000179" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review Server documentation to determine the authorized owner and users or groups with modify rights for this SQL instance's binary files. Additionally check the owner and users or groups with modify rights for shared software library paths on disk.
 
If any unauthorized users are granted modify rights or the owner is incorrect, this is a finding.
 
To determine the location for these instance-specific binaries, Launch SQL Server Management Studio (SSMS) &gt;&gt; Connect to the instance to be reviewed &gt;&gt; Right-click server name in Object Explorer &gt;&gt; Click Facets &gt;&gt; Select the Server facet &gt;&gt; Record the value for the "RootDirectory" facet property.
 
Navigate to the folder above, and review the "Binn" subdirectory.</RawString>
    </Rule>
    <Rule id="V-79165" severity="medium" conversionstatus="pass" title="SRG-APP-000133-DB-000179" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review server documentation to determine the process by which shared software libraries are monitored for change. Ensure the process alerts for changes in a file's ownership, modification dates, and hash value at a minimum.

If alerts do not at least hash their value, this is a finding.

To determine the location for these instance-specific binaries:

Launch SQL Server Management Studio (SSMS) &gt;&gt; Connect to the instance to be reviewed &gt;&gt; Right-click server name in Object Explorer &gt;&gt; Click Facets &gt;&gt; Select the Server facet &gt;&gt; Record the value for the "RootDirectory" facet property

TIP: Use the Get-FileHash cmdlet shipped with PowerShell 5.0 to get the SHA-2 hash of one or more files.</RawString>
    </Rule>
    <Rule id="V-79167" severity="medium" conversionstatus="pass" title="SRG-APP-000133-DB-000198" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>From the system documentation, obtain the list of accounts authorized to install/update SQL Server. Run the following PowerShell command to list all users who have installed/modified SQL Server 2016 software and compare the list against those persons who are qualified and authorized to use the software.
 
sl "C:\program files\microsoft sql server\130\setup bootstrap\Log"
Get-ChildItem -Recurse | Select-String -Pattern "LogonUser = "
 
If any accounts are shown that are not authorized in the system documentation, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79171" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000090" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the server documentation, if this system is identified as a development or test system, this check is Not Applicable.
 
If this system is identified as production, gather a listing of databases from the server and look for any matching the following general demonstration database names:
 
pubs
Northwind
AdventureWorks
WorldwideImporters
 
If any of these databases exist, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79173" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000091" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>From the server documentation, obtain a listing of required components.
 
Generate a listing of components installed on the server.
 
Click Start &gt;&gt; Type "SQL Server 2016 Installation Center" &gt;&gt; Launch the program &gt;&gt; Click Tools &gt;&gt; Click "Installed SQL Server features discovery report"
 
Compare the feature listing against the required components listing.
 
If any features are installed, but are not required, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79175" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000092" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>From the server documentation, obtain a listing of required components.

Generate a listing of components installed on the server.

Click Start &gt;&gt; Type "SQL Server 2016 Installation Center" &gt;&gt; Launch the program &gt;&gt; Click Tools &gt;&gt; Click "Installed SQL Server features discovery report"

Compare the feature listing against the required components listing. Note any components that are installed, but not required.

Launch SQL Server Configuration Manager.

If any components that are installed but are not required are not disabled, this is a finding.

If any required components are not installed, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79177" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>The xp_cmdshell extended stored procedure allows execution of host executables outside the controls of database access permissions. This access may be exploited by malicious users who have compromised the integrity of the SQL Server database process to control the host operating system to perpetrate additional malicious activity.
 
To determine if xp_cmdshell is enabled, execute the following commands:
 
EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'xp_cmdshell';
 
If the value of "config_value" is "0", this is not a finding.
 
Review the system documentation to determine whether the use of "xp_cmdshell" is required and approved. If it is not approved, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79179" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>The common language runtime (CLR) component of the .NET Framework for Microsoft Windows in SQL Server allows you to write stored procedures, triggers, user-defined types, user-defined functions, user-defined aggregates, and streaming table-valued functions, using any .NET Framework language, including Microsoft Visual Basic .NET and Microsoft Visual C#. CLR packing assemblies can access resources protected by .NET Code Access Security when it runs managed code. Specifying UNSAFE enables the code in the assembly complete freedom to perform operations in the SQL Server process space that can potentially compromise the robustness of SQL Server. UNSAFE assemblies can also potentially subvert the security system of either SQL Server or the common language runtime.
 
To determine if CLR is enabled, execute the following commands:
 
EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'clr enabled';
 
If the value of "config_value" is "0", this is not a finding.
 
Review the system documentation to determine whether the use of CLR code is required and approved. If it is not approved, this is a finding.
 
If CLR code is required and approved, check for UNSAFE Assembly permission using the following script in Master. If records are returned and UNSAFE Assembly is not documented and authorized, this is a finding.
 
SELECT *
FROM sys.assemblies
WHERE permission_set_desc != 'SAFE'
AND is_user_defined = 1</RawString>
    </Rule>
    <Rule id="V-79181" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Extended stored procedures are DLLs that an instance of SQL Server can dynamically load and run. Extended stored procedures run directly in the address space of an instance of SQL Server and are programmed by using the SQL Server Extended Stored Procedure API.
 
Non-Standard extended stored procedures can compromise the integrity of the SQL Server process. This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible.
 
To determine if non-standard extended stored procedures exist, run the following:

------------------------------------------------------------------------
USE [master]
GO
DECLARE @xplist AS TABLE
(
       xp_name sysname,
       source_dll nvarchar(255)
)
INSERT INTO @xplist
EXEC sp_helpextendedproc

SELECT X.xp_name, X.source_dll, O.is_ms_shipped FROM @xplist X JOIN sys.all_objects O ON X.xp_name = O.name WHERE O.is_ms_shipped = 0 ORDER BY X.xp_name
------------------------------------------------------------------------
 
If any records are returned, review the system documentation to determine whether the use of Non-Standard extended stored procedures are required and approved.

If it is not approved, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79183" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>A linked server allows for access to distributed, heterogeneous queries against OLE DB data sources. After a linked server is created, distributed queries can be run against this server, and queries can join tables from more than one data source. If the linked server is defined as an instance of SQL Server, remote stored procedures can be executed.
 
To obtain a list of linked servers, execute the following command:
 
EXEC sp_linkedservers;
 
Review the system documentation to determine whether the linked servers listed are required and approved. If it is not approved, this is a finding.
 
Run the following to get a linked server login mapping:
 
SELECT s.name, p.principal_id, l.remote_name
FROM sys.servers s
JOIN sys.linked_logins l ON s.server_id = l.server_id
LEFT JOIN sys.server_principals p ON l.local_principal_id = p.principal_id
WHERE s.is_linked = 1
 
Review the linked login mapping and check the remote name as it can impersonate sysadmin. If a login in the list is impersonating sysadmin and system documentation does not require this, it is a finding.</RawString>
    </Rule>
    <Rule id="V-79187" severity="medium" conversionstatus="pass" title="SRG-APP-000142-DB-000094" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review SQL Server Configuration for the ports used by SQL Server.
 
To determine whether SQL Server is configured to use a fixed port or dynamic ports, in the right-hand pane double-click on the TCP/IP entry, to open the Properties dialog. (The default fixed port is 1433.)
 
If these are in conflict with PPSM guidance, and not explained and approved in the system documentation, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79193" severity="medium" conversionstatus="pass" title="SRG-APP-000164-DB-000401" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Execute the following query to determine if Contained Databases are used:
 
SELECT * FROM sys.databases WHERE containment = 1
 
If any records are returned. Check the server documentation for a list of authorized contained database users. Ensure contained database users are not using SQL Authentication.
 
EXEC sp_MSforeachdb 'USE [?]; SELECT DB_NAME() AS DatabaseName, * FROM sys.database_principals WHERE authentication_type = 2'
 
If any records are returned, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79201" severity="medium" conversionstatus="pass" title="SRG-APP-000180-DB-000115" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review documentation, SQL Server settings, and authentication system settings to determine if non-organizational users are individually identified and authenticated when logging onto the system.
 
Execute the following query to obtain a list of logins on the SQL Server and ensure all accounts are uniquely identifiable:
 
SELECT name, type_desc FROM sys.server_principals WHERE type in ('S','U')
 
If accounts are determined to be shared, determine if individuals are first individually authenticated. Where an application connects to SQL Server using a standard, shared account, ensure that it also captures the individual user identification and passes it to SQL Server.
 
If the documentation indicates that this is a public-facing, read-only (from the point of view of public users) database that does not require individual authentication, this is not a finding.
 
If non-organizational users are not uniquely identified and authenticated, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79205" severity="high" conversionstatus="pass" title="SRG-APP-000231-DB-000154" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review system documentation to determine whether the system handles classified information. If the system does not handle classified information, the severity of this check should be downgraded to Category II.
 
If the application owner and Authorizing Official have determined that encryption of data at rest is required, ensure the data on secondary devices is encrypted.
 
If full-disk encryption is being used, this is not a finding.
 
If data encryption is required, ensure the data is encrypted before being put on the secondary device by executing:
 
SELECT
d.name AS [Database Name],
CASE e.encryption_state
WHEN 0 THEN 'No database encryption key present, no encryption'
WHEN 1 THEN 'Unencrypted'
WHEN 2 THEN 'Encryption in progress'
WHEN 3 THEN 'Encrypted'
WHEN 4 THEN 'Key change in progress'
WHEN 5 THEN 'Decryption in progress'
WHEN 6 THEN 'Protection change in progress'
END AS [Encryption State]
FROM sys.dm_database_encryption_keys e
RIGHT JOIN sys.databases d ON DB_NAME(e.database_id) = d.name
WHERE d.name NOT IN ('master','model','msdb')
ORDER BY [Database Name] ;
 
For each user database where encryption is required, verify that encryption is in effect. If not, this is a finding.
 
Verify that there are physical security measures, operating system access control lists and organizational controls appropriate to the sensitivity level of the data in the database(s). If not, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79211" severity="medium" conversionstatus="pass" title="SRG-APP-000243-DB-000373" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review system documentation to determine if Common Criteria Compliance is not required due to potential impact on system performance.
 
SQL Server Residual Information Protection (RIP) requires a memory allocation to be overwritten with a known pattern of bits before memory is reallocated to a new resource. Meeting the RIP standard can contribute to improved security; however, overwriting the memory allocation can slow performance. After the common criteria compliance enabled option is enabled, the overwriting occurs.
 
Review the Instance configuration:
 
SELECT name, value_in_use FROM sys.configurations
WHERE name = 'common criteria compliance enabled'
     and value_in_use = 0
 
If no records are returned and an exception is not defined in the system documentation, this is a finding.
 
NOTE: Enabling this feature may impact performance on highly active SQL Server instances. If enabling this feature impacts performance, this setting may be disabled and the category reduced to a CAT III finding.</RawString>
    </Rule>
    <Rule id="V-79213" severity="medium" conversionstatus="pass" title="SRG-APP-000243-DB-000373" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if Instant File Initialization (IFI) is required.
 
If IFI is documented as required, this is not a finding.
 
Review system configuration to determine whether Instant File Initialization support has been enabled (by default in SQL Server 2016).
 
Start &gt;&gt; Control Panel &gt;&gt; Administrative Tools &gt;&gt; Local Security Policy &gt;&gt; Local Policies &gt;&gt; Security Options
 
If the SQL Service SID (Default instance: NT SERVICE\MSSQLSERVER. Named instance: NT SERVICE\MSSQL$InstanceName) has been granted "Perform volume maintenance tasks" Local Rights Assignment and it is not documented in the system documentation, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79215" severity="medium" conversionstatus="pass" title="SRG-APP-000243-DB-000374" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the permissions granted to users by the operating system/file system on the database files, database log files, and database backup files.

To obtain the location of SQL Server data, transaction log, and backup files, open and execute the supplemental file "Get SQL Data and Backup Directories.sql".

For each of the directories returned by the above script, verify whether the correct permissions have been applied.

1) Launch Windows Explorer.
2) Navigate to the folder.
3) Right-click the folder and click "Properties".
4) Navigate to the "Security" tab.
5) Review the listing of principals and permissions.

Account Type Directory Type Permission
-----------------------------------------------------------------------------------------------
Database Administrators ALL Full Control
SQL Server Service SID Data; Log; Backup; Full Control
SQL Server Agent Service SID Backup Full Control
SYSTEM ALL Full Control
CREATOR OWNER ALL Full Control

For information on how to determine a "Service SID", go to:
https://aka.ms/sql-service-sids

Additional permission requirements, including full directory permissions and operating system rights for SQL Server, are documented at:
https://aka.ms/sqlservicepermissions

If any additional permissions are granted but not documented as authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79219" severity="medium" conversionstatus="pass" title="SRG-APP-000340-DB-000304" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review server-level securables and built-in role membership to ensure only authorized users have privileged access and the ability to create server-level objects and grant permissions to themselves or others.
 
Review the system documentation to determine the required levels of protection for DBMS server securables, by type of login.
 
Review the permissions in place on the server. If the actual permissions do not match the documented requirements, this is a finding.
 
Get all permission assignments to logins and roles:
 
SELECT DISTINCT
    CASE
        WHEN SP.class_desc IS NOT NULL THEN
            CASE
                WHEN SP.class_desc = 'SERVER' AND S.is_linked = 0 THEN 'SERVER'
                WHEN SP.class_desc = 'SERVER' AND S.is_linked = 1 THEN 'SERVER (linked)'
                ELSE SP.class_desc
            END
        WHEN E.name IS NOT NULL THEN 'ENDPOINT'
        WHEN S.name IS NOT NULL AND S.is_linked = 0 THEN 'SERVER'
        WHEN S.name IS NOT NULL AND S.is_linked = 1 THEN 'SERVER (linked)'
        WHEN P.name IS NOT NULL THEN 'SERVER_PRINCIPAL'
        ELSE '???'
    END AS [Securable Class],
    CASE
        WHEN E.name IS NOT NULL THEN E.name
        WHEN S.name IS NOT NULL THEN S.name
        WHEN P.name IS NOT NULL THEN P.name
        ELSE '???'
    END AS [Securable],
    P1.name AS [Grantee],
    P1.type_desc AS [Grantee Type],
    sp.permission_name AS [Permission],
    sp.state_desc AS [State],
    P2.name AS [Grantor],
    P2.type_desc AS [Grantor Type]
FROM
    sys.server_permissions SP
    INNER JOIN sys.server_principals P1
        ON P1.principal_id = SP.grantee_principal_id
    INNER JOIN sys.server_principals P2
        ON P2.principal_id = SP.grantor_principal_id
 
    FULL OUTER JOIN sys.servers S
        ON SP.class_desc = 'SERVER'
        AND S.server_id = SP.major_id
 
    FULL OUTER JOIN sys.endpoints E
        ON SP.class_desc = 'ENDPOINT'
        AND E.endpoint_id = SP.major_id
 
    FULL OUTER JOIN sys.server_principals P
        ON SP.class_desc = 'SERVER_PRINCIPAL'
        AND P.principal_id = SP.major_id
 
Get all server role memberships:
 
SELECT
    R.name AS [Role],
    M.name AS [Member]
FROM
    sys.server_role_members X
    INNER JOIN sys.server_principals R ON R.principal_id = X.role_principal_id
    INNER JOIN sys.server_principals M ON M.principal_id = X.member_principal_id
 
The CONTROL SERVER permission is similar but not identical to the sysadmin fixed server role. Permissions do not imply role memberships and role memberships do not grant permissions. (e.g., CONTROL SERVER does not imply membership in the sysadmin fixed server role.)
 
Ensure only the documented and approved logins have privileged functions in SQL Server.
 
If the current configuration does not match the documented baseline, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79221" severity="medium" conversionstatus="pass" title="SRG-APP-000342-DB-000302" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the server documentation to obtain a listing of accounts used for executing external processes. Execute the following query to obtain a listing of accounts currently configured for use by external processes.
 
SELECT C.name AS credential_name, C.credential_identity
FROM sys.credentials C
GO
 
SELECT P.name AS proxy_name, C.name AS credential_name, C.credential_identity
FROM sys.credentials C
JOIN msdb.dbo.sysproxies P ON C.credential_id = P.credential_id
WHERE P.enabled = 1
GO
 
If any Credentials or SQL Agent Proxy accounts are returned that are not documented and authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79223" severity="medium" conversionstatus="pass" title="SRG-APP-000356-DB-000314" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation for a description of how audit records are off-loaded and how local audit log space is managed.
 
If the SQL Server audit records are not written directly to or systematically transferred to a centralized log management system, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79225" severity="medium" conversionstatus="pass" title="SRG-APP-000356-DB-000315" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation for a description of how audit records are off-loaded and how local audit log space is managed.
 
If the SQL Server audit records (to include traces used for audit purposes) are not written directly to or systematically transferred to a centralized log management system, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79227" severity="medium" conversionstatus="pass" title="SRG-APP-000357-DB-000316" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the server documentation for the SQL Audit file size configurations. Locate the Audit file path and drive.
 
SELECT max_file_size, max_rollover_files, log_file_path AS "Audit Path"
FROM sys.server_file_audits
 
Calculate the space needed as the maximum file size and number of files from the SQL Audit File properties.
 
If the calculated product of the "max_file_size" times the "max_rollover_files" exceeds the size of the storage location or if "max_file_size" or "max_rollover_files" are set to "0" (UNLIMITED), this is a finding.</RawString>
    </Rule>
    <Rule id="V-79231" severity="medium" conversionstatus="pass" title="SRG-APP-000360-DB-000320" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine which audit failure events require real-time alerts.
 
Review SQL Server settings and code. If the real-time alerting that is specified in the documentation is not enabled, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79233" severity="medium" conversionstatus="pass" title="SRG-APP-000374-DB-000322" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>SQL Server audits store the timestamp in UTC time.
 
Determine if the computer is joined to a domain.
 
SELECT DEFAULT_DOMAIN()[DomainName]
 
If this is not NULL, this is not a finding.
 
If the computer is not joined to a domain, determine what the time source is. (Run the following command in an elevated PowerShell session.)
 
     w32tm /query /source
 
If the results of the command return "Local CMOS Clock" and is not documented with justification and AO authorization, this is a finding.
 
If the OS does not synchronize with a time server, review the procedure for maintaining accurate time on the system.
 
If such a procedure does not exist, this is a finding.
 
If the procedure exists, review evidence that the correct time is actually maintained.
 
If the evidence indicates otherwise, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79235" severity="medium" conversionstatus="pass" title="SRG-APP-000380-DB-000360" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Obtain a list of logins who have privileged permissions and role memberships in SQL.
 
Execute the following query to obtain a list of logins and roles and their respective permissions assignment:
 
SELECT p.name AS Principal,
p.type_desc AS Type,
sp.permission_name AS Permission,
sp.state_desc AS State
FROM sys.server_principals p
INNER JOIN sys.server_permissions sp ON p.principal_id = sp.grantee_principal_id
WHERE sp.permission_name = 'CONTROL SERVER'
OR sp.state = 'W'
 
Execute the following query to obtain a list of logins and their role memberships.
 
SELECT m.name AS Member,
m.type_desc AS Type,
r.name AS Role
FROM sys.server_principals m
INNER JOIN sys.server_role_members rm ON m.principal_id = rm.member_principal_id
INNER JOIN sys.server_principals r ON rm.role_principal_id = r.principal_id
WHERE r.name IN ('sysadmin','securityadmin','serveradmin')
 
Check the server documentation to verify the logins and roles returned are authorized. If the logins and/or roles are not documented and authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79237" severity="medium" conversionstatus="pass" title="SRG-APP-000380-DB-000360" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Obtain a list of users who have privileged access to the server via the local Administrators group.
 
Launch lusrmgr.msc
Select Groups
Double-click Administrators
 
Alternatively, execute the following command in PowerShell:

net localgroup administrators
 
Check the server documentation to verify the users returned are authorized.
 
If the users are not documented and authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79241" severity="medium" conversionstatus="pass" title="SRG-APP-000383-DB-000364" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>SQL Server must only use approved network communication libraries, ports, and protocols.
 
Obtain a list of all approved network libraries, communication ports, and protocols from the server documentation.
 
Verify that the protocols are enabled for the instance.
 
If any ports or protocols are used that are not specifically approved in the server documentation, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79243" severity="medium" conversionstatus="pass" title="SRG-APP-000431-DB-000388" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the server documentation to determine whether use of CLR assemblies is required. Run the following query to determine whether CLR is enabled for the instance:
 
SELECT name, value, value_in_use
FROM sys.configurations
WHERE name = 'clr enabled'
 
If "value_in_use" is a "1" and CLR is not required, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79245" severity="medium" conversionstatus="pass" title="SRG-APP-000431-DB-000388" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the server documentation to obtain a listing of required service accounts. Review the accounts configured for all SQL Server services installed on the server.
 
Click Start &gt;&gt; Type "SQL Server Configuration Manager" &gt;&gt; Launch the program &gt;&gt; Click SQL Server Services tree node. Review the "Log On As" column for each service.
 
If any services are configured with the same service account or are configured with an account that is not documented and authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79247" severity="medium" conversionstatus="pass" title="SRG-APP-000454-DB-000389" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>From the server documentation, obtain a listing of required components.
 
Generate a listing of components installed on the server.
 
Click Start &gt;&gt; Type "SQL Server 2016 Installation Center" &gt;&gt; Launch the program &gt;&gt; Click Tools &gt;&gt; Click "Installed SQL Server features discovery report"
 
Compare the feature listing against the required components listing. If any features are installed, but are not required, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79253" severity="medium" conversionstatus="pass" title="SRG-APP-000492-DB-000333" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit the retrieval of privilege/permission/role membership information.
 
If this is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_statu
 
If no records are returned, this is a finding.
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the "SCHEMA_OBJECT_ACCESS_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
  d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the SCHEMA_OBJECT_ACCESS_GROUP is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79255" severity="medium" conversionstatus="pass" title="SRG-APP-000494-DB-000344" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit when data classifications are retrieved.
 
If this is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_stats
 
If no records are returned, this is a finding.
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the "SCHEMA_OBJECT_ACCESS_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
  d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the "SCHEMA_OBJECT_ACCESS_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79257" severity="medium" conversionstatus="pass" title="SRG-APP-000494-DB-000345" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit when data classifications are unsuccessfully retrieved.
 
If this is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the "SCHEMA_OBJECT_ACCESS_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
  d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the "SCHEMA_OBJECT_ACCESS_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79261" severity="medium" conversionstatus="pass" title="SRG-APP-000495-DB-000327 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the SQL Server Audit being used for the STIG compliant audit.
 
If the following events are not included, this is a finding.
 
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
DATABASE_OWNERSHIP_CHANGE_GROUP
DATABASE_PERMISSION_CHANGE_GROUP
DATABASE_ROLE_MEMBER_CHANGE_GROUP
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP
SERVER_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_PERMISSION_CHANGE_GROUP
SERVER_ROLE_MEMBER_CHANGE_GROUP
 
Reference:
https://msdn.microsoft.com/en-us/library/cc280663.aspx</RawString>
    </Rule>
    <Rule id="V-79263" severity="medium" conversionstatus="pass" title="SRG-APP-000495-DB-000328 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the SQL Server Audit being used for the STIG compliant audit.
 
If the following events are not included, this is a finding.
 
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
DATABASE_OWNERSHIP_CHANGE_GROUP
DATABASE_PERMISSION_CHANGE_GROUP
DATABASE_ROLE_MEMBER_CHANGE_GROUP
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP
SERVER_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_PERMISSION_CHANGE_GROUP
SERVER_ROLE_MEMBER_CHANGE_GROUP
 
Reference:
https://msdn.microsoft.com/en-us/library/cc280663.aspx</RawString>
    </Rule>
    <Rule id="V-79265" severity="medium" conversionstatus="pass" title="SRG-APP-000495-DB-000329 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the SQL Server Audit being used for the STIG compliant audit.
 
If the following events are not included, this is a finding.
 
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
DATABASE_OWNERSHIP_CHANGE_GROUP
DATABASE_PERMISSION_CHANGE_GROUP
DATABASE_ROLE_MEMBER_CHANGE_GROUP
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP
SERVER_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_PERMISSION_CHANGE_GROUP
SERVER_ROLE_MEMBER_CHANGE_GROUP
 
Reference:
https://msdn.microsoft.com/en-us/library/cc280663.aspx</RawString>
    </Rule>
    <Rule id="V-79267" severity="medium" conversionstatus="pass" title="SRG-APP-000496-DB-000334 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query:
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
Execute the following query to verify the "SCHEMA_OBJECT_CHANGE_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
  d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_CHANGE_GROUP'
 
If the "SCHEMA_OBJECT_CHANGE_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79269" severity="medium" conversionstatus="pass" title="SRG-APP-000496-DB-000335 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query:
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
Execute the following query to verify the "SCHEMA_OBJECT_CHANGE_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
  d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_CHANGE_GROUP'
 
If the "SCHEMA_OBJECT_CHANGE_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79271" severity="medium" conversionstatus="pass" title="SRG-APP-000498-DB-000346" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit when data classifications are modified.
 
If this is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the "SCHEMA_OBJECT_ACCESS_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
  d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the "SCHEMA_OBJECT_ACCESS_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79273" severity="medium" conversionstatus="pass" title="SRG-APP-000498-DB-000347" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit when data classifications are unsuccessfully modified.
 
If this is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the "SCHEMA_OBJECT_ACCESS_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
  d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the "SCHEMA_OBJECT_ACCESS_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79275" severity="medium" conversionstatus="pass" title="SRG-APP-000499-DB-000330 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the SQL Server Audit being used for the STIG compliant audit.
 
If the following events are not included, this is a finding.
 
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
DATABASE_OWNERSHIP_CHANGE_GROUP
DATABASE_PERMISSION_CHANGE_GROUP
DATABASE_ROLE_MEMBER_CHANGE_GROUP
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP
SERVER_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_PERMISSION_CHANGE_GROUP
SERVER_ROLE_MEMBER_CHANGE_GROUP
 
Reference:
https://msdn.microsoft.com/en-us/library/cc280663.aspx</RawString>
    </Rule>
    <Rule id="V-79277" severity="medium" conversionstatus="pass" title="SRG-APP-000499-DB-000331 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the SQL Server Audit being used for the STIG compliant audit.
 
If the following events are not included, this is a finding.
 
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
DATABASE_OWNERSHIP_CHANGE_GROUP
DATABASE_PERMISSION_CHANGE_GROUP
DATABASE_ROLE_MEMBER_CHANGE_GROUP
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP
SERVER_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_PERMISSION_CHANGE_GROUP
SERVER_ROLE_MEMBER_CHANGE_GROUP
 
Reference:
https://msdn.microsoft.com/en-us/library/cc280663.aspx</RawString>
    </Rule>
    <Rule id="V-79279" severity="medium" conversionstatus="pass" title="SRG-APP-000501-DB-000336 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
Execute the following query to verify the "SCHEMA_OBJECT_CHANGE_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_CHANGE_GROUP'
 
If the "SCHEMA_OBJECT_CHANGE_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79281" severity="medium" conversionstatus="pass" title="SRG-APP-000501-DB-000337 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
Execute the following query to verify the "SCHEMA_OBJECT_CHANGE_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_CHANGE_GROUP'
 
If the "SCHEMA_OBJECT_CHANGE_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79283" severity="medium" conversionstatus="pass" title="SRG-APP-000502-DB-000348" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit when data classifications are deleted.
 
If this is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the "SCHEMA_OBJECT_ACCESS_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
  d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the "SCHEMA_OBJECT_ACCESS_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79285" severity="medium" conversionstatus="pass" title="SRG-APP-000502-DB-000349" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit when data classifications are unsuccessfully deleted.
 
If this is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the "SCHEMA_OBJECT_ACCESS_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
 s.name AS 'SpecName',
 d.audit_action_name AS 'ActionName',
 d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the "SCHEMA_OBJECT_ACCESS_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79289" severity="medium" conversionstatus="pass" title="SRG-APP-000503-DB-000351 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
Execute the following query to verify the "FAILED_LOGIN_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
  d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'FAILED_LOGIN_GROUP'
 
If the "FAILED_LOGIN_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79293" severity="medium" conversionstatus="pass" title="SRG-APP-000504-DB-000355 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query.

SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status

If no records are returned, this is a finding.

Execute the following query to verify the following events are included in the server audit specification:

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
AUDIT_CHANGE_GROUP
BACKUP_RESTORE_GROUP
DATABASE_CHANGE_GROUP
DATABASE_OBJECT_CHANGE_GROUP
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
DATABASE_OPERATION_GROUP
DATABASE_OWNERSHIP_CHANGE_GROUP
DATABASE_PERMISSION_CHANGE_GROUP
DATABASE_PRINCIPAL_CHANGE_GROUP
DATABASE_PRINCIPAL_IMPERSONATION_GROUP
DATABASE_ROLE_MEMBER_CHANGE_GROUP
DBCC_GROUP
LOGIN_CHANGE_PASSWORD_GROUP
SCHEMA_OBJECT_CHANGE_GROUP
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OBJECT_CHANGE_GROUP
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP
SERVER_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OPERATION_GROUP
SERVER_PERMISSION_CHANGE_GROUP
SERVER_PRINCIPAL_CHANGE_GROUP
SERVER_PRINCIPAL_IMPERSONATION_GROUP
SERVER_ROLE_MEMBER_CHANGE_GROUP
SERVER_STATE_CHANGE_GROUP
TRACE_CHANGE_GROUP
USER_CHANGE_PASSWORD_GROUP

SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1
AND d.audit_action_name IN ('APPLICATION_ROLE_CHANGE_PASSWORD_GROUP','AUDIT_CHANGE_GROUP','BACKUP_RESTORE_GROUP','DATABASE_CHANGE_GROUP','DATABASE_OBJECT_CHANGE_GROUP','DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP','DATABASE_OBJECT_PERMISSION_CHANGE_GROUP','DATABASE_OPERATION_GROUP','DATABASE_OWNERSHIP_CHANGE_GROUP','DATABASE_PERMISSION_CHANGE_GROUP','DATABASE_PRINCIPAL_CHANGE_GROUP','DATABASE_PRINCIPAL_IMPERSONATION_GROUP','DATABASE_ROLE_MEMBER_CHANGE_GROUP','DBCC_GROUP','LOGIN_CHANGE_PASSWORD_GROUP','SCHEMA_OBJECT_CHANGE_GROUP','SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP','SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP','SERVER_OBJECT_CHANGE_GROUP','SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP','SERVER_OBJECT_PERMISSION_CHANGE_GROUP','SERVER_OPERATION_GROUP','SERVER_PERMISSION_CHANGE_GROUP','SERVER_PRINCIPAL_CHANGE_GROUP','SERVER_PRINCIPAL_IMPERSONATION_GROUP','SERVER_ROLE_MEMBER_CHANGE_GROUP','SERVER_STATE_CHANGE_GROUP','TRACE_CHANGE_GROUP','USER_CHANGE_PASSWORD_GROUP')

If the identified groups are not returned, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79295" severity="medium" conversionstatus="pass" title="SRG-APP-000505-DB-000352 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query:

SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status

If no records are returned, this is a finding.

Execute the following query to verify the following events are included in the server audit specification:

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
AUDIT_CHANGE_GROUP
BACKUP_RESTORE_GROUP
DATABASE_CHANGE_GROUP
DATABASE_OBJECT_CHANGE_GROUP
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
DATABASE_OPERATION_GROUP
DATABASE_OWNERSHIP_CHANGE_GROUP
DATABASE_PERMISSION_CHANGE_GROUP
DATABASE_PRINCIPAL_CHANGE_GROUP
DATABASE_PRINCIPAL_IMPERSONATION_GROUP
DATABASE_ROLE_MEMBER_CHANGE_GROUP
DBCC_GROUP
LOGIN_CHANGE_PASSWORD_GROUP
SCHEMA_OBJECT_CHANGE_GROUP
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OBJECT_CHANGE_GROUP
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP
SERVER_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OPERATION_GROUP
SERVER_PERMISSION_CHANGE_GROUP
SERVER_PRINCIPAL_CHANGE_GROUP
SERVER_PRINCIPAL_IMPERSONATION_GROUP
SERVER_ROLE_MEMBER_CHANGE_GROUP
SERVER_STATE_CHANGE_GROUP
TRACE_CHANGE_GROUP
USER_CHANGE_PASSWORD_GROUP

SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1
AND d.audit_action_name IN ('APPLICATION_ROLE_CHANGE_PASSWORD_GROUP','AUDIT_CHANGE_GROUP','BACKUP_RESTORE_GROUP','DATABASE_CHANGE_GROUP','DATABASE_OBJECT_CHANGE_GROUP','DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP','DATABASE_OBJECT_PERMISSION_CHANGE_GROUP','DATABASE_OPERATION_GROUP','DATABASE_OWNERSHIP_CHANGE_GROUP','DATABASE_PERMISSION_CHANGE_GROUP','DATABASE_PRINCIPAL_CHANGE_GROUP','DATABASE_PRINCIPAL_IMPERSONATION_GROUP','DATABASE_ROLE_MEMBER_CHANGE_GROUP','DBCC_GROUP','LOGIN_CHANGE_PASSWORD_GROUP','SCHEMA_OBJECT_CHANGE_GROUP','SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP','SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP','SERVER_OBJECT_CHANGE_GROUP','SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP','SERVER_OBJECT_PERMISSION_CHANGE_GROUP','SERVER_OPERATION_GROUP','SERVER_PERMISSION_CHANGE_GROUP','SERVER_PRINCIPAL_CHANGE_GROUP','SERVER_PRINCIPAL_IMPERSONATION_GROUP','SERVER_ROLE_MEMBER_CHANGE_GROUP','SERVER_STATE_CHANGE_GROUP','TRACE_CHANGE_GROUP','USER_CHANGE_PASSWORD_GROUP')

If the identified groups are not returned, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79297" severity="medium" conversionstatus="pass" title="SRG-APP-000506-DB-000353 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
Execute the following query to verify the "SUCCESSFUL_LOGIN_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SUCCESSFUL_LOGIN_GROUP'
 
If the "SUCCESSFUL_LOGIN_GROUP" is returned in an active audit, this is not a finding.
 
If "SUCCESSFUL_LOGIN_GROUP" is not in the active audit, determine whether "Both failed and successful logins" is enabled.
 
In SQL Management Studio:
Right-click on the instance &gt;&gt; Select "Properties" &gt;&gt; Select "Security" on the left hand side &gt;&gt; Check the setting for "Login auditing"
 
If "Both failed and successful logins" is not selected, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79299" severity="medium" conversionstatus="pass" title="SRG-APP-000507-DB-000356" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit when successful accesses to objects occur.
 
If this is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the "SCHEMA_OBJECT_ACCESS_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
 s.name AS 'SpecName',
 d.audit_action_name AS 'ActionName',
 d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the "SCHEMA_OBJECT_ACCESS_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79301" severity="medium" conversionstatus="pass" title="SRG-APP-000507-DB-000357" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to determine if SQL Server is required to audit when unsuccessful accesses to objects occur.
 
If this is not required, this is not a finding.
 
If the documentation does not exist, this is a finding.
 
Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the "SCHEMA_OBJECT_ACCESS_GROUP" is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
 s.name AS 'SpecName',
 d.audit_action_name AS 'ActionName',
 d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'
 
If the "SCHEMA_OBJECT_ACCESS_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79309" severity="medium" conversionstatus="pass" title="SRG-APP-000514-DB-000383" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the server documentation, if this system does not contain data that must be encrypted, this finding is NA.

Verify that Windows is configured to require the use of FIPS 140-2 algorithms for the unclassified information that requires it.

Click Start &gt;&gt; Type "Local Security Policy" &gt;&gt; Press Enter &gt;&gt; Expand "Local Policies" &gt;&gt; Select "Security Options" &gt;&gt; Locate "System Cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing."

If "System Cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing" is not enabled, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79311" severity="medium" conversionstatus="pass" title="SRG-APP-000515-DB-000318" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation for a description of how audit records are off-loaded.
 
If the system has a continuous network connection to the centralized log management system, but the DBMS audit records are not written directly to the centralized log management system or transferred in near-real-time, this is a finding.
 
If the system does not have a continuous network connection to the centralized log management system, and the DBMS audit records are not transferred to the centralized log management system weekly or more often, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79313" severity="medium" conversionstatus="pass" title="SRG-APP-000516-DB-000363" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Launch "Registry Editor"
 
Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\[InstanceId]\CPE
Review the following values: CustomerFeedback, EnableErrorReporting
 
Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\130
Review the following values: CustomerFeedback, EnableErrorReporting
 
If this is a classified system, and any of the above values are not zero (0), this is a finding.
 
If this is an unclassified system, review the server documentation to determine whether CEIP participation is authorized.
 
If CEIP participation is not authorized, and any of the above values are one (1), this is a finding.</RawString>
    </Rule>
    <Rule id="V-79315" severity="medium" conversionstatus="pass" title="SRG-APP-000516-DB-000363" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the server documentation to determine if auditing of the telemetry data is required. If auditing of telemetry data is not required, this is not a finding.
 
If auditing of telemetry data is required, determine the telemetry service user name by executing the following query:
 
SELECT name
FROM sys.server_principals
WHERE name LIKE '%SQLTELEMETRY%'
 
Review the values of the following registry key:
Note: InstanceId refers to the type and instance of the feature. (e.g., MSSQL13.SqlInstance, MSAS13.SSASInstance, MSRS13.SSRSInstance)
 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\[InstanceId]\CPE\UserRequestedLocalAuditDirectory
 
If the registry key do not exist or the value is blank, this is a finding.
 
Navigate the path defined in the "UserRequestedLocalAuditDirectory" registry key in file explorer.
 
Right-click on the folder and choose "Properties".
Open the "Security" tab.
 
Verify the SQLTELEMETRY account has the following permissions:
 
- List folder contents
- Read
- Write
 
If the permissions are not set properly on the folder, this is a finding.
 
Open services.msc and find the telemetry service.
- For Database Engine, use SQL Server CEIP service (&lt;INSTANCENAME&gt;).
- For Analysis Services, use SQL Server Analysis Services CEIP (&lt;INSTANCENAME&gt;).
 
Right-click on the service and choose "Properties". Verify the "Startup type" is "Automatic."
 
If the service is not configured to automatically start, this is a finding.
 
Review the processes and procedures for reviewing the telemetry data. If there is evidence that the telemetry data is periodically reviewed in accordance with the processes and procedures, this is not a finding.
 
If no processes and procedures exist for reviewing telemetry data, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79319" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000092 Duplicate" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Verify the SQL Server default [sa] (system administrator) account name has been changed by executing the following query:

USE master;
GO
SELECT *
FROM sys.sql_logins
WHERE [name] = 'sa' OR [principal_id] = 1;
GO

If the login account name "SA" or "sa" appears in the query output, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79321" severity="medium" conversionstatus="pass" title="SRG-APP-000342-DB-000302" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to obtain a listing of documented stored procedures used by SQL Server during start up. Execute the following query:

Select [name] as StoredProc
From sys.procedures
Where OBJECTPROPERTY(OBJECT_ID, 'ExecIsStartup') = 1

If any stored procedures are returned that are not documented, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79323" severity="medium" conversionstatus="pass" title="SRG-APP-000516-DB-000363" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>If the data owner does not have a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process, and the requirement is documented and authorized, this is not a finding.

If Database Mirroring is in use, run the following to check for encrypted transmissions:  

SELECT name, type_desc, encryption_algorithm_desc
FROM sys.database_mirroring_endpoints
WHERE encryption_algorithm != 2

If any records are returned, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79325" severity="medium" conversionstatus="pass" title="SRG-APP-000516-DB-000363" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>If the data owner does not have a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process, and the requirement is documented and authorized, this is not a finding.

If SQL Service Broker is in use, run the following to check for encrypted transmissions:  

SELECT name, type_desc, encryption_algorithm_desc
FROM sys.service_broker_endpoints
WHERE encryption_algorithm != 2

If any records are returned, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79327" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Registry extended stored procedures allow Microsoft SQL Server to read, write, and enumerate values and keys in the registry. They are used by Enterprise Manager to configure the server. This rule checks that the permissions to execute registry extended stored procedures have been revoked from all users (other than dbo).

SELECT OBJECT_NAME(major_id) AS [Stored Procedure]
 ,dpr.NAME AS [Principal]
FROM sys.database_permissions AS dp
INNER JOIN sys.database_principals AS dpr ON dp.grantee_principal_id = dpr.principal_id
WHERE major_id IN (
  OBJECT_ID('xp_regaddmultistring')
  ,OBJECT_ID('xp_regdeletekey')
  ,OBJECT_ID('xp_regdeletevalue')
  ,OBJECT_ID('xp_regenumvalues')
  ,OBJECT_ID('xp_regenumkeys')
  ,OBJECT_ID('xp_regread')
  ,OBJECT_ID('xp_regremovemultistring')
  ,OBJECT_ID('xp_regwrite')
  ,OBJECT_ID('xp_instance_regaddmultistring')
  ,OBJECT_ID('xp_instance_regdeletekey')
  ,OBJECT_ID('xp_instance_regdeletevalue')
  ,OBJECT_ID('xp_instance_regenumkeys')
  ,OBJECT_ID('xp_instance_regenumvalues')
  ,OBJECT_ID('xp_instance_regread')
  ,OBJECT_ID('xp_instance_regremovemultistring')
  ,OBJECT_ID('xp_instance_regwrite')
  )
 AND dp.[type] = 'EX'
ORDER BY dpr.NAME;

If any records are returned, review the system documentation to determine whether the accessing of the registry via  extended stored procedures are required and authorized. If it is not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79329" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to see if FileStream is in use.  If in use authorized, this is not a finding.  

If FileStream is not documented as being authorized, execute the following query.

DECLARE @EnableLevel INT
EXEC master.dbo.Xp_instance_regread
  N'HKEY_LOCAL_MACHINE',
  N'Software\Microsoft\MSSQLServer\MSSQLServer\Filestream',
  N'EnableLevel',
  @EnableLevel output
SELECT CASE
         WHEN @EnableLevel = 0 THEN 'No'
   ELSE 'Yes'
       END AS FileStreamEnabled;

If the above query returns "Yes" in the "FileStreamEnabled" field, this is a finding.

This rule checks that Filestream SQL specific option is disabled.

SELECT CASE
         WHEN EXISTS (SELECT *
                      FROM sys.configurations
                      WHERE Name = 'filestream access level'
                             AND Cast(value AS INT) = 0) THEN 'No'
         ELSE 'Yes'
       END AS TSQLFileStreamAccess;

If the above query returns "Yes" in the "FileStreamEnabled" field, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79331" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review the system documentation to see if FileStream is in use.  If the use of Filestream is documented and authorized, execute the following query.

DECLARE @EnableLevel INT;
EXEC master.dbo.Xp_instance_regread
  N'HKEY_LOCAL_MACHINE',
  N'Software\Microsoft\MSSQLServer\MSSQLServer\Filestream',
  N'EnableLevel',
  @EnableLevel output;

DECLARE @SqlSetting INT;
SELECT @SqlSetting = CONVERT(INT, value)
FROM   sys.configurations
WHERE  NAME = 'filestream access level';

SELECT CASE WHEN @SqlSetting = @EnableLevel THEN 'No' ELSE 'Yes' END AS [RegistrySettingsAreDifferent]

If the "RegistrySettingsAreDifferent" field returns a "Yes", this is a finding.</RawString>
    </Rule>
    <Rule id="V-79333" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>To determine if "Ole Automation Procedures" option is enabled, execute the following query:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'Ole Automation Procedures';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of "Ole Automation Procedures" is required and authorized. If it is not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79335" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000092" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>To determine if "User Options" option is enabled, execute the following query:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'user options';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of "user options" is required and authorized. If it is not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79337" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>To determine if "Remote Access" option is enabled, execute the following query:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'remote access';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of "Remote Access" is required (linked servers) and authorized. If it is not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79341" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>To determine if "Hadoop Connectivity" option is enabled, execute the following query:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'hadoop connectivity';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of "Hadoop Connectivity" option is required and authorized. If it is not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79343" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>To determine if "Allow Polybase Export" option is enabled, execute the following query:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'allow polybase export';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of "Allow Polybase Export" is required and authorized. If it is not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79345" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000093" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>To determine if "Remote Data Archive" option is enabled, execute the following query:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'remote data archive';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of "Remote Data Archive" is required and authorized. If it is not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79347" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000092" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>To determine if "External Scripts Enabled" option is enabled, execute the following query:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'external scripts enabled';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of "External Scripts Enabled" is required and authorized. If it is not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79349" severity="low" conversionstatus="pass" title="SRG-APP-000516-DB-000363" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>If the need for the SQL Server Browser service is documented and authorized, this is not a finding.

Open the Services tool.

Either navigate, via the Windows Start Menu and/or Control Panel, to "Administrative Tools", and select "Services"; or at a command prompt, type "services.msc" and press the "Enter" key.

Scroll to "SQL Server Browser".

If its Startup Type is not shown as "Disabled", this is a finding.</RawString>
    </Rule>
    <Rule id="V-79351" severity="medium" conversionstatus="pass" title="SRG-APP-000141-DB-000092" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>To determine if the "Replication Xps" option is enabled, execute the following query:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'replication xps';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of "Replication Xps" is required and authorized. If it is not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79353" severity="low" conversionstatus="pass" title="SRG-APP-000516-DB-000363" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>If the need for the SQL Server Browser service is documented and authorized, check to make sure the SQL Instances are hidden with the following query.

DECLARE @HiddenInstance INT
EXEC master.dbo.Xp_instance_regread
  N'HKEY_LOCAL_MACHINE',
  N'Software\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib',
  N'HideInstance',
  @HiddenInstance output

SELECT CASE
         WHEN @HiddenInstance = 0
              AND Serverproperty('IsClustered') = 0 THEN 'No'
         ELSE 'Yes'
       END AS [Hidden]

If the value of "Hidden" is "Yes", this is not a finding.

If the value of "Hidden" is "No" and the startup type of the "SQL Server Browser" service is not "Disabled", this is a finding.</RawString>
    </Rule>
    <Rule id="V-79355" severity="high" conversionstatus="pass" title="SRG-APP-000178-DB-000083" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Run this query to determine whether SQL Server authentication is enabled:
EXEC master.sys.xp_loginconfig 'login mode';

If the config_value returned is "Windows NT Authentication", this is not a finding.

For SQLCMD, which cannot be configured not to accept a plain-text password, and any other essential tool with the same limitation, verify that the system documentation explains the need for the tool, who uses it, and any relevant mitigations; and that AO approval has been obtained; if not, this is a finding.

Request evidence that all users of the tool are trained in the importance of not using the plain-text password option and in how to keep the password hidden; and that they adhere to this practice; if not, this is a finding.</RawString>
    </Rule>
  </DocumentRule>
  <ManualRule dscresourcemodule="None">
    <Rule id="V-79129" severity="high" conversionstatus="pass" title="SRG-APP-000080-DB-000063" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Execute the following query to list permissions granted to NT AUTHORITY\SYSTEM (SYSTEM):
EXECUTE AS LOGIN = 'NT AUTHORITY\SYSTEM'
SELECT * FROM fn_my_permissions(NULL,NULL)
REVERT
If any permissions have been granted to SYSTEM beyond "CONNECT SQL" and "VIEW ANY DATABASE", this is a finding.</RawString>
    </Rule>
    <Rule id="V-79131" severity="medium" conversionstatus="pass" title="SRG-APP-000080-DB-000063" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Execute the following query:

SELECT name
FROM sys.server_principals
WHERE type in ('U','G')
AND name LIKE '%$'

If no logins are returned, this is not a finding.

If logins are returned, determine whether each login is a computer account.

Launch PowerShell.

Execute the following code:

Note: &lt;name&gt; represents the username portion of the login. For example, if the login is "CONTOSO\user1$", the username is "user1".

([ADSISearcher]"(&amp;(!ObjectCategory=Computer)(Name=&lt;name&gt;))").FindAll()

If no account information is returned, this is not a finding.

If account information is returned, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79151" severity="medium" conversionstatus="pass" title="SRG-APP-000118-DB-000059" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Obtain the SQL Server audit file location(s) by running the following SQL script:
 
SELECT log_file_path AS "Audit Path"
FROM sys.server_file_audits
 
For each audit, the path column will give the location of the file.
 
Verify that all audit files have the correct permissions by doing the following for each audit file: Navigate to audit folder location(s) using a command prompt or Windows Explorer.
 
Right-click the file/folder and click "Properties". On the "Security" tab, verify that at most the following permissions are applied:
 
Administrator (read)
Users (none)
Audit Administrator (Full Control)
Auditors group (Read)
SQL Server Service SID OR Service Account (Full Control) [Notes 1, 2]
SQL Server SQL Agent Service SID OR Service Account, if SQL Server Agent is in use. (Read, Execute, Write)
 
If any less restrictive permissions are present (and not specifically justified and approved), this is a finding.</RawString>
    </Rule>
    <Rule id="V-79153" severity="medium" conversionstatus="pass" title="SRG-APP-000119-DB-000060" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Obtain the SQL Server audit file location(s) by running the following SQL script:
 
SELECT log_file_path AS "Audit Path"
FROM sys.server_file_audits
 
For each audit, the Audit Path column will give the location of the file.
 
Verify that all audit files have the correct permissions by doing the following for each audit file: Navigate to audit folder location(s) using a command prompt or Windows Explorer. The following instructions assume Windows Explorer is used.
 
Right-click the file/folder and click "Properties". On the "Security" tab, verify that at most the following permissions are applied:
 
Administrator (read)
Users (none)
Audit Administrator (Full Control)
Auditors group (Read)
SQL Server Service SID OR Service Account (Full Control) [Notes 1, 2]
SQL Server SQL Agent Service SID OR Service Account, if SQL Server Agent is in use. (Read, Execute, Write)
 
If any less restrictive permissions are present (and not specifically justified and approved), this is a finding.</RawString>
    </Rule>
    <Rule id="V-79155" severity="medium" conversionstatus="pass" title="SRG-APP-000120-DB-000061" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Obtain the SQL Server audit file location(s) by running the following SQL script:
 
SELECT log_file_path AS "Audit Path"
FROM sys.server_file_audits
 
For each audit, the path column will give the location of the file.
 
Verify that all audit files have the correct permissions by doing the following for each audit file: Navigate to audit folder location(s) using a command prompt or Windows Explorer.
 
Right-click the file/folder and click "Properties". On the "Security" tab, verify that at most the following permissions are applied:
 
Administrator (read)
Users (none)
Audit Administrator (Full Control)
Auditors group (Read)
SQL Server Service SID OR Service Account (Full Control)
SQL Server SQL Agent Service SID OR Service Account, if SQL Server Agent is in use. (Read, Execute, Write)
 
If any less restrictive permissions are present (and not specifically justified and approved), this is a finding.</RawString>
    </Rule>
    <Rule id="V-79169" severity="medium" conversionstatus="pass" title="SRG-APP-000133-DB-000199" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine the directory in which SQL Server has been installed:

Using SQL Server Management Studio's Object Explorer:
- Right-click [SQL Server Instance]
- Select "Facets"
- Record the value of RootDirectory

Determine the Operating System directory:
- Click "Start"
- Type "Run"
- Press "Enter"
- Type "%windir%"
- Click "Ok"
- Record the value in the address bar

Verify the SQL Server RootDirectory is not in the Operating System directory.

Compare the SQL RootDirectory and the Operating System directory. If the SQL RootDirectory is in the same directory as the Operating System, this is a finding.

Verify the SQL Server RootDirectory is not in another application's directory.

Navigate to the SQL RootDirectory using Windows Explorer.

Examine each directory for evidence another application is stored in it.

If evidence exists the SQL RootDirectory is in another application's directory, this is a finding.

If the SQL RootDirectory is not in the Operating System directory or another application's directory. This is not a finding.

Examples:
1) The Operating System directory is "C:\Windows". The SQL RootDirectory is "D:\Program Files\MSSQLSERVER\MSSQL". The MSSQLSERVER directory is not living in the Operating System directory or the directory of another application. This is not a finding.

2) The Operating System directory is "C:\Windows". The SQL RootDirectory is "C:\Windows\MSSQLSERVER\MSSQL". This is a finding.

3) The Operating System directory is "C:\Windows". The SQL RootDirectory is "D:\Program Files\Microsoft Office\MSSQLSERVER\MSSQL". The MSSQLSERVER directory is in the Microsoft Office directory, which indicates Microsoft Office is installed here. This is a finding.</RawString>
    </Rule>
    <Rule id="V-79185" severity="medium" conversionstatus="pass" title="SRG-APP-000142-DB-000094" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>To determine the protocol(s) enabled for SQL Server, open SQL Server Configuration Manager. In the left-hand pane, expand SQL Server Network Configuration. Click on the entry for the SQL Server instance under review: "Protocols for ". The right-hand pane displays the protocols enabled for the instance.
 
If Named Pipes is enabled and not specifically required and authorized, this is a finding.
 
If any listed protocol is enabled but not authorized, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79189" severity="medium" conversionstatus="pass" title="SRG-APP-000148-DB-000103" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review SQL Server users to determine whether shared accounts exist. (This does not include the case where SQL Server has a guest or public account that is providing access to publicly available information.)
 
If accounts are determined to be shared, determine if individuals are first individually authenticated. Where an application connects to SQL Server using a standard, shared account, ensure that it also captures the individual user identification and passes it to SQL Server.
 
If individuals are not individually authenticated before using the shared account (e.g., by the operating system or possibly by an application making calls to the database), this is a finding.
 
If accounts are determined to be shared, determine if they are directly accessible to end users. If so, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79191" severity="medium" conversionstatus="pass" title="SRG-APP-000164-DB-000401" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>The Database Master Key is an exception to this rule. Its password need not expire. If the Database Master Key is the only object not conforming to "enforce password expiration," this is not a finding.

Check for use of SQL Server Authentication:
 
SELECT CASE SERVERPROPERTY('IsIntegratedSecurityOnly') WHEN 1 THEN 'Windows Authentication' WHEN 0 THEN 'SQL Server Authentication' END as [Authentication Mode]
 
SQL Server should be configured to inherit password complexity and password lifetime rules from the operating system.
 
If SQL Server Authentication is enabled and "enforce password policy" and "enforce password expiration" is not employed, this is a finding.

Risk must be accepted by the ISSO/ISSM.
 
Review SQL Server to ensure logins are created with respect to the complexity settings. Ensure SQL Logins meet the required settings:
 
SELECT * FROM sys.sql_logins WHERE is_policy_checked &lt;&gt; 1 OR is_expiration_checked &lt;&gt; 1
 
If any records are returned, this is a finding.
 
Review the Operating System settings relating to password complexity.
 
Determine whether the following rules are enforced. If any are not, this is a finding.
 
Check the server operating system for password complexity:
Navigate to Start &gt;&gt; All Programs &gt;&gt; Administrative Tools &gt;&gt; Local Security Policy and to review the local policies on the machine. Account Policy &gt;&gt; Password Policy:
 
Ensure the DISA Windows Password Policy is set on the SQL Server member server.</RawString>
    </Rule>
    <Rule id="V-79195" severity="high" conversionstatus="pass" title="SRG-APP-000172-DB-000075" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>From a command prompt, open SQL Server Configuration Manager by typing "sqlservermanager13.msc", and pressing "ENTER".
 
Navigate to SQL Server Configuration Manager &gt;&gt; SQL Server Network Configuration. Right-click on Protocols for, where is a placeholder for the SQL Server instance name, and click on "Properties".
 
On the "Flags" tab, if "Force Encryption" is set to "NO", this is a finding.
 
On the "Flags" tab, if "Force Encryption" is set to "YES", examine the certificate used on the "Certificate" tab.
 
If it is not a DoD certificate, or if no certificate is listed, this is a finding.
 
A number of known vulnerabilities has been reported against SSL and earlier versions of TLS which has changed the security guidance to move to TLS 1.2 for support secure communication. Check to see if SSL is still in use instead of TLS 1.2, if so, this is a CAT II finding.</RawString>
    </Rule>
    <Rule id="V-79207" severity="medium" conversionstatus="pass" title="SRG-APP-000231-DB-000154" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review procedures for, and evidence of backup of, the Server Service Master Key in the System Security Plan.
 
If the procedures or evidence does not exist, this is a finding.
 
If the procedures do not indicate offline and off-site storage of the Service Master Key, this is a finding.
 
If procedures do not indicate access restrictions to the Service Master Key backup, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79209" severity="medium" conversionstatus="pass" title="SRG-APP-000231-DB-000154" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>If the application owner and Authorizing Official have determined that encryption of data at rest is not required, this is not a finding.
 
Review procedures for, and evidence of backup of, the Master Key in the System Security Plan.
 
If the procedures or evidence does not exist, this is a finding.
 
If the procedures do not indicate offline and off-site storage of the Master Key, this is a finding.
 
If procedures do not indicate access restrictions to the Master Key backup, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79217" severity="medium" conversionstatus="pass" title="SRG-APP-000267-DB-000163" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Error messages within applications, custom database code (stored procedures, triggers) must be enforced by guidelines and code reviews practices.

SQL Server generates certain system events and user-defined events to the SQL Server error log. The SQL Server error log can be viewed using SQL Server Management Studio GUI. All users granted the security admin or sysadmin level of permission are able to view the logs. Review the users returned in the following script:

USE master
GO
SELECT Name
FROM syslogins
WHERE (sysadmin = 1 or securityadmin = 1)
and hasaccess = 1;

If any non-authorized users have access to the SQL Server Error Log located at Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG, this is a finding.

In addition, the SQL Server Error Log is also located at Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG\. Review the permissions on this folder to ensure that only authorized users are listed.

If any non-authorized users have access to the SQL Server Error Log in SQL Server Management Studio, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79229" severity="medium" conversionstatus="pass" title="SRG-APP-000359-DB-000319" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>The operating system and SQL Server offer a number of methods for checking the drive or volume free space. Locate the destination drive where SQL Audits are stored and review system configuration.
 
If no alert exist to notify support staff in the event the SQL Audit drive reaches 75%, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79249" severity="medium" conversionstatus="pass" title="SRG-APP-000456-DB-000390" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Obtain evidence that software patches are consistently applied to SQL Server within the time frame defined for each patch. To be considered supported, Microsoft must report that the version is supported by security patches to known vulnerability. Review the Support dates at: https://support.microsoft.com/en-us/lifecycle?C2=1044
 
Check the SQL Server Version by running the following script: Print @@version
 
If the SQL Server version is not shown as supported, this is a finding.
 
If such evidence cannot be obtained, or the evidence that is obtained indicates a pattern of noncompliance, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79251" severity="medium" conversionstatus="pass" title="SRG-APP-000492-DB-000332" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query.

SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status

If no records are returned, this is a finding.

If the auditing the retrieval of privilege/permission/role membership information is required, execute the following query to verify the SCHEMA_OBJECT_ACCESS_GROUP is included in the server audit specification.

SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP'

If the "SCHEMA_OBJECT_ACCESS_GROUP" is not returned in an active audit, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79303" severity="medium" conversionstatus="pass" title="SRG-APP-000508-DB-000358" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine whether any Server Audits are configured to filter records. From SQL Server Management Studio execute the following query:
 
SELECT name AS AuditName, predicate AS AuditFilter
FROM sys.server_audits
WHERE predicate IS NOT NULL
 
If any audits are returned, review the associated filters to determine whether administrative activities are being excluded.
 
If any audits are configured to exclude administrative activities, this is a finding.</RawString>
    </Rule>
    <Rule id="V-79357" severity="high" conversionstatus="pass" title="SRG-APP-000178-DB-000083" dscresource="None">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine whether any applications that access the database allow for entry of the account name and password, or PIN.

If any do, determine whether these applications obfuscate authentication data; if they do not, this is a finding.</RawString>
    </Rule>
  </ManualRule>
  <SecurityOptionRule dscresourcemodule="SecurityPolicyDsc">
    <Rule id="V-79197" severity="low" conversionstatus="pass" title="SRG-APP-000176-DB-000068" dscresource="SecurityOption">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OptionName>System_cryptography_Use_FIPS_compliant_algorithms_for_encryption_hashing_and_signing</OptionName>
      <OptionValue>Enabled</OptionValue>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Review system configuration to determine whether FIPS 140-2 support has been enabled.
 
Start &gt;&gt; Control Panel &gt;&gt; Administrative Tools &gt;&gt; Local Security Policy &gt;&gt; Local Policies &gt;&gt; Security Options
 
Ensure that "System cryptography: Use FIPS-compliant algorithms for encryption, hashing, and signing" is enabled.

If "System cryptography: Use FIPS-compliant algorithms for encryption, hashing, and signing" is not enabled, this is a finding.
 
For more information, see https://support.microsoft.com/en-us/kb/3141890.</RawString>
    </Rule>
    <Rule id="V-79199" severity="medium" conversionstatus="pass" title="SRG-APP-000179-DB-000114" dscresource="SecurityOption">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OptionName>System_cryptography_Use_FIPS_compliant_algorithms_for_encryption_hashing_and_signing</OptionName>
      <OptionValue>Enabled</OptionValue>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>In Windows, open Administrative Tools &gt;&gt; Local Security Policy. Expand Local Policies &gt;&gt; Security Options. In the right-side pane, find "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing."
 
If, in the "Security Setting" column, the value is "Disabled," this is a finding.
 
https://support.microsoft.com/en-us/kb/955720</RawString>
    </Rule>
    <Rule id="V-79203" severity="medium" conversionstatus="pass" title="SRG-APP-000224-DB-000384" dscresource="SecurityOption">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OptionName>System_cryptography_Use_FIPS_compliant_algorithms_for_encryption_hashing_and_signing</OptionName>
      <OptionValue>Enabled</OptionValue>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Verify that Windows is configured to require the use of FIPS compliant algorithms.
 
Click Start &gt;&gt; Type "Local Security Policy" &gt;&gt; Press Enter &gt;&gt; Expand "Local Policies" &gt;&gt; Select "Security Options" &gt;&gt; Locate "System Cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing."
 
If the Security Setting for this option is "Disabled", this is a finding.</RawString>
    </Rule>
    <Rule id="V-79305" severity="high" conversionstatus="pass" title="SRG-APP-000514-DB-000381" dscresource="SecurityOption">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OptionName>System_cryptography_Use_FIPS_compliant_algorithms_for_encryption_hashing_and_signing</OptionName>
      <OptionValue>Enabled</OptionValue>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Verify that Windows is configured to require the use of FIPS compliant algorithms.
 
Click Start &gt;&gt; Type "Local Security Policy" &gt;&gt; Press Enter &gt;&gt; Expand "Local Policies" &gt;&gt; Select "Security Options" &gt;&gt; Locate "System Cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing."
 
If the Security Setting for this option is "Disabled" this is a finding.</RawString>
    </Rule>
    <Rule id="V-79307" severity="high" conversionstatus="pass" title="SRG-APP-000514-DB-000382" dscresource="SecurityOption">
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OptionName>System_cryptography_Use_FIPS_compliant_algorithms_for_encryption_hashing_and_signing</OptionName>
      <OptionValue>Enabled</OptionValue>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Verify that Windows is configured to require the use of FIPS 140-2 algorithms.

Click Start &gt;&gt; Type "Local Security Policy" &gt;&gt; Press Enter &gt;&gt; Expand "Local Policies" &gt;&gt; Select "Security Options" &gt;&gt; Locate "System Cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing."

If "System Cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing" is not enabled, this is a finding.</RawString>
    </Rule>
  </SecurityOptionRule>
  <SqlScriptQueryRule dscresourcemodule="SqlServerDsc">
    <Rule id="V-79141" severity="medium" conversionstatus="pass" title="SRG-APP-000092-DB-000208" dscresource="SqlScriptQuery">
      <GetScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES () /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</GetScript>
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>When Audits are enabled, they start up when the instance starts.
https://msdn.microsoft.com/en-us/library/cc280386.aspx#Anchor_2
 
Check if an audit is configured and enabled.
 
Execute the following query:
 
SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
WHERE status_desc = 'STARTED'
 
All currently defined audits for the SQL server instance will be listed. If no audits are returned, this is a finding.</RawString>
      <SetScript>/* See STIG supplemental files for the annotated version of this script */ USE [master] IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') ALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') DROP SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION; IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') DROP SERVER AUDIT STIG_AUDIT; CREATE SERVER AUDIT STIG_AUDIT TO FILE (FILEPATH = 'C:\Audits', MAXSIZE = 200MB, MAX_ROLLOVER_FILES = 50, RESERVE_DISK_SPACE = OFF) WITH (QUEUE_DELAY = 1000, ON_FAILURE = SHUTDOWN) IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = ON); CREATE SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION FOR SERVER AUDIT STIG_AUDIT ADD (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP), ADD (AUDIT_CHANGE_GROUP), ADD (BACKUP_RESTORE_GROUP), ADD (DATABASE_CHANGE_GROUP), ADD (DATABASE_OBJECT_CHANGE_GROUP), ADD (DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_OBJECT_PERMISSION_CHANGE_GROUP), ADD (DATABASE_OPERATION_GROUP), ADD (DATABASE_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_PERMISSION_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_IMPERSONATION_GROUP), ADD (DATABASE_ROLE_MEMBER_CHANGE_GROUP), ADD (DBCC_GROUP), ADD (FAILED_LOGIN_GROUP), ADD (LOGIN_CHANGE_PASSWORD_GROUP), ADD (LOGOUT_GROUP), ADD (SCHEMA_OBJECT_CHANGE_GROUP), ADD (SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OBJECT_CHANGE_GROUP), ADD (SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SERVER_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OPERATION_GROUP), ADD (SERVER_PERMISSION_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_IMPERSONATION_GROUP), ADD (SERVER_ROLE_MEMBER_CHANGE_GROUP), ADD (SERVER_STATE_CHANGE_GROUP), ADD (SUCCESSFUL_LOGIN_GROUP), ADD (TRACE_CHANGE_GROUP) WITH (STATE = ON); GO </SetScript>
      <TestScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES () /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</TestScript>
    </Rule>
    <Rule id="V-79239" severity="medium" conversionstatus="pass" title="SRG-APP-000381-DB-000361" dscresource="SqlScriptQuery">
      <GetScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP),(AUDIT_CHANGE_GROUP),(BACKUP_RESTORE_GROUP),(DATABASE_CHANGE_GROUP),(DATABASE_OBJECT_ACCESS_GROUP),(DATABASE_OBJECT_CHANGE_GROUP),(DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP),(DATABASE_OBJECT_PERMISSION_CHANGE_GROUP),(DATABASE_OWNERSHIP_CHANGE_GROUP),(DATABASE_OPERATION_GROUP),(DATABASE_OWNERSHIP_CHANGE_GROUP),(DATABASE_PERMISSION_CHANGE_GROUP),(DATABASE_PRINCIPAL_CHANGE_GROUP),(DATABASE_PRINCIPAL_IMPERSONATION_GROUP),(DATABASE_ROLE_MEMBER_CHANGE_GROUP),(DBCC_GROUP),(LOGIN_CHANGE_PASSWORD_GROUP),(SCHEMA_OBJECT_CHANGE_GROUP),(SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP),(SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OBJECT_CHANGE_GROUP),(SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP),(SERVER_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OPERATION_GROUP),(SERVER_PERMISSION_CHANGE_GROUP),(SERVER_PRINCIPAL_IMPERSONATION_GROUP),(SERVER_ROLE_MEMBER_CHANGE_GROUP),(SERVER_STATE_CHANGE_GROUP),(TRACE_CHANGE_GROUP) /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</GetScript>
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured to capture denied actions and started by executing the following query:
 
SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
If no records are returned, this is a finding.
 
Execute the following query to verify the following events are included in the server audit specification:
 
APPLICATION_ROLE_CHANGE_PASSWORD_GROUP,
AUDIT_CHANGE_GROUP,
BACKUP_RESTORE_GROUP,
DATABASE_CHANGE_GROUP,
DATABASE_OBJECT_ACCESS_GROUP,
DATABASE_OBJECT_CHANGE_GROUP,
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP,
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP,
DATABASE_OWNERSHIP_CHANGE_GROUP,
DATABASE_OPERATION_GROUP,
DATABASE_OWNERSHIP_CHANGE_GROUP,
DATABASE_PERMISSION_CHANGE_GROUP,
DATABASE_PRINCIPAL_CHANGE_GROUP,
DATABASE_PRINCIPAL_IMPERSONATION_GROUP,
DATABASE_ROLE_MEMBER_CHANGE_GROUP,
DBCC_GROUP,
LOGIN_CHANGE_PASSWORD_GROUP,
SCHEMA_OBJECT_CHANGE_GROUP,
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP,
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP,
SERVER_OBJECT_CHANGE_GROUP,
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP,
SERVER_OBJECT_PERMISSION_CHANGE_GROUP,
SERVER_OPERATION_GROUP,
SERVER_PERMISSION_CHANGE_GROUP,
SERVER_PRINCIPAL_IMPERSONATION_GROUP,
SERVER_ROLE_MEMBER_CHANGE_GROUP,
SERVER_STATE_CHANGE_GROUP,
TRACE_CHANGE_GROUP
 
SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1
AND d.audit_action_name IN (
'APPLICATION_ROLE_CHANGE_PASSWORD_GROUP',
'AUDIT_CHANGE_GROUP',
'BACKUP_RESTORE_GROUP',
'DATABASE_CHANGE_GROUP',
'DATABASE_OBJECT_ACCESS_GROUP',
'DATABASE_OBJECT_CHANGE_GROUP',
'DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP',
'DATABASE_OBJECT_PERMISSION_CHANGE_GROUP',
'DATABASE_OWNERSHIP_CHANGE_GROUP',
'DATABASE_OPERATION_GROUP',
'DATABASE_OWNERSHIP_CHANGE_GROUP',
'DATABASE_PERMISSION_CHANGE_GROUP',
'DATABASE_PRINCIPAL_CHANGE_GROUP',
'DATABASE_PRINCIPAL_IMPERSONATION_GROUP',
'DATABASE_ROLE_MEMBER_CHANGE_GROUP',
'DBCC_GROUP',
'LOGIN_CHANGE_PASSWORD_GROUP',
'SCHEMA_OBJECT_CHANGE_GROUP',
'SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP',
'SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP',
'SERVER_OBJECT_CHANGE_GROUP',
'SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP',
'SERVER_OBJECT_PERMISSION_CHANGE_GROUP',
'SERVER_OPERATION_GROUP',
'SERVER_PERMISSION_CHANGE_GROUP',
'SERVER_PRINCIPAL_IMPERSONATION_GROUP',
'SERVER_ROLE_MEMBER_CHANGE_GROUP',
'SERVER_STATE_CHANGE_GROUP'
)
 
If the identified groups are not returned, this is a finding.</RawString>
      <SetScript>/* See STIG supplemental files for the annotated version of this script */ USE [master] IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') ALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') DROP SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION; IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') DROP SERVER AUDIT STIG_AUDIT; CREATE SERVER AUDIT STIG_AUDIT TO FILE (FILEPATH = 'C:\Audits', MAXSIZE = 200MB, MAX_ROLLOVER_FILES = 50, RESERVE_DISK_SPACE = OFF) WITH (QUEUE_DELAY = 1000, ON_FAILURE = SHUTDOWN) IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = ON); CREATE SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION FOR SERVER AUDIT STIG_AUDIT ADD (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP), ADD (AUDIT_CHANGE_GROUP), ADD (BACKUP_RESTORE_GROUP), ADD (DATABASE_CHANGE_GROUP), ADD (DATABASE_OBJECT_CHANGE_GROUP), ADD (DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_OBJECT_PERMISSION_CHANGE_GROUP), ADD (DATABASE_OPERATION_GROUP), ADD (DATABASE_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_PERMISSION_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_IMPERSONATION_GROUP), ADD (DATABASE_ROLE_MEMBER_CHANGE_GROUP), ADD (DBCC_GROUP), ADD (FAILED_LOGIN_GROUP), ADD (LOGIN_CHANGE_PASSWORD_GROUP), ADD (LOGOUT_GROUP), ADD (SCHEMA_OBJECT_CHANGE_GROUP), ADD (SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OBJECT_CHANGE_GROUP), ADD (SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SERVER_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OPERATION_GROUP), ADD (SERVER_PERMISSION_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_IMPERSONATION_GROUP), ADD (SERVER_ROLE_MEMBER_CHANGE_GROUP), ADD (SERVER_STATE_CHANGE_GROUP), ADD (SUCCESSFUL_LOGIN_GROUP), ADD (TRACE_CHANGE_GROUP) WITH (STATE = ON); GO </SetScript>
      <TestScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP),(AUDIT_CHANGE_GROUP),(BACKUP_RESTORE_GROUP),(DATABASE_CHANGE_GROUP),(DATABASE_OBJECT_ACCESS_GROUP),(DATABASE_OBJECT_CHANGE_GROUP),(DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP),(DATABASE_OBJECT_PERMISSION_CHANGE_GROUP),(DATABASE_OWNERSHIP_CHANGE_GROUP),(DATABASE_OPERATION_GROUP),(DATABASE_OWNERSHIP_CHANGE_GROUP),(DATABASE_PERMISSION_CHANGE_GROUP),(DATABASE_PRINCIPAL_CHANGE_GROUP),(DATABASE_PRINCIPAL_IMPERSONATION_GROUP),(DATABASE_ROLE_MEMBER_CHANGE_GROUP),(DBCC_GROUP),(LOGIN_CHANGE_PASSWORD_GROUP),(SCHEMA_OBJECT_CHANGE_GROUP),(SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP),(SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OBJECT_CHANGE_GROUP),(SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP),(SERVER_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OPERATION_GROUP),(SERVER_PERMISSION_CHANGE_GROUP),(SERVER_PRINCIPAL_IMPERSONATION_GROUP),(SERVER_ROLE_MEMBER_CHANGE_GROUP),(SERVER_STATE_CHANGE_GROUP),(TRACE_CHANGE_GROUP) /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</TestScript>
    </Rule>
    <Rule id="V-79259" severity="medium" conversionstatus="pass" title="SRG-APP-000495-DB-000326" dscresource="SqlScriptQuery">
      <GetScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES (DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP),(DATABASE_OBJECT_PERMISSION_CHANGE_GROUP),(DATABASE_OWNERSHIP_CHANGE_GROUP),(DATABASE_PERMISSION_CHANGE_GROUP),(DATABASE_ROLE_MEMBER_CHANGE_GROUP),(SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP),(SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP),(SERVER_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_PERMISSION_CHANGE_GROUP),(SERVER_ROLE_MEMBER_CHANGE_GROUP) /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</GetScript>
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check the SQL Server Audit being used for the STIG compliant audit.
 
If the following events are not included, this is a finding.
 
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
DATABASE_OWNERSHIP_CHANGE_GROUP
DATABASE_PERMISSION_CHANGE_GROUP
DATABASE_ROLE_MEMBER_CHANGE_GROUP
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP
SERVER_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_PERMISSION_CHANGE_GROUP
SERVER_ROLE_MEMBER_CHANGE_GROUP
 
Reference:
https://msdn.microsoft.com/en-us/library/cc280663.aspx</RawString>
      <SetScript>/* See STIG supplemental files for the annotated version of this script */ USE [master] IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') ALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') DROP SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION; IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') DROP SERVER AUDIT STIG_AUDIT; CREATE SERVER AUDIT STIG_AUDIT TO FILE (FILEPATH = 'C:\Audits', MAXSIZE = 200MB, MAX_ROLLOVER_FILES = 50, RESERVE_DISK_SPACE = OFF) WITH (QUEUE_DELAY = 1000, ON_FAILURE = SHUTDOWN) IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = ON); CREATE SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION FOR SERVER AUDIT STIG_AUDIT ADD (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP), ADD (AUDIT_CHANGE_GROUP), ADD (BACKUP_RESTORE_GROUP), ADD (DATABASE_CHANGE_GROUP), ADD (DATABASE_OBJECT_CHANGE_GROUP), ADD (DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_OBJECT_PERMISSION_CHANGE_GROUP), ADD (DATABASE_OPERATION_GROUP), ADD (DATABASE_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_PERMISSION_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_IMPERSONATION_GROUP), ADD (DATABASE_ROLE_MEMBER_CHANGE_GROUP), ADD (DBCC_GROUP), ADD (FAILED_LOGIN_GROUP), ADD (LOGIN_CHANGE_PASSWORD_GROUP), ADD (LOGOUT_GROUP), ADD (SCHEMA_OBJECT_CHANGE_GROUP), ADD (SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OBJECT_CHANGE_GROUP), ADD (SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SERVER_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OPERATION_GROUP), ADD (SERVER_PERMISSION_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_IMPERSONATION_GROUP), ADD (SERVER_ROLE_MEMBER_CHANGE_GROUP), ADD (SERVER_STATE_CHANGE_GROUP), ADD (SUCCESSFUL_LOGIN_GROUP), ADD (TRACE_CHANGE_GROUP) WITH (STATE = ON); GO </SetScript>
      <TestScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES (DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP),(DATABASE_OBJECT_PERMISSION_CHANGE_GROUP),(DATABASE_OWNERSHIP_CHANGE_GROUP),(DATABASE_PERMISSION_CHANGE_GROUP),(DATABASE_ROLE_MEMBER_CHANGE_GROUP),(SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP),(SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP),(SERVER_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_PERMISSION_CHANGE_GROUP),(SERVER_ROLE_MEMBER_CHANGE_GROUP) /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</TestScript>
    </Rule>
    <Rule id="V-79287" severity="medium" conversionstatus="pass" title="SRG-APP-000503-DB-000350" dscresource="SqlScriptQuery">
      <GetScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES (SUCCESSFUL_LOGIN_GROUP) /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</GetScript>
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query.
 
SELECT name AS 'Audit Name',
  status_desc AS 'Audit Status',
  audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status
 
Execute the following query to verify the SUCCESSFUL_LOGIN_GROUP is included in the server audit specification.
 
SELECT a.name AS 'AuditName',
  s.name AS 'SpecName',
 d.audit_action_name AS 'ActionName',
  d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SUCCESSFUL_LOGIN_GROUP'
 
If the "SUCCESSFUL_LOGIN_GROUP" is returned in an active audit, this is not a finding.
 
If "SUCCESSFUL_LOGIN_GROUP" is not in the active audit, determine whether "Both failed and successful logins" is enabled.
 
In SQL Management Studio
Right-click on the instance
&gt;&gt; Select "Properties"
&gt;&gt; Select "Security" on the left hand side
&gt;&gt; Check the setting for "Login auditing"
 
If "Both failed and successful logins" is not selected, this is a finding.</RawString>
      <SetScript>/* See STIG supplemental files for the annotated version of this script */ USE [master] IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') ALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') DROP SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION; IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') DROP SERVER AUDIT STIG_AUDIT; CREATE SERVER AUDIT STIG_AUDIT TO FILE (FILEPATH = 'C:\Audits', MAXSIZE = 200MB, MAX_ROLLOVER_FILES = 50, RESERVE_DISK_SPACE = OFF) WITH (QUEUE_DELAY = 1000, ON_FAILURE = SHUTDOWN) IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = ON); CREATE SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION FOR SERVER AUDIT STIG_AUDIT ADD (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP), ADD (AUDIT_CHANGE_GROUP), ADD (BACKUP_RESTORE_GROUP), ADD (DATABASE_CHANGE_GROUP), ADD (DATABASE_OBJECT_CHANGE_GROUP), ADD (DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_OBJECT_PERMISSION_CHANGE_GROUP), ADD (DATABASE_OPERATION_GROUP), ADD (DATABASE_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_PERMISSION_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_IMPERSONATION_GROUP), ADD (DATABASE_ROLE_MEMBER_CHANGE_GROUP), ADD (DBCC_GROUP), ADD (FAILED_LOGIN_GROUP), ADD (LOGIN_CHANGE_PASSWORD_GROUP), ADD (LOGOUT_GROUP), ADD (SCHEMA_OBJECT_CHANGE_GROUP), ADD (SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OBJECT_CHANGE_GROUP), ADD (SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SERVER_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OPERATION_GROUP), ADD (SERVER_PERMISSION_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_IMPERSONATION_GROUP), ADD (SERVER_ROLE_MEMBER_CHANGE_GROUP), ADD (SERVER_STATE_CHANGE_GROUP), ADD (SUCCESSFUL_LOGIN_GROUP), ADD (TRACE_CHANGE_GROUP) WITH (STATE = ON); GO </SetScript>
      <TestScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES (SUCCESSFUL_LOGIN_GROUP) /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</TestScript>
    </Rule>
    <Rule id="V-79291" severity="medium" conversionstatus="pass" title="SRG-APP-000504-DB-000354" dscresource="SqlScriptQuery">
      <GetScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP),(AUDIT_CHANGE_GROUP),(BACKUP_RESTORE_GROUP),(DATABASE_CHANGE_GROUP),(DATABASE_OBJECT_CHANGE_GROUP),(DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP),(DATABASE_OBJECT_PERMISSION_CHANGE_GROUP),(DATABASE_OPERATION_GROUP),(DATABASE_OWNERSHIP_CHANGE_GROUP),(DATABASE_PERMISSION_CHANGE_GROUP),(DATABASE_PRINCIPAL_CHANGE_GROUP),(DATABASE_PRINCIPAL_IMPERSONATION_GROUP),(DATABASE_ROLE_MEMBER_CHANGE_GROUP),(DBCC_GROUP),(LOGIN_CHANGE_PASSWORD_GROUP),(SCHEMA_OBJECT_CHANGE_GROUP),(SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP),(SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OBJECT_CHANGE_GROUP),(SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP),(SERVER_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OPERATION_GROUP),(SERVER_PERMISSION_CHANGE_GROUP),(SERVER_PRINCIPAL_CHANGE_GROUP),(SERVER_PRINCIPAL_IMPERSONATION_GROUP),(SERVER_ROLE_MEMBER_CHANGE_GROUP),(SERVER_STATE_CHANGE_GROUP),(TRACE_CHANGE_GROUP),(USER_CHANGE_PASSWORD_GROUP) /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</GetScript>
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Determine if an audit is configured and started by executing the following query:

SELECT name AS 'Audit Name',
status_desc AS 'Audit Status',
audit_file_path AS 'Current Audit File'
FROM sys.dm_server_audit_status

If no records are returned, this is a finding.

Execute the following query to verify the following events are included in the server audit specification:

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
AUDIT_CHANGE_GROUP
BACKUP_RESTORE_GROUP
DATABASE_CHANGE_GROUP
DATABASE_OBJECT_CHANGE_GROUP
DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
DATABASE_OPERATION_GROUP
DATABASE_OWNERSHIP_CHANGE_GROUP
DATABASE_PERMISSION_CHANGE_GROUP
DATABASE_PRINCIPAL_CHANGE_GROUP
DATABASE_PRINCIPAL_IMPERSONATION_GROUP
DATABASE_ROLE_MEMBER_CHANGE_GROUP
DBCC_GROUP
LOGIN_CHANGE_PASSWORD_GROUP
SCHEMA_OBJECT_CHANGE_GROUP
SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OBJECT_CHANGE_GROUP
SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP
SERVER_OBJECT_PERMISSION_CHANGE_GROUP
SERVER_OPERATION_GROUP
SERVER_PERMISSION_CHANGE_GROUP
SERVER_PRINCIPAL_CHANGE_GROUP
SERVER_PRINCIPAL_IMPERSONATION_GROUP
SERVER_ROLE_MEMBER_CHANGE_GROUP
SERVER_STATE_CHANGE_GROUP
TRACE_CHANGE_GROUP
USER_CHANGE_PASSWORD_GROUP

SELECT a.name AS 'AuditName',
s.name AS 'SpecName',
d.audit_action_name AS 'ActionName',
d.audited_result AS 'Result'
FROM sys.server_audit_specifications s
JOIN sys.server_audits a ON s.audit_guid = a.audit_guid
JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id
WHERE a.is_state_enabled = 1
AND d.audit_action_name IN ('APPLICATION_ROLE_CHANGE_PASSWORD_GROUP','AUDIT_CHANGE_GROUP','BACKUP_RESTORE_GROUP','DATABASE_CHANGE_GROUP','DATABASE_OBJECT_CHANGE_GROUP','DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP','DATABASE_OBJECT_PERMISSION_CHANGE_GROUP','DATABASE_OPERATION_GROUP','DATABASE_OWNERSHIP_CHANGE_GROUP','DATABASE_PERMISSION_CHANGE_GROUP','DATABASE_PRINCIPAL_CHANGE_GROUP','DATABASE_PRINCIPAL_IMPERSONATION_GROUP','DATABASE_ROLE_MEMBER_CHANGE_GROUP','DBCC_GROUP','LOGIN_CHANGE_PASSWORD_GROUP','SCHEMA_OBJECT_CHANGE_GROUP','SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP','SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP','SERVER_OBJECT_CHANGE_GROUP','SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP','SERVER_OBJECT_PERMISSION_CHANGE_GROUP','SERVER_OPERATION_GROUP','SERVER_PERMISSION_CHANGE_GROUP','SERVER_PRINCIPAL_CHANGE_GROUP','SERVER_PRINCIPAL_IMPERSONATION_GROUP','SERVER_ROLE_MEMBER_CHANGE_GROUP','SERVER_STATE_CHANGE_GROUP','TRACE_CHANGE_GROUP','USER_CHANGE_PASSWORD_GROUP')

If the identified groups are not returned, this is a finding.</RawString>
      <SetScript>/* See STIG supplemental files for the annotated version of this script */ USE [master] IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') ALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audit_specifications WHERE name = 'STIG_AUDIT_SERVER_SPECIFICATION') DROP SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION; IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = OFF); IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') DROP SERVER AUDIT STIG_AUDIT; CREATE SERVER AUDIT STIG_AUDIT TO FILE (FILEPATH = 'C:\Audits', MAXSIZE = 200MB, MAX_ROLLOVER_FILES = 50, RESERVE_DISK_SPACE = OFF) WITH (QUEUE_DELAY = 1000, ON_FAILURE = SHUTDOWN) IF EXISTS (SELECT 1 FROM sys.server_audits WHERE name = 'STIG_AUDIT') ALTER SERVER AUDIT STIG_AUDIT WITH (STATE = ON); CREATE SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION FOR SERVER AUDIT STIG_AUDIT ADD (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP), ADD (AUDIT_CHANGE_GROUP), ADD (BACKUP_RESTORE_GROUP), ADD (DATABASE_CHANGE_GROUP), ADD (DATABASE_OBJECT_CHANGE_GROUP), ADD (DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_OBJECT_PERMISSION_CHANGE_GROUP), ADD (DATABASE_OPERATION_GROUP), ADD (DATABASE_OWNERSHIP_CHANGE_GROUP), ADD (DATABASE_PERMISSION_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_CHANGE_GROUP), ADD (DATABASE_PRINCIPAL_IMPERSONATION_GROUP), ADD (DATABASE_ROLE_MEMBER_CHANGE_GROUP), ADD (DBCC_GROUP), ADD (FAILED_LOGIN_GROUP), ADD (LOGIN_CHANGE_PASSWORD_GROUP), ADD (LOGOUT_GROUP), ADD (SCHEMA_OBJECT_CHANGE_GROUP), ADD (SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OBJECT_CHANGE_GROUP), ADD (SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP), ADD (SERVER_OBJECT_PERMISSION_CHANGE_GROUP), ADD (SERVER_OPERATION_GROUP), ADD (SERVER_PERMISSION_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_CHANGE_GROUP), ADD (SERVER_PRINCIPAL_IMPERSONATION_GROUP), ADD (SERVER_ROLE_MEMBER_CHANGE_GROUP), ADD (SERVER_STATE_CHANGE_GROUP), ADD (SUCCESSFUL_LOGIN_GROUP), ADD (TRACE_CHANGE_GROUP) WITH (STATE = ON); GO </SetScript>
      <TestScript>USE [master] DECLARE @MissingAuditCount INTEGER DECLARE @server_specification_id INTEGER DECLARE @FoundCompliant INTEGER SET @FoundCompliant = 0 /* Create a table for the events that we are looking for */ CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP),(AUDIT_CHANGE_GROUP),(BACKUP_RESTORE_GROUP),(DATABASE_CHANGE_GROUP),(DATABASE_OBJECT_CHANGE_GROUP),(DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP),(DATABASE_OBJECT_PERMISSION_CHANGE_GROUP),(DATABASE_OPERATION_GROUP),(DATABASE_OWNERSHIP_CHANGE_GROUP),(DATABASE_PERMISSION_CHANGE_GROUP),(DATABASE_PRINCIPAL_CHANGE_GROUP),(DATABASE_PRINCIPAL_IMPERSONATION_GROUP),(DATABASE_ROLE_MEMBER_CHANGE_GROUP),(DBCC_GROUP),(LOGIN_CHANGE_PASSWORD_GROUP),(SCHEMA_OBJECT_CHANGE_GROUP),(SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP),(SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OBJECT_CHANGE_GROUP),(SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP),(SERVER_OBJECT_PERMISSION_CHANGE_GROUP),(SERVER_OPERATION_GROUP),(SERVER_PERMISSION_CHANGE_GROUP),(SERVER_PRINCIPAL_CHANGE_GROUP),(SERVER_PRINCIPAL_IMPERSONATION_GROUP),(SERVER_ROLE_MEMBER_CHANGE_GROUP),(SERVER_STATE_CHANGE_GROUP),(TRACE_CHANGE_GROUP),(USER_CHANGE_PASSWORD_GROUP) /* Create a cursor to walk through all audits that are enabled at startup */ DECLARE auditspec_cursor CURSOR FOR SELECT s.server_specification_id FROM sys.server_audits a INNER JOIN sys.server_audit_specifications s ON a.audit_guid = s.audit_guid WHERE a.is_state_enabled = 1; OPEN auditspec_cursor FETCH NEXT FROM auditspec_cursor INTO @server_specification_id WHILE @@FETCH_STATUS = 0 AND @FoundCompliant = 0 /* Does this specification have the needed events in it? */ BEGIN SET @MissingAuditCount = (SELECT Count(a.AuditEvent) AS MissingAuditCount FROM #AuditEvents a JOIN sys.server_audit_specification_details d ON a.AuditEvent = d.audit_action_name WHERE d.audit_action_name NOT IN (SELECT d2.audit_action_name FROM sys.server_audit_specification_details d2 WHERE d2.server_specification_id = @server_specification_id)) IF @MissingAuditCount = 0 SET @FoundCompliant = 1; FETCH NEXT FROM auditspec_cursor INTO @server_specification_id END CLOSE auditspec_cursor; DEALLOCATE auditspec_cursor; DROP TABLE #AuditEvents /* Produce output that works with DSC - records if we do not find the audit events we are looking for */ IF @FoundCompliant &gt; 0 SELECT name FROM sys.sql_logins WHERE principal_id = -1; ELSE SELECT name FROM sys.sql_logins WHERE principal_id = 1</TestScript>
    </Rule>
    <Rule id="V-79317" severity="medium" conversionstatus="pass" title="SRG-APP-000033-DB-000084" dscresource="SqlScriptQuery">
      <GetScript>USE [master] SELECT name, is_disabled FROM sys.sql_logins WHERE principal_id = 1 AND name = 'sa' AND is_disabled &lt;&gt; 1;</GetScript>
      <IsNullOrEmpty>False</IsNullOrEmpty>
      <OrganizationValueRequired>False</OrganizationValueRequired>
      <OrganizationValueTestString />
      <RawString>Check SQL Server settings to determine if the [sa] (system administrator) account has been disabled by executing the following query:

USE master;
GO
SELECT name, is_disabled
FROM sys.sql_logins
WHERE principal_id = 1;
GO

Verify that the "name" column contains the current name of the [sa] database server account (see note).

If the "is_disabled" column is not set to 1, this is a finding.</RawString>
      <SetScript>USE [master] DECLARE @saAccountName varchar(50) SET @saAccountName = (SELECT name FROM sys.sql_logins WHERE principal_id = 1) IF @saAccountName = 'sa' ALTER LOGIN [sa] WITH NAME = [old_sa] SET @saAccountName = 'old_sa' DECLARE @saDisabled int SET @saDisabled = (SELECT is_disabled FROM sys.sql_logins WHERE principal_id = 1) IF @saDisabled &lt;&gt; 1 ALTER LOGIN [@saAccountName] DISABLE;</SetScript>
      <TestScript>USE [master] SELECT name, is_disabled FROM sys.sql_logins WHERE principal_id = 1 AND name = 'sa' AND is_disabled &lt;&gt; 1;</TestScript>
    </Rule>
  </SqlScriptQueryRule>
</DISASTIG>