IBM Sterling Secure Proxy: Create Engine using RESTAPI

From Wiki
Revision as of 18:13, 17 June 2024 by Ebasso (talk | contribs) (→‎POST Create Engine)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Creating a Session on SSP using cURL

This article demonstrates how to create a session on an SSP (Security Service Provider) using a cURL command.

Before running the cURL command, you need the following:

  • ssp_cm_url: The URL of the SSP instance.
  • ssp_admin_user: The admin username for SSP.
  • ssp_admin_password: The admin password for SSP.

So run command:

curl -k -X POST "https://<ssp_cm_url>/sspcmrest/sspcm/rest/session" \
    -H "Content-Type: application/json" \
    -d '{"userId":"<ssp_admin_user>","password":"<ssp_admin_password>"}'

At response check for sessionToken: ..., save output for later

You need to add sessionToken in header X-Authentication: <session_token>

Create an Engine on SSP using cURL

Below a sample shell that create a session and create an engine.

#!/bin/sh
# Set variables
ssp_cm_url="<ssp_cm_url>"
session_token="<session_token>"
ssp_engine_description="<ssp_engine_description>"
ssp_engine_host="<ssp_engine_host>"
ssp_engine_name="<ssp_engine_name>"

# Create XML body
xml_body=$(cat <<EOF
<engineDef>
 <certicomLogging>ERROR</certicomLogging>
 <debugLogging>ERROR</debugLogging>
 <description><![CDATA[$ssp_engine_description]]></description>
 <enableAuditLogCMRouting>false</enableAuditLogCMRouting>
 <host>$ssp_engine_host</host>
 <localPSLogging>ERROR</localPSLogging>
 <maverickLogging>ERROR</maverickLogging>
 <name>$ssp_engine_name</name>
 <port>65535</port>
 <properties>
   <property>
     <name>proxy.host.name.or.ip</name>
     <value>xx.xx.xx.xx</value>
   </property>
 </properties>
 <status></status>
 <userStore>defUserStore</userStore>
</engineDef>
EOF
)

# Create Engine on SSP
response=$(curl -k -X POST "https://$ssp_cm_url/sspcmrest/sspcm/rest/engine/createEngine" \
    -H "X-Authentication: $session_token" \
    -H "Content-Type: application/xml" \
    -d "$xml_body")

# Display response
echo "Response: $response"


POST Create Engine

Rest API URL:

https://<servername>:8443/sspcmrest/sspcm/rest/engine/createEngine

Header:

X-Authentication: $session_token
Content-Type: application/xml

XML Request Body:

<engineDef>
 <certicomLogging>ERROR</certicomLogging>
 <debugLogging>ERROR</debugLogging>
 <description><![CDATA[$ssp_engine_description]]></description>
 <enableAuditLogCMRouting>false</enableAuditLogCMRouting>
 <host>$ssp_engine_host</host>
 <localPSLogging>ERROR</localPSLogging>
 <maverickLogging>ERROR</maverickLogging>
 <name>$ssp_engine_name</name>
 <port>65535</port>
 <properties>
   <property>
     <name>proxy.host.name.or.ip</name>
     <value>xx.xx.xx.xx</value>
   </property>
 </properties>
 <status></status>
 <userStore>defUserStore</userStore>
</engineDef>

Ver também