From d431a3c88f9b0388af1526e101977a9249af796e Mon Sep 17 00:00:00 2001 From: Ryan Richter Date: Thu, 29 May 2025 12:21:58 -0400 Subject: [PATCH] (#298) Add CCM Salt Value Generation Higher in Script - Create block for CCM Salt Generation - Ensures CCM Salt values are set to parameters in Register-C4bEndpoint.ps1 --- Start-C4bCcmSetup.ps1 | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Start-C4bCcmSetup.ps1 b/Start-C4bCcmSetup.ps1 index 95f3a74..3fb453b 100644 --- a/Start-C4bCcmSetup.ps1 +++ b/Start-C4bCcmSetup.ps1 @@ -195,6 +195,17 @@ process { } choco config set centralManagementServiceUrl "$($CcmEndpoint):24020/ChocolateyManagementService" + #Generate CCM Salt Values + if (-not (Get-ChocoEnvironmentProperty ClientSalt)) { + $ClientSaltValue = New-ServicePassword + Set-ChocoEnvironmentProperty ClientSalt $ClientSaltValue + } + + if (-not (Get-ChocoEnvironmentProperty ServiceSalt)) { + $ServiceSaltValue = New-ServicePassword + Set-ChocoEnvironmentProperty ServiceSalt $ServiceSaltValue + } + # Updating the Registration Script $EndpointScript = "$PSScriptRoot\scripts\Register-C4bEndpoint.ps1" Invoke-TextReplacementInFile -Path $EndpointScript -Replacement @{ @@ -234,20 +245,9 @@ process { Set-ChocoEnvironmentProperty CCMEncryptionPassword $CCMEncryptionPassword } - # Set Client and Service salts - if (-not (Get-ChocoEnvironmentProperty ClientSalt)) { - $ClientSaltValue = New-ServicePassword - Set-ChocoEnvironmentProperty ClientSalt $ClientSaltValue - - Invoke-Choco config set centralManagementClientCommunicationSaltAdditivePassword $ClientSaltValue.ToPlainText() - } - - if (-not (Get-ChocoEnvironmentProperty ServiceSalt)) { - $ServiceSaltValue = New-ServicePassword - Set-ChocoEnvironmentProperty ServiceSalt $ServiceSaltValue - - Invoke-Choco config set centralManagementServiceCommunicationSaltAdditivePassword $ServiceSaltValue.ToPlainText() - } + # Set Client and Service salts in Chocolatey Config + Invoke-Choco config set centralManagementClientCommunicationSaltAdditivePassword $ClientSaltValue.ToPlainText() + Invoke-Choco config set centralManagementServiceCommunicationSaltAdditivePassword $ServiceSaltValue.ToPlainText() # Set Website Root Address Update-CcmSettings -CcmEndpoint $CCmEndpoint -Credential $CCMCredential -Settings @{