dscResources/WindowsFirewall/WindowsFirewall.schema.psm1

#region Header
using module ..\helper.psm1
using module PowerStig
#endregion Header
#region Composite
<#
    .SYNOPSIS
        A composite DSC resource to manage the Windows Firewall STIG settings
 
    .PARAMETER StigVersion
        The version of the Firewall STIG to apply and/or monitor
 
    .PARAMETER Exception
        A hashtable of StigId=Value key pairs that are injected into the STIG data and applied to
        the target node. The title of STIG settings are tagged with the text ‘Exception’ to identify
        the exceptions to policy across the data center when you centralize DSC log collection.
 
    .PARAMETER OrgSettings
        The path to the xml file that contains the local organizations preferred settings for STIG
        items that have allowable ranges.
 
    .PARAMETER SkipRule
        The SkipRule Node is injected into the STIG data and applied to the taget node. The title
        of STIG settings are tagged with the text 'Skip' to identify the skips to policy across the
        data center when you centralize DSC log collection.
 
    .PARAMETER SkipRuleType
        All STIG rule IDs of the specified type are collected in an array and passed to the Skip-Rule
        function. Each rule follows the same process as the SkipRule parameter.
 
    .EXAMPLE
        In this example the 1.6 of the Windows firewall STIG is applied.
 
        Import-DscResource -ModuleName PowerStigDsc
 
        Node localhost
        {
            WindowsFirewall BaseLine
            {
                StigVersion = '1.6'
            }
        }
#>

Configuration WindowsFirewall
{
    [CmdletBinding()]
    Param
    (
        [Parameter()]
        [ValidateSet('1.6')]
        [ValidateNotNullOrEmpty()]
        [version]
        $StigVersion,

        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [psobject]
        $Exception,

        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [psobject]
        $OrgSettings,

        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [psobject]
        $SkipRule,

        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [psobject]
        $SkipRuleType
    )

    if ( $Exception )
    {
        $exceptionsObject = [StigException]::ConvertFrom( $Exception )
    }
    else 
    {
        $exceptionsObject = $null
    }

    if ( $SkipRule )
    {
        $skipRuleObject = [SkippedRule]::ConvertFrom( $SkipRule )
    }
    else 
    {
        $skipRuleObject = $null
    }

    if ( $SkipRuleType )
    {
        $skipRuleTypeObject = [SkippedRuleType]::ConvertFrom( $SkipRuleType )
    }
    else 
    {
        $skipRuleTypeObject = $null
    }

    if ( $OrgSettings )
    {
        $orgSettingsObject = Get-OrgSettingsObject -OrgSettings $OrgSettings
    }
    else
    {
        $orgSettingsObject = $null
    }

    $technology = [Technology]::New( "Windows" )
    $technologyVersion =  [TechnologyVersion]::New( "All", $technology )
    $technologyRole = [TechnologyRole]::New( "FW", $technologyVersion )
    $StigDataObject = [StigData]::New( $StigVersion, $orgSettingsObject, $technology, $technologyRole, $technologyVersion, $exceptionsObject , $skipRuleTypeObject, $skipRuleObject )

    $StigData = $StigDataObject.StigXml

        # $resourcePath is exported from the helper module in the header
        Import-DscResource -ModuleName PSDesiredStateConfiguration
        . "$resourcePath\windows.Registry.ps1"
    }
#endregion Composite