大网数据广告活动
启动与系统组件

Convert self-signed SCX certificates to CA certificates

· 52CE 我爱测

Introduces how to convert a self-signed certificate on an SCX agent to a Certificate Authority (CA) signed certificate.

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:

  1. Open Certification Authority from Server Manager.

  2. Right-click Certificate Templates and select Manage.

  3. Select the template Computer and select Duplicate Template.

  4. 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.":::

  5. 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.":::

  6. 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.":::

  7. 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.":::

  8. Select OK.

  9. Select the created template and go to Properties.

  10. 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.":::

  11. 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.":::

  12. Right-click Certificate templates. Select New > Certificate Template to Issue.

  13. Select the created template and select OK.

Issue a CA certificate from the template

  1. On the Windows Server that has been given the permission to the template, open the computer certificate store.

  2. 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.":::

  3. Select Next > Next.

  4. Find the template.

  5. 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.":::

  6. Add the following details, preferably in the order:

    1. CN=<Server Name FQDN>
    2. CN=<Server Name>
    3. DC=<domain component>, for example, Contoso
    4. 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.

  7. Select Finish after the successful enrollment.

  8. Right-click the certificate and export it with a private key. Finally, there should be a .pfx file.

  9. 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

  1. Copy the certificate to the Unix/Linux server for which the certificate was issued.

  2. 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.

  1. 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"
    
  2. 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
    
  3. 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
    
  4. Restart the SCX agent by running the following command:

    scxadmin -restart
    
  5. 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

  1. 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
    
  2. Change the script permissions to be run:

    chmod +x /home/user/extract_scx_cert.sh
    
  3. 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

  1. 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 GMT
    

    In typical scenarios, the issuer will 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 GMT
    

    The path /etc/opt/microsoft/scx/ssl contains a symbolic link scx.pem -> /etc/opt/omi/ssl/omi.pem that's used by the SCX agent in order to use the OMI certificate created earlier.

  2. Run a network trace on one of the management servers/gateways in the UNIX/Linux resource pool.

  3. Run the following WinRM command 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
    
  4. On the network trace, filter with the IP of the agent.

  5. 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.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 04/15/2024
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。