PowerStig
PowerStig copied to clipboard
Sql server 2016 Instance STIG - V-79141 Issue
Describe the bug After start DSCConfiguration the very first rule cannot be successfully applied
To Reproduce
- Install SQL 2016 on a domain join machine
- apply SQL 2016 Instance STIG
configuration SqlS2016STIG
{
param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullorEmpty()]
[PSCredential]
$Credential,
[parameter()]
[string]
$NodeName = 'SQL2016STIG'
)
Import-DscResource -ModuleName PowerStig
Node $NodeName
{
SqlServer BaseLine
{
SqlVersion = '2016'
SqlRole = 'Instance'
StigVersion = '1.3'
ServerInstance = 'SQL2016STIG'
PsDscRunAsCredential = $Credential
}
}
}
$cd = @{
AllNodes = @(
@{
NodeName = 'SQL2016STIG'
PSDscAllowDomainUser = $true
PSDscAllowPlainTextPassword = $true
}
)
}
$cred = Get-Credential -userName litware\dscRunAs -Message "Password please"
SqlS2016STIG -NodeName SQL2016STIG -credential $cred -ConfigurationData $cd -OutputPath C:\STIG\SQLConfig
Notes: the document should also be updated to specify that a domain account is needed because the default DSC account might not have all permissions to apply all STIGs ... also need to make sure this domain account has enough permission
Expected behavior Expected Test-DscConfiguration return true
Screenshots
Additional context There are 2 issues:
- looking into the mof file, it seems require that C:\Audits folder exists ... without this folder, the set operation cannot be successful - workaround, add File resource to create that folder and make that as dependency of SqlServer STIG resource
- the Get and Test operation has the following SQL statement which will not work: - there is no values provided in the insert statement.
CREATE TABLE #AuditEvents (AuditEvent varchar(100)) INSERT INTO #AuditEvents (AuditEvent) VALUES ()