This article introduces how to convert a self-signed certificate on a System Center Operations Manager (SCOM) Unix/Linux (SCX) agent to a Certificate Authority (CA) signed certificate.
Create a CA certificate template
On a CA server in your SCOM environment, follow these steps to create a certificate template:
-
Open Certification Authority from Server Manager.
-
Right-click Certificate Templates and select Manage.
-
Select the template Computer and select Duplicate Template.
-
On the General tab, set a name for the template and change the Validity period as per standards.
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/change-template-display-name-validity-period.png" alt-text="Screenshot that shows how to change the display name and validity period of a template.":::
-
On the Request Handling tab, check the Allow private key to be exported option.
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/allow-private-key-to-be-exported.png" alt-text="Screenshot that shows how to select the 'Allow private key to be exported' option.":::
-
On the Extensions tab, select Application Policies > Edit. Remove Client Authentication from the Application Policies extension. Make sure that the Application Policies extension has only Server Authentication.
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/remove-client-authentication.png" alt-text="Screenshot that shows how to remove 'Client Authentication' from the 'Application Policies' extension.":::
-
On the Subject Name tab, select Supply in the request. Accept the prompt. There's no risk.
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/select-supply-in-the-request.png" alt-text="Screenshot that shows how to select the 'Supply in the request' option.":::
-
Select OK.
-
Select the created template and go to Properties.
-
Select Security. Add the computer object of the server where the certificate will be enrolled.
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/add-server.png" alt-text="Screenshot that shows how to add the computer object.":::
-
Select the permissions as Read, Write, and Enroll.
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/select-permissions.png" alt-text="Screenshot that shows the 'Read', 'Write' and 'Enroll' permissions are selected.":::
-
Right-click Certificate templates. Select New > Certificate Template to Issue.
-
Select the created template and select OK.
Issue a CA certificate from the template
-
On the Windows Server that has been given the permission to the template, open the computer certificate store.
-
Under Personal, right-click Certificates and select All Tasks > Request New Certificate...
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/request-new-certificate.png" alt-text="Screenshot that shows how to request a new certificate.":::
-
Select Next > Next.
-
Find the template.
-
Select More information is required to enroll for this certificate. Click here to configure settings.
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/select-certificate-to-enroll.png" alt-text="Screenshot of the warning that requests more information for enrollment.":::
-
Add the following details, preferably in the order:
- CN=<Server Name FQDN>
- CN=<Server Name>
- DC=<domain component>, for example,
Contoso - DC=<domain component>, for example,
com
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/set-subject-name.png" alt-text="Screenshot that shows adding 'Subject name' details.":::
If you have other domain components, make sure they are in the certificate.
-
Select Finish after the successful enrollment.
-
Right-click the certificate and export it with a private key. Finally, there should be a .pfx file.
-
Export the CA and Intermediate CA certificate (if applicable) to the root store of all the management servers/gateways in the UNIX/Linux resource pool.
Copy and edit the certificate on the Unix/Linux server
Use one of the following methods to configure the certificate on the the Unix/Linux server:
Method 1: Configure certificate manually
-
Copy the certificate to the Unix/Linux server for which the certificate was issued.
-
Export the private key by using the following command:
openssl pkcs12 -in <FileName>.pfx -nocerts -out /etc/opt/omi/ssl/omikey.pem -nodes -passin pass:"pfxpassword"
While exporting the private key from the certificate store, include the -nodes paramter (which stands for no Desktop Environments (DEs)). This instructs OpenSSL to output the private key in an unencrypted format. Otherwise a new password has to be set for the new key file.
-
Export the certificate by using the following command:
openssl pkcs12 -in <FileName>.pfx -clcerts -nokeys -out /etc/opt/omi/ssl/omi-host-$(hostname).pem -passin pass:"pfxpassword" -
Delete and create a new symbolic link:
rm -f /etc/opt/omi/ssl/omi.pem ln -s /etc/opt/omi/ssl/omi-host-$(hostname).pem /etc/opt/omi/ssl/omi.pem -
Set the correct permissions and ownership on the private key, certificate, and symbolic link:
chmod 600 /etc/opt/omi/ssl/omikey.pem chmod 640 /etc/opt/omi/ssl/omi-host-$(hostname).pem /etc/opt/omi/ssl/omi.pem chown omi:omi /etc/opt/omi/ssl/omikey.pem chown root:omi /etc/opt/omi/ssl/omi-host-$(hostname).pem /etc/opt/omi/ssl/omi.pem -
Restart the SCX agent by running the following command:
scxadmin -restart -
Make sure the Open Management Infrastructure (OMI) processes are running after restarting the agent:
ps -ef | grep omi | grep -v grep:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/command-validate-omi-processes.png" alt-text="Screenshot that shows the command to validate omi processes running." lightbox="media/use-ca-certificate-on-scom-linux-agent/command-validate-omi-processes.png":::
Method 2: Configure certificate with bash script
-
Save the following bash script:
extract_scx_cert.sh#!/bin/bash # Usage: sudo ./extract_scx_cert.sh /path/to/certificate.pfx <pfx_password> PFX_FILE="$1" PFX_PASS="$2" SSL_DIR="/etc/opt/omi/ssl" KEY_FILE="$SSL_DIR/omikey.pem" CERT_FILE="$SSL_DIR/omi-host-$(hostname).pem" SYMLINK_FILE="$SSL_DIR/omi.pem" if [[ -z "$PFX_FILE" || -z "$PFX_PASS" ]]; then echo "Usage: $0 /path/to/certificate.pfx <pfx_password>" exit 1 fi echo "Extracting private key..." openssl pkcs12 -in "$PFX_FILE" -nocerts -out "$KEY_FILE" -nodes -passin pass:"$PFX_PASS" echo "Extracting certificate..." openssl pkcs12 -in "$PFX_FILE" -clcerts -nokeys -out "$CERT_FILE" -passin pass:"$PFX_PASS" echo "Creating symbolic link..." rm -f "$SYMLINK_FILE" ln -s "$CERT_FILE" "$SYMLINK_FILE" echo "Setting permissions..." chmod 600 "$KEY_FILE" chmod 640 "$CERT_FILE" "$SYMLINK_FILE" chown root:omi "$CERT_FILE" "$SYMLINK_FILE" chown omi:omi "$KEY_FILE" echo "Restarting omid service..." systemctl restart omid -
Change the script permissions to be run:
chmod +x /home/user/extract_scx_cert.sh -
Run the following command to run the script with these two parameters: the path to the PFX file and the password for it.
sudo ./extract_scx_cert.sh /path/to/certificate.pfx pfx_password
Validate that the certificate is signed by the CA
-
Run the following command on the agent to verify that the certificate is signed by the CA:
openssl x509 -noout -in /etc/opt/microsoft/scx/ssl/scx.pem -subject -issuer -dates subject= /DC=lab/DC=nfs/CN=RHEL7-02/CN=RHEL7-02.nfs.lab issuer= /DC=lab/DC=nfs/CN=nfs-DC-CA notBefore=Aug 1 13:16:47 2023 GMT notAfter=Jul 31 13:16:47 2024 GMTIn typical scenarios, the
issuerwill be a management server/gateway in the UNIX/Linux resource pool, as follows:openssl x509 -noout -in /etc/opt/microsoft/scx/ssl/scx.pem -subject -issuer -dates subject=CN = rhel8-01.nfs.lab, CN = rhel8-01.nfs.lab issuer=CN = SCX-Certificate, title = SCX55a8126f-c88a-4701-9754-8625324426ff, DC = SCOM2022MS3 notBefore=Jul 25 11:36:44 2022 GMT notAfter=Jul 25 12:12:14 2033 GMTThe path
/etc/opt/microsoft/scx/sslcontains a symbolic linkscx.pem -> /etc/opt/omi/ssl/omi.pemthat's used by the SCX agent in order to use the OMI certificate created earlier. -
Run a network trace on one of the management servers/gateways in the UNIX/Linux resource pool.
-
Run the following
WinRMcommand against the agent and make sure you get the instance output:winrm enumerate http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_Agent?__cimnamespace=root/scx -auth:basic -remote:https://<server name>:1270 -username:<username> -encoding:utf-8 -
On the network trace, filter with the IP of the agent.
-
In the Certificate, Server Hello Done packet, you should see the CA-signed certificate rather than the self-signed certificate used.
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/validate-ca-signed-certificate-used.png" alt-text="Screenshot that shows the CA signed certificate." lightbox="media/use-ca-certificate-on-scom-linux-agent/validate-ca-signed-certificate-used.png":::
Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
