Skip to content

Commit

Permalink
DSC_WebSite: Change CertificateStoreName value in the schema (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
webalexeu authored Oct 29, 2024
1 parent 04d3bd3 commit c5e65a4
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 21 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ For older change log history see the [historic changelog](HISTORIC_CHANGELOG.md)
- IisMimeTypeMapping
- Set default for Ensure property to Present.

### Fixed

- WebAdministrationDsc
- Fixed CertificateStoreName default value from `MY` to `My` ([issue #642](https://github.com/dsccommunity/WebAdministrationDsc/issues/542))

## [4.2.0] - 2024-08-26

### Removed
Expand Down
6 changes: 3 additions & 3 deletions source/DSCResources/DSC_WebSite/DSC_WebSite.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ function ConvertTo-CimBinding
}

$cimProperties.Add('CertificateThumbprint', [String]$binding.certificateHash)
$cimProperties.Add('CertificateStoreName', [String]$binding.certificateStoreName)
$cimProperties.Add('CertificateStoreName', [String]($binding.certificateStoreName) -creplace ('^MY$','My'))

New-CimInstance -ClassName $cimClassName `
-Namespace $cimNamespace `
Expand Down Expand Up @@ -1460,14 +1460,14 @@ function ConvertTo-WebBinding

if ([String]::IsNullOrEmpty($binding.CertificateStoreName))
{
$certificateStoreName = 'MY'
$certificateStoreName = 'My'
Write-Verbose -Message `
($script:localizedData.VerboseConvertToWebBindingDefaultCertificateStoreName `
-f $certificateStoreName)
}
else
{
$certificateStoreName = $binding.CertificateStoreName
$certificateStoreName = $binding.CertificateStoreName -creplace ('^MY$','My')
}

$certificateHash = $null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Configuration Sample_WebSite_NewWebsite_UsingCertificateSubject
Protocol = 'HTTPS'
Port = 8444
CertificateSubject = 'CN=CertificateSubject'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
}
)
DependsOn = '[File]WebContent'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Configuration Sample_WebSite_NewWebsite_UsingCertificateThumbprint
Protocol = 'HTTPS'
Port = 8444
CertificateThumbprint = 'DEDDD963B28095837F558FE14DA1FDEFB7FA9DA7'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
}
)
DependsOn = '[File]WebContent'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ configuration Sample_WebSite_WithSSLFlags
{
Protocol = 'https'
Port = '443'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
CertificateThumbprint = 'BB84DE3EC423DDDE90C08AB3C5A828692089493C'
HostName = $WebSiteName
IPAddress = '*'
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/DSC_SslSettings.config.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
HTTPSProtocol = 'https'
HTTPSPort = '443'
HTTPSHostname = 'https.website'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
SslFlags = '1'
Bindings = @('Ssl')
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/DSC_WebApplication.config.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
HTTPSProtocol = 'https'
HTTPSPort = '443'
HTTPSHostname = 'https.website'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
SslFlags = '1'
WebApplicationSslFlags = @('Ssl')
EnabledProtocols = @('http', 'net.tcp')
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/DSC_WebSite.config.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
HTTPSPort = '443'
HTTPSPort2 = '8444'
HTTPSHostname = 'https.website'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
SslFlags = '1'
LogFieldName1 = 'CustomField1'
SourceName1 = 'Accept-Encoding'
Expand Down
24 changes: 12 additions & 12 deletions tests/Unit/DSC_Website.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,7 @@ try
bindingInformation = '127.0.0.1:443:MockHostName'
protocol = 'https'
certificateHash = '1D3324C6E2F7ABC794C9CB6CA426B8D0F81045CD'
certificateStoreName = 'MY'
certificateStoreName = 'My'
sslFlags = '1'
}

Expand All @@ -2276,7 +2276,7 @@ try
}

It 'should return the CertificateStoreName' {
$Result.CertificateStoreName | Should Be 'MY'
$Result.CertificateStoreName | Should BeExactly 'My'
}

It 'should return the SslFlags' {
Expand All @@ -2289,7 +2289,7 @@ try
bindingInformation = '[0:0:0:0:0:0:0:1]:443:MockHostName'
protocol = 'https'
certificateHash = '1D3324C6E2F7ABC794C9CB6CA426B8D0F81045CD'
certificateStoreName = 'MY'
certificateStoreName = 'My'
sslFlags = '1'
}

Expand All @@ -2316,7 +2316,7 @@ try
}

It 'should return the CertificateStoreName' {
$Result.CertificateStoreName | Should Be 'MY'
$Result.CertificateStoreName | Should BeExactly 'My'
}

It 'should return the SslFlags' {
Expand Down Expand Up @@ -2470,7 +2470,7 @@ try
-Property @{
Protocol = 'https'
CertificateThumbprint = $MockThumbprintWithLrmChar
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
} -ClientOnly
)

Expand Down Expand Up @@ -2617,7 +2617,7 @@ try
-Property @{
Protocol = 'https'
CertificateSubject = 'TestCertificate'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
} -ClientOnly
)

Expand Down Expand Up @@ -2651,7 +2651,7 @@ try

It 'should set CertificateStoreName to the default value' {
$Result = ConvertTo-WebBinding -InputObject $MockBindingInfo
$Result.certificateStoreName | Should Be 'MY'
$Result.certificateStoreName | Should BeExactly 'My'
}
}

Expand Down Expand Up @@ -3427,7 +3427,7 @@ try
Port = 443
HostName = ''
CertificateThumbprint = '1D3324C6E2F7ABC794C9CB6CA426B8D0F81045CD'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
SslFlags = 0
}
)
Expand All @@ -3437,7 +3437,7 @@ try
bindingInformation = '*:443:'
protocol = 'https'
certificateHash = 'B30F3184A831320382C61EFB0551766321FA88A5'
certificateStoreName = 'MY'
certificateStoreName = 'My'
sslFlags = '0'
}
)
Expand Down Expand Up @@ -3468,7 +3468,7 @@ try
Port = 443
HostName = ''
CertificateThumbprint = '1D3324C6E2F7ABC794C9CB6CA426B8D0F81045CD'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
SslFlags = 0
}
)
Expand Down Expand Up @@ -3507,7 +3507,7 @@ try
Port = 443
HostName = ''
CertificateThumbprint = ''
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
SslFlags = 0
}
)
Expand Down Expand Up @@ -3814,7 +3814,7 @@ try
Port = 443
HostName = ''
CertificateThumbprint = '5846A1B276328B1A32A30150858F6383C1F30E1F'
CertificateStoreName = 'MY'
CertificateStoreName = 'My'
SslFlags = 0
}
)
Expand Down

0 comments on commit c5e65a4

Please sign in to comment.