Skip to content

Commit d5e31f7

Browse files
authored
Revise CA certificate configuration instructions
Updated instructions for configuring CA certificates on Unix/Linux servers, including manual and script methods. Adjusted commands for exporting private keys and certificates, and added permission settings.
1 parent 142a475 commit d5e31f7

File tree

1 file changed

+70
-26
lines changed

1 file changed

+70
-26
lines changed

support/system-center/scom/use-ca-certificate-on-scx-agent.md

Lines changed: 70 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -75,50 +75,39 @@ On a CA server in your SCOM environment, follow these steps to create a certific
7575
1. 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.
7676

7777
## Copy and edit the certificate on the Unix/Linux server
78+
Use one of the following methods to configure the certificate on the the Unix/Linux server:
7879

80+
### Method 1: Configure Certificate Manually
7981
1. Copy the certificate to the Unix/Linux server for which the certificate was issued.
8082
1. Export the private key by using the following command:
8183

8284
```console
83-
openssl pkcs12 -in <FileName>.pfx -nocerts -out key.pem
85+
openssl pkcs12 -in <FileName>.pfx -nocerts -out /etc/opt/omi/ssl/omikey.pem -nodes -passin pass:"pfxpassword"
8486
```
8587

86-
While exporting the private key from the certificate store, a new password has to be set for the new key file.
87-
88-
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/command-export-private-key.png" alt-text="Screenshot that shows the command to export the private key.":::
89-
90-
After the export is completed, you should see a *key.pem* file:
91-
92-
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/command-get-key-dot-pem-file.png" alt-text="Screenshot that shows the command to get the private key file.":::
88+
> [!NOTE]
89+
> While exporting the private key from the certificate store, a new password has to be set for the new key file, unless you specify the `-nodes`, This option stands for `no DES` encryption which instructs OpenSSL to output the private key in an unencrypted format.
9390

9491
1. Export the certificate by using the following command:
9592

9693
```console
97-
openssl pkcs12 -in <FileName>.pfx -clcerts -nokeys -out omi.pem
94+
openssl pkcs12 -in <FileName>.pfx -clcerts -nokeys -out /etc/opt/omi/ssl/omi-host-$(hostname).pem -passin pass:"pfxpassword"
9895
```
9996

100-
While exporting the certificate from the certificate store, you have to enter the password for the *\<FileName>.pfx* file.
101-
102-
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/command-export-certificate.png" alt-text="Screenshot that shows the command to export the certificate.":::
103-
104-
After the export is completed, you should see an *omi.pem* file:
105-
106-
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/command-get-omi-dot-pem-file.png" alt-text="Screenshot that shows the command to get the certificate file.":::
107-
108-
1. Remove the password from the private key by using the following command:
97+
1. Delete and create a new symbolic link:
10998

11099
```console
111-
openssl rsa -in key.pem -out omikey.pem
100+
rm -f /etc/opt/omi/ssl/omi.pem
101+
ln -s /etc/opt/omi/ssl/omi-host-$(hostname).pem /etc/opt/omi/ssl/omi.pem
112102
```
113-
114-
:::image type="content" source="media/use-ca-certificate-on-scom-linux-agent/command-remove-password-from-private-key.png" alt-text="Screenshot that shows the command to remove password from the private key.":::
115-
116-
This action is needed since the Linux agent doesn't know the password for the file.
117-
118-
1. Move the *omikey.pem* file to the Open Management Infrastructure (OMI) directory by using the following command:
103+
104+
1. Set the correct permissions and ownership on omikey.pem, Certificate and Symbolic Link:
119105

120106
```console
121-
mv omikey.pem /etc/opt/omi/ssl/omikey.pem
107+
chmod 600 /etc/opt/omi/ssl/omikey.pem
108+
chmod 640 /etc/opt/omi/ssl/omi-host-$(hostname).pem /etc/opt/omi/ssl/omi.pem
109+
chown omi:omi /etc/opt/omi/ssl/omikey.pem
110+
chown root:omi /etc/opt/omi/ssl/omi-host-$(hostname).pem /etc/opt/omi/ssl/omi.pem
122111
```
123112

124113
1. Restart the SCX agent by using the following command:
@@ -135,6 +124,58 @@ On a CA server in your SCOM environment, follow these steps to create a certific
135124

136125
:::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":::
137126

127+
### Method 2: Configure Certificate with Bash Script
128+
1. Save the below bash script extract_scx_cert.sh
129+
130+
```console
131+
#!/bin/bash
132+
133+
# Usage: sudo ./extract_scx_cert.sh /path/to/certificate.pfx <pfx_password>
134+
135+
PFX_FILE="$1"
136+
PFX_PASS="$2"
137+
SSL_DIR="/etc/opt/omi/ssl"
138+
KEY_FILE="$SSL_DIR/omikey.pem"
139+
CERT_FILE="$SSL_DIR/omi-host-$(hostname).pem"
140+
SYMLINK_FILE="$SSL_DIR/omi.pem"
141+
142+
if [[ -z "$PFX_FILE" || -z "$PFX_PASS" ]]; then
143+
echo "Usage: $0 /path/to/certificate.pfx <pfx_password>"
144+
exit 1
145+
fi
146+
147+
echo "🔐 Extracting private key..."
148+
openssl pkcs12 -in "$PFX_FILE" -nocerts -out "$KEY_FILE" -nodes -passin pass:"$PFX_PASS"
149+
150+
echo "📄 Extracting certificate..."
151+
openssl pkcs12 -in "$PFX_FILE" -clcerts -nokeys -out "$CERT_FILE" -passin pass:"$PFX_PASS"
152+
153+
echo "🔗 Creating symbolic link..."
154+
rm -f "$SYMLINK_FILE"
155+
ln -s "$CERT_FILE" "$SYMLINK_FILE"
156+
157+
echo "🔧 Setting permissions..."
158+
chmod 600 "$KEY_FILE"
159+
chmod 640 "$CERT_FILE" "$SYMLINK_FILE"
160+
chown root:omi "$CERT_FILE" "$SYMLINK_FILE"
161+
chown omi:omi "$KEY_FILE"
162+
163+
echo "🔄 Restarting omid service..."
164+
systemctl restart omid
165+
```
166+
167+
1. Change Script permissions to be executed
168+
169+
```console
170+
chmod +x /home/user/extract_scx_cert.sh
171+
```
172+
173+
1. Execute the script with the parameters as below with the path to the pfx file and the password for it:
174+
175+
```console
176+
sudo ./extract_scx_cert.sh /path/to/certificate.pfx pfx_password
177+
```
178+
138179
## Validate that the certificate is signed by the CA
139180

140181
1. Run the following command on the agent to verify that the certificate is signed by the CA:
@@ -159,6 +200,9 @@ On a CA server in your SCOM environment, follow these steps to create a certific
159200
notAfter=Jul 25 12:12:14 2033 GMT
160201
```
161202

203+
> [!NOTE]
204+
> The path `/etc/opt/microsoft/scx/ssl` contains a symbolic link `scx.pem -> /etc/opt/omi/ssl/omi.pem` that is used by the SCX agent to use the OMI certificate that was created earlier.
205+
162206
1. Run a network trace on one of the management servers/gateways in the UNIX/Linux resource pool.
163207
1. Run the following `WinRM` command against the agent and make sure you get the instance output:
164208

0 commit comments

Comments
 (0)