Skip to content

Commit 1b3c4b9

Browse files
committed
(#298) Add CCM Salt Value Generation Higher in Script
- Create block for CCM Salt Generation - Ensures CCM Salt values are set to paramters in Register-C4bEndpoint.ps1
1 parent f46e329 commit 1b3c4b9

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Start-C4bCcmSetup.ps1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,17 @@ process {
195195
}
196196
choco config set centralManagementServiceUrl "$($CcmEndpoint):24020/ChocolateyManagementService"
197197

198+
#Generate CCM Salt Values
199+
if (-not (Get-ChocoEnvironmentProperty ClientSalt)) {
200+
$ClientSaltValue = New-ServicePassword
201+
Set-ChocoEnvironmentProperty ClientSalt $ClientSaltValue
202+
}
203+
204+
if (-not (Get-ChocoEnvironmentProperty ServiceSalt)) {
205+
$ServiceSaltValue = New-ServicePassword
206+
Set-ChocoEnvironmentProperty ServiceSalt $ServiceSaltValue
207+
}
208+
198209
# Updating the Registration Script
199210
$EndpointScript = "$PSScriptRoot\scripts\Register-C4bEndpoint.ps1"
200211
Invoke-TextReplacementInFile -Path $EndpointScript -Replacement @{
@@ -234,20 +245,9 @@ process {
234245
Set-ChocoEnvironmentProperty CCMEncryptionPassword $CCMEncryptionPassword
235246
}
236247

237-
# Set Client and Service salts
238-
if (-not (Get-ChocoEnvironmentProperty ClientSalt)) {
239-
$ClientSaltValue = New-ServicePassword
240-
Set-ChocoEnvironmentProperty ClientSalt $ClientSaltValue
241-
242-
Invoke-Choco config set centralManagementClientCommunicationSaltAdditivePassword $ClientSaltValue.ToPlainText()
243-
}
244-
245-
if (-not (Get-ChocoEnvironmentProperty ServiceSalt)) {
246-
$ServiceSaltValue = New-ServicePassword
247-
Set-ChocoEnvironmentProperty ServiceSalt $ServiceSaltValue
248-
249-
Invoke-Choco config set centralManagementServiceCommunicationSaltAdditivePassword $ServiceSaltValue.ToPlainText()
250-
}
248+
# Set Client and Service salts in Chocolatey Config
249+
Invoke-Choco config set centralManagementClientCommunicationSaltAdditivePassword $ClientSaltValue.ToPlainText()
250+
Invoke-Choco config set centralManagementServiceCommunicationSaltAdditivePassword $ServiceSaltValue.ToPlainText()
251251

252252
# Set Website Root Address
253253
Update-CcmSettings -CcmEndpoint $CCmEndpoint -Credential $CCMCredential -Settings @{

0 commit comments

Comments
 (0)