Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release of version 2.6.0.0 of xWebAdministration #421

Merged
merged 15 commits into from
May 15, 2019
20 changes: 16 additions & 4 deletions DSCResources/Helper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ function Find-Certificate

if ($PSBoundParameters.ContainsKey('Subject'))
{
$certFilters += @('($_.Subject -eq $Subject)')
$certFilters += @('(@(Compare-Object `
-ReferenceObject (($_.Subject -split ", ").trim()|sort-object) `
-DifferenceObject (($subject -split ",").trim()|sort-object)| `
Where-Object -Property SideIndicator -eq "=>").Count -eq 0)')
} # if

if ($PSBoundParameters.ContainsKey('Issuer'))
Expand All @@ -180,17 +183,26 @@ function Find-Certificate

if ($PSBoundParameters.ContainsKey('DNSName'))
{
$certFilters += @('(@(Compare-Object -ReferenceObject $_.DNSNameList.Unicode -DifferenceObject $DNSName | Where-Object -Property SideIndicator -eq "=>").Count -eq 0)')
$certFilters += @('(@(Compare-Object `
-ReferenceObject $_.DNSNameList.Unicode `
-DifferenceObject $DNSName | `
Where-Object -Property SideIndicator -eq "=>").Count -eq 0)')
} # if

if ($PSBoundParameters.ContainsKey('KeyUsage'))
{
$certFilters += @('(@(Compare-Object -ReferenceObject ($_.Extensions.KeyUsages -split ", ") -DifferenceObject $KeyUsage | Where-Object -Property SideIndicator -eq "=>").Count -eq 0)')
$certFilters += @('(@(Compare-Object `
-ReferenceObject ($_.Extensions.KeyUsages -split ", ") `
-DifferenceObject $KeyUsage | `
Where-Object -Property SideIndicator -eq "=>").Count -eq 0)')
} # if

if ($PSBoundParameters.ContainsKey('EnhancedKeyUsage'))
{
$certFilters += @('(@(Compare-Object -ReferenceObject ($_.EnhancedKeyUsageList.FriendlyName) -DifferenceObject $EnhancedKeyUsage | Where-Object -Property SideIndicator -eq "=>").Count -eq 0)')
$certFilters += @('(@(Compare-Object `
-ReferenceObject ($_.EnhancedKeyUsageList.FriendlyName) `
-DifferenceObject $EnhancedKeyUsage | `
Where-Object -Property SideIndicator -eq "=>").Count -eq 0)')
} # if

# Join all the filters together
Expand Down
47 changes: 41 additions & 6 deletions DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ data LocalizedData
VerboseSetTargetUpdateLogTruncateSize = TruncateSize is not in the desired state and will be updated.
VerboseSetTargetUpdateLoglocalTimeRollover = LoglocalTimeRollover is not in the desired state and will be updated.
VerboseSetTargetUpdateLogFormat = LogFormat is not in the desired state and will be updated
VerboseSetTargetUpdateLogTargetW3C = LogTargetW3C is not in the desired state and will be updated
VerboseSetTargetUpdateLogCustomFields = LogCustomFields is not in the desired state and will be updated.
VerboseTestTargetUpdateLogCustomFields = LogCustomFields is not in the desired state and will be updated.
VerboseTestTargetFalseLogPath = LogPath does match desired state.
Expand All @@ -21,6 +22,7 @@ data LocalizedData
VerboseTestTargetFalseLogTruncateSize = LogTruncateSize does not match desired state.
VerboseTestTargetFalseLoglocalTimeRollover = LoglocalTimeRollover does not match desired state.
VerboseTestTargetFalseLogFormat = LogFormat does not match desired state.
VerboseTestTargetFalseLogTargetW3C = LogTargetW3C does not match desired state.
WarningLogPeriod = LogTruncateSize has is an input as will overwrite this desired state.
WarningIncorrectLogFormat = LogFormat is not W3C, as a result LogFlags will not be used.
'@
Expand Down Expand Up @@ -56,6 +58,7 @@ function Get-TargetResource
LogTruncateSize = $currentLogSettings.truncateSize
LoglocalTimeRollover = $currentLogSettings.localTimeRollover
LogFormat = $currentLogSettings.logFormat
LogTargetW3C = $currentLogSettings.logTargetW3C
LogCustomFields = $cimLogCustomFields
}
}
Expand Down Expand Up @@ -86,6 +89,10 @@ function Get-TargetResource
Specifies log format
Limited to the set: ('IIS','W3C','NCSA')

.PARAMETER LogTargetW3C
Specifies W3C log format
Limited to the set: ('File','ETW','File,ETW')

.PARAMETER LogCustomField
A CimInstance collection of what state the LogCustomField should be.

Expand Down Expand Up @@ -114,8 +121,11 @@ function Set-TargetResource
[ValidateSet('IIS','W3C','NCSA')]
[String] $LogFormat,

[Microsoft.Management.Infrastructure.CimInstance[]]
$LogCustomFields
[ValidateSet('File','ETW','File,ETW')]
[String] $LogTargetW3C,

[Microsoft.Management.Infrastructure.CimInstance[]]
$LogCustomFields
)

Assert-Module
Expand Down Expand Up @@ -192,6 +202,16 @@ function Set-TargetResource
-Value $LoglocalTimeRollover
}

