- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
12-11-2024 07:37 AM
I have a client need to call the CCP load balanced URL from a Linux server using certificate based authentication. I have the working Posh example from Windows, but wondering if anyone has gotten this to work from Linux.
12-11-2024 09:21 AM
#!/bin/bash
# Variables
URL="AAMServer.company.com"
AIMWEB="AIMWebService"
SAFE="SafeName"
APPID="APPIDName"
ACCOUNTOBJECTNAME="OBJECTID_NAME"
Reason="REASONFORPASSWORDPULL"
# Client certificate and key (update these paths as necessary)
CLIENT_CERT="./client.pem"
CLIENT_KEY="./privkey.pem"
# Headers
headers=("Content-Type: application/json")
# Function to make the API request
function get_account_info {
# Create a temporary unencrypted key
TEMP_KEY=$(mktemp)
openssl rsa -in "$CLIENT_KEY" -out "$TEMP_KEY"
response=$(curl -k --insecure -s -G "https://$URL/$AIMWEB/api/Accounts" \
--data-urlencode "AppID=$APPID" \
--data-urlencode "Safe=$SAFE" \
--data-urlencode "Object=$ACCOUNTOBJECTNAME" \
--data-urlencode "Reason=$Reason" \
-H "${headers[@]}" \
--cert "$CLIENT_CERT" \
--key "$TEMP_KEY")
# Clean up the temporary key
rm -f "$TEMP_KEY"
echo "$response"
}
# Initial API call
response=$(get_account_info)
echo $response
# Check if password change is in process
password_change=$(echo "$response" | grep -o '"PasswordChangeInProcess": *"[^"]*"' | awk -F: '{print $2}' | tr -d ' "')
# Extract Username and Password
UserName=$(echo "$response" | grep -o '"UserName": *"[^"]*"' | awk -F: '{print $2}' | tr -d ' "')
Password=$(echo "$response" | grep -o '"Content": *"[^"]*"' | awk -F: '{print $2}' | tr -d ' "')
# Output results (optional)
echo "Username: $UserName"
echo "Password: $Password"This should work for you
12-11-2024 09:21 AM
#!/bin/bash
# Variables
URL="AAMServer.company.com"
AIMWEB="AIMWebService"
SAFE="SafeName"
APPID="APPIDName"
ACCOUNTOBJECTNAME="OBJECTID_NAME"
Reason="REASONFORPASSWORDPULL"
# Client certificate and key (update these paths as necessary)
CLIENT_CERT="./client.pem"
CLIENT_KEY="./privkey.pem"
# Headers
headers=("Content-Type: application/json")
# Function to make the API request
function get_account_info {
# Create a temporary unencrypted key
TEMP_KEY=$(mktemp)
openssl rsa -in "$CLIENT_KEY" -out "$TEMP_KEY"
response=$(curl -k --insecure -s -G "https://$URL/$AIMWEB/api/Accounts" \
--data-urlencode "AppID=$APPID" \
--data-urlencode "Safe=$SAFE" \
--data-urlencode "Object=$ACCOUNTOBJECTNAME" \
--data-urlencode "Reason=$Reason" \
-H "${headers[@]}" \
--cert "$CLIENT_CERT" \
--key "$TEMP_KEY")
# Clean up the temporary key
rm -f "$TEMP_KEY"
echo "$response"
}
# Initial API call
response=$(get_account_info)
echo $response
# Check if password change is in process
password_change=$(echo "$response" | grep -o '"PasswordChangeInProcess": *"[^"]*"' | awk -F: '{print $2}' | tr -d ' "')
# Extract Username and Password
UserName=$(echo "$response" | grep -o '"UserName": *"[^"]*"' | awk -F: '{print $2}' | tr -d ' "')
Password=$(echo "$response" | grep -o '"Content": *"[^"]*"' | awk -F: '{print $2}' | tr -d ' "')
# Output results (optional)
echo "Username: $UserName"
echo "Password: $Password"This should work for you
12-11-2024 09:26 AM
This is wonderful! Much appreciated.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!

