|
function Cis-Ubuntu20-Section-4 {
|
|
[CmdletBinding()]
|
|
param (
|
|
[parameter(Mandatory = $true)]
|
|
[string]$reportId,
|
|
[parameter(Mandatory = $true)]
|
|
[string]$techniqueName,
|
|
|
|
[Rudder.PolicyMode]$policyMode
|
|
)
|
|
$techniqueParams = @{
|
|
|
|
}
|
|
BeginTechniqueCall -Name $techniqueName -Parameters $techniqueParams
|
|
$reportIdBase = $reportId.Substring(0, $reportId.Length - 1)
|
|
$localContext = New-Object -TypeName "Rudder.Context" -ArgumentList @($techniqueName)
|
|
$localContext.Merge($system_classes)
|
|
|
|
|
|
|
|
$reportId=$reportIdBase + "dd338ca5-d855-48bd-800d-c3b8c9979907"
|
|
$componentKey = "cron"
|
|
$reportParams = @{
|
|
ClassPrefix = ([Rudder.Condition]::canonify(("service_enabled_" + $componentKey)))
|
|
ComponentKey = $componentKey
|
|
ComponentName = "Ensure cron daemon is enabled"
|
|
PolicyMode = $policyMode
|
|
ReportId = $reportId
|
|
DisableReporting = false
|
|
TechniqueName = $techniqueName
|
|
}
|
|
|
|
$class = ""true""
|
|
if ($localContext.Evaluate($class)) {
|
|
$methodParams = @{
|
|
Name = "cron"
|
|
|
|
}
|
|
$call = ServiceEnabled $methodParams -PolicyMode $policyMode
|
|
$methodContext = Compute-Method-Call @reportParams -MethodCall $call
|
|
$localContext.merge($methodContext)
|
|
} else {
|
|
Rudder-Report-NA @reportParams
|
|
}
|
|
|
|
$reportId=$reportIdBase + "b65c6217-ee97-4a40-ade8-7d291423087e"
|
|
$componentKey = "cron"
|
|
$reportParams = @{
|
|
ClassPrefix = ([Rudder.Condition]::canonify(("service_started_" + $componentKey)))
|
|
ComponentKey = $componentKey
|
|
ComponentName = "Ensure cron daemon is running"
|
|
PolicyMode = $policyMode
|
|
ReportId = $reportId
|
|
DisableReporting = false
|
|
TechniqueName = $techniqueName
|
|
}
|
|
|
|
$class = ""true""
|
|
if ($localContext.Evaluate($class)) {
|
|
$methodParams = @{
|
|
Name = "cron"
|
|
|
|
}
|
|
$call = ServiceStarted $methodParams -PolicyMode $policyMode
|
|
$methodContext = Compute-Method-Call @reportParams -MethodCall $call
|
|
$localContext.merge($methodContext)
|
|
} else {
|
|
Rudder-Report-NA @reportParams
|
|
}
|
|
|
|
|
|
EndTechniqueCall -Name $techniqueName
|
|
}
|