# Update LogTargetW3C if needed
if ($PSBoundParameters.ContainsKey('LogTargetW3C') -and `
($LogTargetW3C -ne $currentLogState.LogTargetW3C))
{
Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogTargetW3C)
Set-WebConfigurationProperty '/system.applicationHost/sites/siteDefaults/logfile' `
-Name logTargetW3C `
-Value $LogTargetW3C
}

# Update LogCustomFields if neeed
if ($PSBoundParameters.ContainsKey('LogCustomFields') -and `
(-not (Test-LogCustomField -LogCustomField $LogCustomFields)))
Expand Down Expand Up @@ -229,6 +249,10 @@ function Set-TargetResource
Specifies log format
Limited to the set: ('IIS','W3C','NCSA')

.PARAMETER LogTargetW3C
Specifies W3C log format
Limited to the set: ('File','ETW','File,ETW')

.PARAMETER LogCustomField
A CimInstance collection of what state the LogCustomField should be.

Expand Down Expand Up @@ -258,6 +282,9 @@ function Test-TargetResource
[ValidateSet('IIS','W3C','NCSA')]
[String] $LogFormat,

[ValidateSet('File','ETW','File,ETW')]
[String] $LogTargetW3C,

[Microsoft.Management.Infrastructure.CimInstance[]]
$LogCustomFields
)
Expand Down Expand Up @@ -337,13 +364,21 @@ function Test-TargetResource
return $false
}

# Check LogTargetW3C
if ($PSBoundParameters.ContainsKey('LogTargetW3C') -and `
($LogTargetW3C -ne $currentLogState.LogTargetW3C))
{
Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogTargetW3C)
return $false
}

# Check LogCustomFields if neeed
if ($PSBoundParameters.ContainsKey('LogCustomFields') -and `
(-not (Test-LogCustomField -LogCustomFields $LogCustomFields)))
{
if ($PSBoundParameters.ContainsKey('LogCustomFields') -and `
(-not (Test-LogCustomField -LogCustomFields $LogCustomFields)))
{
Write-Verbose -Message ($LocalizedData.VerboseTestTargetUpdateLogCustomFields)
return $false
}
}

return $true

Expand Down
17 changes: 8 additions & 9 deletions DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.schema.mof
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
[ClassVersion("1.0.0")]
class MSFT_xLogCustomField
{
[Required, Description("Name for the custom field")] String LogFieldName;
[Required, Description("Name for the source type")] String SourceName;
[Required, Description("Specify the source type"), ValueMap{"RequestHeader","ResponseHeader","ServerVariable"},Values{"RequestHeader","ResponseHeader","ServerVariable"}] String SourceType;
};

[ClassVersion("1.0.0"), FriendlyName("xIisLogging")]
class MSFT_xIisLogging : OMI_BaseResource
{
Expand All @@ -15,7 +7,14 @@ class MSFT_xIisLogging : OMI_BaseResource
[Write, Description ("How large the file should be before it is truncated")] String LogTruncateSize;
[Write, Description ("Use the localtime for file naming and rollover")] Boolean LoglocalTimeRollover;
[Write, Description ("Format of the Logfiles. Only W3C supports LogFlags"), ValueMap{"IIS","W3C","NCSA"}, Values{"IIS","W3C","NCSA"}] String LogFormat;
[Write, Description ("Specifies whether IIS will use Event Tracing or file logging"), ValueMap{"File","ETW","File,ETW"}, Values{"File","ETW","File,ETW"}] String LogTargetW3C;
[Write, EmbeddedInstance("MSFT_xLogCustomField"), Description("Custom logging field information in the form of an array of embedded instances of MSFT_xLogCustomField CIM class")] String LogCustomFields[];
};


[ClassVersion("1.0.0")]
class MSFT_xLogCustomField
{
[Required, Description("Name for the custom field")] String LogFieldName;
[Required, Description("Name for the source type")] String SourceName;
[Required, Description("Specify the source type"), ValueMap{"RequestHeader","ResponseHeader","ServerVariable"},Values{"RequestHeader","ResponseHeader","ServerVariable"}] String SourceType;
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
[ClassVersion("1.0.0")]
class MSFT_xWebApplicationAuthenticationInformation
{
[Write] Boolean Anonymous;
[Write] Boolean Basic;
[Write] Boolean Digest;
[Write] Boolean Windows;
};

[ClassVersion("1.0.0.0"), FriendlyName("xWebApplication")]
class MSFT_xWebApplication : OMI_BaseResource
{
Expand All @@ -23,3 +14,12 @@ class MSFT_xWebApplication : OMI_BaseResource
[Write, Description ("Adds a AutostartProvider ApplicationType")] String ApplicationType;
[Write, Description ("Adds EnabledProtocols on an Application"), ValueMap{"http","https","net.tcp","net.msmq","net.pipe"},Values{"http","https","net.tcp","net.msmq","net.pipe"}] String EnabledProtocols[];
};

[ClassVersion("1.0.0")]
class MSFT_xWebApplicationAuthenticationInformation
{
[Write] Boolean Anonymous;
[Write] Boolean Basic;
[Write] Boolean Digest;
[Write] Boolean Windows;
};
Loading