PSM "Harden TLS" fails - "An SQL Server instance exists on this machine"
Symptom
2022-03-23 20:16:17:434 - PSM HardenTLS.psm1 INF - Installing SQL Server...
2022-03-23 20:16:17:715 - PSM HardenTLS.psm1 ERR - An SQL Server instance exists on this machine. Uninstall SQL Server and run the HardenTLS step again.
RunHardening
AfterHardening
RunApplocker
2022-03-23 20:16:42:528 - PSM Execute-Stage.ps1 ERR - Hardening stage completed with the following script/s failure: HardenTLS
2022-03-23 20:16:42:528 - PSM Execute-Stage.ps1 INF - Please see the log for more details.
Environment
10.10;11.1;11.2;11.3;11.4;11.5;11.6;11.7;12.0;12.1;12.2;12.4;12.3;12.5;12.6;13.0;14.6 Privileged Access Manager (PAM, self-hosted) PSM
PSM installation and Hardening
Cause
As part of CyberArk's initiative to mitigate weak TLS versions previously, we introduced a HardenTLS hardening step:
- This step disables SSL/TLS versions earlier than TLS 1.2.
- Installs SQL Server Express and configures RD Connection Broker to work with SQL Server Express
- This will make RDMS to be no longer affected, and using TLS 1.0
https://docs.cyberark.com/Product-Doc/OnlineHelp/PAS/12.2/en/Content/PAS%20INST/PSM_AutomaticInstallation.htm (Refer to the Hardening part of the documentation)
However, if the script detects a version of the SQL server on the PSM, it will fail this Hardening step.
Resolution
Uninstall all other SQL server installations on the PSM server:
- Under the control panel- Applications
- Remove "Microsoft SQL Server XXXX Setup(If there is more than one, and those SQLs are not part of PSM and not required, remove them too.
- Delete any existing SQL-related directories like the DB Instances etc.
Steps to Harden only TLS:
1. From the CD image, open InstallationAutomation\Hardening\HardeningConfig.XML
2. Set the parameters as follows: (Try to look for the similar line, and update the "Enable" and "Value" as per below)
a. <Step Name="RunHardening" DisplayName="Run the Hardening Script" ScriptName="RunTheHardeningScript.psm1" Enable="No">
<Parameter Name= "SupportWebApplications" Value="No"/>
<Parameter Name= "ClearRemoteDesktopUsers" Value="No"/>
b. <Step Name="AfterHardening" DisplayName="Post Hardening Tasks" ScriptName="AfterRunningTheHardeningScript.psm1" IsGPUpdateRequired="true" Enable="No"/>
c. <Step Name="RunApplocker" DisplayName="Set up AppLocker Rules" ScriptName="SetupAppLockerRules.psm1" Enable="No"/>
d. <Step Name= "OutOfDomainHardening" DisplayName="Configure Out of Domain PSM Server" ScriptName="ConfigureOutOfDomainPSMServer.psm1" IsGPUpdateRequired="true" Enable="No"/>
e. <Step Name="HardenTLS" DisplayName="Harden TLS Settings" ScriptName="HardenTLS.psm1" Enable="Yes">
3. Save the file (HardeningConfig.XML)
4. Execute the hardening script process:
a. CD “<CD-Image Path>\InstallationAutomation”
.\Execute-Stage.ps1 “<CD-Image Path>\Installation automation\Hardening\HardeningConfig.XML
After running these steps, it should execute only the HardenTLS step to reconfigure RDMS to use SQLExpress. The actual Instance name or service should be [SQL Server (PSM)].