Complete Guide to Setting up the PSMP Health Check

Complete Guide to Setting up the PSMP Health Check

152
Created On 11/10/26 10:54 AM - Last Modified 11/10/26 15:50 PM


Objective


PSM for SSH Health Check

PSM for SSH installation has an optional Rest API service for health monitoring. The PSM for SSH Rest API service enables you to determine PSM for SSH service availability (health) by querying a dedicated REST API service deployed on each PSM for SSH instance.

 

A Note for PCloud Customers:

PSM for SSH Health Check is not supported for PSMP servers connected to PCloud tenants. While the PSMP products are similar, the PCloud version does not contain the required components and features to the allow the following process to work. For those wishing to load balance PSMP servers in a PCloud environment, we recommend SIA-SSH (https://community.cyberark.com/s/article/Best-Practices-for-Modernizing-SSH-Access). SIA does not require a load balancer as it includes that functionality within the connector pool.



Environment


14.4;14.6;15.2 Privileged Access Manager (PAM, self-hosted) PSMP

Procedure


PSMP Installation

Enable the Rest API Service

 

Uncomment the EnablePSMPRestService parameter and set it to Yes to enable the PsmpRestService for PSMP.

 

 

systemctl enable psmpsrv-psmprestservice

systemctl start psmpsrv-psmprestservice

 

Edit the Rest API Configuration

PSMP Health Check Configuration File

The main configuration file is located in /etc/opt/CARKpsmpext/conf/basic_psmprestservice.conf and the most important settings are:

Parameter

Description

socket-path

Path to the Unix Domain Socket where the HTTPS service is bound

Default value: /var/opt/CARKpsmpext/temp/rest_service.sock

log-level

Logging level of the service

Default value: Info

worker-threads

The number of working threads processing requests

Default value: 5

cert-path

The path of the certificate used by SSL context. If changed, it requires the key-path to be set as well.

Default value: If not defined, a temporary certificate is generated in /var/opt/CARKpsmpext/temp/rest_service.cert

key-path

If an existing cert-path is defined, this option is used to read the private key associated with the certificate.

socket-group

A local group granted access to the Unix Domain Socket

Default value: psmprestservice

health

Section for options related to the health request

response-mode

Change the response mode of the health response

Default value: Classic

 

Set the Health Check response mode

Parameter

Description

Classic

The health check service responds with 200 (OK) whether the PSM for SSH service is healthy or not, but the response body includes PASS or FAIL indicating if the server is healthy.

CodeBased

The health check service responds with 200 (OK) when the PSM for SSH service is healthy, and 503 (Service unavailable) when the service is not healthy.

HeaderBased

This mode behaves like the Classic mode, but adds the IsHealthy parameter in the response header, with a value of either Yes or No.

 

Setup a Web Server

To give access to the Rest API service for external requests, you must integrate the Rest API service with an HTTP server. NGINX is the HTTP server recommended for Linux.

 

Install NGINX and HTPASSWD

sudo -s

yum install nginx

yum install httpd-tools

 

The following example contains a basic authentication method to limit access to the Rest API service. The authentication file can be created with the htpasswd tool:

 

sudo htpasswd -c /etc/nginx/users psmp1

Note: Replace psmp1 with any username. You will be prompted to enter a password and confirm it. This will be used to log into the Health Check website.

 

Minimal Configuration for Nginx with Basic Authentication

Replace the content of the /etc/nginx/nginx.conf file with the following:

sudo cp /etc/nginx/nginx.conf nginx.conf.bak

sudo nano /etc/nginx/nginx.conf

 

Open the following file, copy and pasted its content replacing everything in the nginx.conf file

suggested_nginx

 

Note: The indentations or whitespaces are important.

 

Enable the nginx service to start automatically.

sudo systemctl enable nginx

 

Sanity test the nginx config files.

sudo nginx -T | grep -A 10 -B 5 "psmrestservice"

 

Add port 8092 to SELinux if enabled (or whatever port is set for http in the nginx.conf file)

semanage port -a -t http_port_t -p tcp 8092

 

Set NGINX group memberships and permissions:

 

You must give access to the socket file for the nginx user. By default, the socket can be accessed by the psmprestservice group, so the nginx user must be a member of this group.

There are three ways to confirm nginx is in the psmprestservice group

vigrp

There will be a line that looks like: psmprestservice:x:984:nginx

id nginx

The result will include the psmprestservice: uid=985(nginx) gid=983(nginx) groups=983(nginx),984(psmprestservice)

groups nginx

The results will be something like: nginx : nginx psmprestservice

 

If none of these reflect the group membership, you can add it using vigrp and appending the psmprestservice line with :nginx

 

 You must also give the psmprestservice group access to the /var/opt/CARKpsmp/temp directory.

Update directory groups and permissions

chgrp nginx /etc/nginx/users

chmod 640 /etc/nginx/users

chgrp -R psmprestservice /var/opt/CARKpsmp/temp

chmod -R 750 /var/opt/CARKpsmp/temp

 

Then reload NGINX with this command:

sudo systemctl reload nginx

OR

sudo nginx -s reload

 

Secure with HTTPS

Self-Signed Certificate

For production, we recommend that you use a CA-signed certificate instead, but for testing, here's how to generate a Self-Signed Certificate (if needed):

sudo -s

 

sudo mkdir -p /etc/nginx/ssl

 

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \

 -keyout /etc/nginx/ssl/psm-rest-api.key \

 -out /etc/nginx/ssl/psm-rest-api.crt \

 -subj "/C=US/ST=State/L=City/O=CyberArk/OU=PSM/CN=localhost"

 

sudo chown root:root /etc/nginx/ssl/psm-rest-api.*

 

sudo chmod 600 /etc/nginx/ssl/psm-rest-api.*

 

CA Signed Certificate (Recommended)

Generate a private key

sudo -s

openssl genrsa -out /etc/nginx/ssl/psm-rest-api.key 2048

 

Generate a CSR

openssl req -new \

    -key /etc/nginx/ssl/psm-rest-api.key \

    -out /etc/nginx/ssl/psm-rest-api.csr

 

You will be prompted for the certificate details.

Note: Common Name (CN) → must match the site’s FQDN

Example:

Common Name: web01.example.com

 

Note: SANs (Subject Alternative Names) → include IP address, localhost and 127.0.0.1 to cover all bases

 

Open your CSR:

cat /etc/nginx/ssl/server.csr

 

Copy its contents into the CA's enrollment tool.

For AD CS on the domain controller open http://<CA-server>/certsrv → select Request a Certificate → Select Advanced certificate request → Choose Submit a certificate request by using a base-64 encoded… → Select a certificate template such as Web Server (recommended) or Computer → submit the request.

 

Then download the Base64-encoded certificate → server.cer and the CA certificate or the CA chain → ca.cer or ca-chain.cer and copy them to the PSMP server.

 

If the server.cer file is already Base-64 PEM (starts with -----BEGIN CERTIFICATE-----), simply rename and move it:

cd <path to the server.cer and ca.cer | ca-chain.cer files>

sudo -s

mv server.cer /etc/nginx/ssl/psm-rest-api.crt

 

mv ca.cer | ca-chain.cer /etc/nginx/ssl/ca.crt or ca-chain.crt

Adjust the command for whichever files were provided by the CA

 

Otherwise, convert it and the CA or CA-Chain certificate:

cd <path to the server.cer and ca.cer or ca-chain.cer files>

sudo -s

openssl x509 -inform DER -in server.cer -out /etc/nginx/ssl/psm-rest-api.crt

 

openssl x509 -inform DER -in ca.cer | ca-chain.cer -out /etc/nginx/ssl/ca.crt or ca-chain.crt

 

Configure NGINX For HTTPS

Then uncomment the following lines from the /etc/nginx/nginx.conf file (if using the suggested_nginx file):

 

        # PSMP NOTE uncomment later when certificates are setup, replace paths in ssl_certificate and ssl_certificate_key

        listen       443 ssl;

        listen       [::]:443 ssl;

        ssl_certificate /etc/nginx/ssl/psm-rest-api.crt;

        ssl_certificate_key /etc/nginx/ssl/psm-rest-api.key;

        ssl_protocols TLSv1.2 TLSv1.3;

        ssl_ciphers HIGH:!aNULL:!MD5;

 

Add the following line adjusted for either the CA or CA-Chain certificate:

 

        ssl_trusted_certificate /etc/nginx/ssl/ca.crt or ca-chain.crt;

 

Then, restart the nginx and psmpsrv-psmprestservice services

 

systemctl restart nginx

systemctl restart psmpsrv-psmprestservice

 

Test the Connectivity to the Health Check Site

Run the following command to test the site:

curl http://localhost:8092/health -u psmp1:Cyberark1

curl http://localhost:8092/metrics

curl -vk https://localhost/health -u psmp1:Cyberark1

curl -vk https://localhost/metrics

 

Note: Replace psmp1 with the htpasswd user created earlier and replace Cyberark1 with the password selected for that user.

 

Open a web browser (if the server has the GUI enabled) and go to http://localhost:8092/health and http://localhost:8092/metrics. Enter the htpasswd username and password when prompted. To test https, go to https://localhost/health and https://localhost/metrics. Enter the htpasswd username and password when prompted.

 

Usage

The Rest API service provides two endpoints with no arguments:

Endpoint

Description

GET https://hostname/health

Returns PSM for SSH server status in the Health response mode

GET https://hostname/metrics

Returns a json with PSM for SSH server metrics containing the active and maximum number of sessions

 

Troubleshooting

PSM for SSH Rest API service logs are stored in the /var/opt/CARKpsmpext/logs/ directory. To change the logging level, edit the log-level parameter in the configuration file.

 

The Services

To verify the service is running, check the status of psmpsrv-psmprestservice and nginx services. If the services are not running, check the logs for errors.

 

Service Status

systemctl status psmp-psmprestservice

systemctl status nginx

 

Service Logs

journalctl -xeu psmp-psmprestservice.service

journalctl -xeu nginx.service

 

Website/Webhosting Logs

If there are any connectivity issues, check the logs of the HTTP server that is proxying the requests to the PSM for SSH Rest API service. For nginx, by default the log is located in /var/log/nginx/error.log and /var/log/nginx/error.log



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000000k9LCAQ&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail