Thales CTM Connector User Guide

Instructions for deploying the Thales CTM Connector to scan for cryptographic assets and deliver findings to the AgileSec Platform for processing and analysis.

Overview

The Thales CTM Connector integrates Thales CipherTrust Manager with Keyfactor's AgileSec Platform. This Connector allows discovery, inventory, and analysis of cryptographic keys managed by a Thales CipherTrust Manager instance.

What Gets Scanned

The Thales CTM Connector can discover the following cryptographic asset types:

  • Cryptographic Keys: All symmetric and asymmetric cryptographic keys managed by CipherTrust Manager.

  • Key Metadata: Key attributes, algorithms, sizes, states, usage operations, labels, aliases, and fingerprints.

  • Public Key Material: RSA, DSA, and ECDSA public key components for asymmetric keys.

Prerequisites

Ensure you meet the following requirements to enable scanning.

Network Access

Ensure HTTPS network connectivity from AgileSec platform or remote execution machine to the CipherTrust Manager server.

Supported Authentication Methods

The Thales CTM Connector supports two authentication methods:

1. All Execution Methods: Basic Authentication (Username and Password)

Standard username/password authentication against the CipherTrust Manager is available for Platform, API, and Remote Scan Executions.

  • Configure username, password, domain, and optionally auth_domain fields

  • domain defaults to root if not specified

2. Remote Scan Execution Only: mTLS Certificate Authentication

MTLS (certificate-based) authentication is available for Remote Scan Execution only:

  • Requires a client_id (obtained during client registration)

  • Requires client_certificate and client_private_key file paths

  • Optionally specify root_ca to verify the CipherTrust Manager server certificate

There are two methods to setup mTLS authentication for the Thales CTM Connector:

  • Using a Local CA from Thales CTM

  • Using an External CA

init.sh

The init.sh script is provided below to gather the configuration parameters required for mTLS authentication. This script is not required; other methods may be used to create the authentication client and certificate materials.

The script will output the client_id, client_certificate path, client_private_key path, and root_ca.

init.sh

Ensure you assign correct script variables before running the script. Note csr_file is only needed if using a Local Thales CTM CA and cert_file is only needed if using an External CA.

init.sh input variable

Local CA from Thales CTM or External CA

Description

token

Both

Thales registration token. Note the client name, either specified or random. See instructions below.

Example client name: ISG_ThalesCTM

url

Both

Thales CTM base URL.

csr_file

Local CA

Path to CSR file to request certificates from Thales CTM CA. CSR generation instructions are included below.

cert_file

External CA

Path to certificate file signed by external CA.

#!/bin/bash

token="<Thales CTM token>"
url="<base_url>"
csr_file="<path/to/csr.pem>"
cert_file="<path/to/cert.pem>"
name="<token client name>"

usage() {
  echo "Usage: $0 --url $url --token $token (--csr $csr_file | --cert $cert_file) [--name $name]"
  exit 1
}

# Parse command-line arguments
while [[ "$#" -gt 0 ]]; do
    case $1 in
        --url) url="$2"; shift ;;
        --csr) csr_file="$2"; shift ;;
        --cert) cert_file="$2"; shift ;;
        --token) token="$2"; shift ;;
        --name) name="$2"; shift ;;
        *) echo "Unknown parameter passed: $1"; usage ;;
    esac
    shift
done

# Check if all required arguments are provided
if [[ -z "$url" || -z "$token" || ( -z "$csr_file" && -z "$cert_file" )]]; then
    usage
fi


if [[ "${url: -1}" != "/" ]]; then
  url="${url}/"
fi

if [[ ! -z "$csr_file" ]]; then
  # Read CSR file and replace newlines with \n, making it single line
  csr=$(sed ':a;N;$!ba;s/\n/\\n/g' "$csr_file")

  json_payload=$'{
    "name": "'"$name"'",
    "registration_token": "'"$token"'",
    "csr": "'"$csr"'"
  }'
else
  # Read cert file and replace newlines with \n, making it single line
  cert=$(cat $cert_file | jq -R --slurp)
  json_payload=$'{
    "name": "'"$name"'",
    "registration_token": "'"$token"'",
    "client_cert_params": {
      "certificate": '"$cert"'
    }
  }'
fi

echo ">>>"
echo "$json_payload"
echo "<<<"

response=$(curl -s -k "${url}api/v1/client-management/clients/" \
  -H "Content-Type: application/json" \
  -H "accept: application/json" \
  --data-binary "$json_payload" \
  --fail-with-body)
rc=$?
if [ $rc -ne 0 ]; then
  echo "The request failed, rc: $rc"
  curl -s -k "${url}api/v1/client-management/clients/" \
    -H "Content-Type: application/json" \
    -H "accept: application/json" \
    --data-binary "$json_payload" \
    -vvv
  exit 1
fi

# Extract the cert
echo -e "Saving certificate into cert.pem"
cert=$(echo "$response" | jq -r '.cert')
echo -e "$cert" | sed 's/\\n/\n/g' > cert.pem

# Extract the root ca
echo -e "Saving root ca certificate into rootca.pem"
rootca=$(echo "$response" | jq -r '.ca_cert')
echo -e "$rootca" | sed 's/\\n/\n/g' > rootca.pem

# Print the client_id required for connector.
id=$(echo "$response" | jq -r '.id')
echo -e "client_id: $id"
2.1 Using Local CA from Thales CTM
Using Local CA from Thales CTM
  1. Create a new registration token.

    1. Inside the Thales CTM UI, go to Access Management > Registration Tokens.

  2. Register a new client by sending a CSR to Thales:

    1. Create a CSR (CA > CSR Generator). Fill in Common Name, algorithm, name, etc.

    2. Download the private key and the CSR from the UI: CSR.pem, privateKey.pem

    3. Run the provided init.sh or equivalent to get the certificate and root CA from Thales:

      Bash
      ./init.sh --csr "/path/to/csr.pem" --url "<https://url.com/>" --token "<registration token>"
      
  3. In the Thales CTM UI, set the ISG_ThalesCTM client groups (Access Management > Client Hub).

  4. Note client_id, client_certificate path, client_private_key path, and, for remote scan executions, root_ca for configuration.

2.2 Using External CA
Using External CA

Enable External CA

  1. Add the External CA to Thales CTM through the Thales CTM UI.

    1. Go to CA > External > Click Add External CA

    2. Set the Client Auth permission for the External CA to Enabled.

  2. Add the External CA as a Trusted CA.

    1. Go to Admin Settings > Interfaces > View/Edit web > scroll down to add the External CA to External Trusted CA.

  3. Create a Registration Token for the External CA.

    1. Go to Access Management > Registration Tokens > Add Registration Token > At Select CA choose the External CA.

  4. Restart Thales CTM to enable changes.

Create Client

  1. You should have a Private Key and Client Certificate signed by the External CA.

  2. The Client Certificate should have the Common Name in the subject.

  3. Grant the required permission (e.g., Key Admins) to the created Client (Access Management > Client Hub).

  4. Run the provided init.sh or equivalent to create the client and download the root CA from Thales:

    Bash
    ./init.sh --url https://thales.ctm.local --token <Registration Token> --cert <client cert file> --name <cert common name>
    
  5. Note client_id, client_certificate path, client_private_key path, and, for remote scan executions, root_ca for configuration.

Thales CTM Required Access Rights

The authenticated user must have the following permissions:

Permission

Purpose

ReadKey

Query Keys from /v1/vault/keys2/ endpoint

Remote Execution Requirements

If running the Connector remotely using CLI, the remote execution machine must meet these requirements:

Component

Requirement

Operating System

  • Linux (x86_64, x86_64): Ubuntu 18.04+, RHEL 9+, CentOS 8+, Debian 10+

RAM

Minimum 500 mb (0.5 GB) to enable API calls and data streaming.

Disk Space

Minimal; scans are API-driven and findings are streamed to the AgileSec platform. No data is stored on disk.

Permissions

Read/write access to remote sensor working directory (remote sensor install location)


Running the Connector

AgileSec Thales CTM scans can be executed using the following methods:

  1. Platform Scan Execution: Configure and execute scans directly through the Keyfactor AgileSec web UI with on-demand or scheduled execution options.

  2. API Scan Execution: Programmatically trigger scans through REST API calls, enabling integration with CI/CD pipelines and automation workflows.

  3. Remote Scan Execution: Deploy and run the connector via CLI on customer-managed infrastructure for scenarios such as:

    1. Scanning air-gapped or internal instances the platform cannot directly reach

    2. Customers wanting to manage their own scheduling and execution environment.

Refer to Scan Execution Flows for additional scan execution information.

Connectors/Sensors Note: Connectors are considered a subset of Sensors. Sensors and Connectors utilize the same Unified Sensor Framework, but Sensors use the Host Sensor for additional scanning depth.

“Sensor”-labeled variables for API and Remote execution are common to both Sensors and Connectors. Unless specified, do NOT update these with “Connector”.

Configuration Fields

The following parameters are used to configure AgileSec Thales CTM scans.

Field Name

UI Display Name

Type

Required

Description

base_url

CipherTrust URL

String

✅ Yes

The base URL of the CipherTrust Manager instance

username

Username

String

✅ Yes if using password auth

Username for password authentication

password

Password

String

✅ Yes if using password auth

Password for password authentication

domain

Domain

String

❌ No

CipherTrust Manager connection domain. Default: root

auth_domain

Auth Domain

String

❌ No

Authentication domain, if different from domain.

Remote and API Scan Execution Parameters

In addition to the above, the following parameters are available for remote and API scan executions only.

Field Name

Type

Required

Description

client_id

String

✅ Yes if using mTLS auth

Client ID for mTLS authentication (obtained from init.sh in mTLS instructions above).

client_certificate

String

✅ Yes if using mTLS auth

Path to client certificate for mTLS authentication.

client_private_key

String

✅ Yes if using mTLS auth

Path to client private key for mTLS authentication.

page_limit

Number

❌ No

Number of results per API page for pagination of large key inventories.

Defaults to 1000.

root_ca

String

❌ No

REMOTE EXECUTION ONLY. NOT AVAILABLE FOR API SCANS.

Path to root CA certificate file.

If not specified, certificate verification is disabled.

Platform Scan Execution

Running scans through the user interface is the simplest and fastest way to get started. The platform enables running on-demand or scheduled scans in a dedicated environment.

Platform Scan Configuration

  1. Open your browser and navigate to the Keyfactor AgileSec Platform Web URL

  2. Log in with your credentials

  3. Click on "Sensors" in the left navigation menu under Scan

    image-20260616-210209.png
  4. Click "+ New Sensor".

    image-20260616-210325.png
  5. Click on the correct card to open the configuration interface.

Configure Parameters and Start Scan
  1. Fill in the required configuration parameters.

  2. Click Save.

  3. Click Action then Scan to begin a scan.
    Note: Click Edit to reconfigure parameters.

    image-20260616-214857.png

API Scan Execution

Scans may be programmatically triggered through REST API calls, enabling seamless integration with CI/CD pipelines, automation workflows, and custom applications. API execution provides flexibility for developers to incorporate cryptographic scanning into their existing development and deployment processes.

Note: For complete API reference, see API.

Generate AgileSec API Access Token

  1. Open your browser and navigate to AgileSec Platform UI

  2. Log in with your Keyfactor credentials

  3. Click "Access Tokens" in the main navigation menu

  4. Click "Generate Token" button

  5. Set Token Type to API Token and provide the required details

  6. Click "Generate" and copy the generated token

    image-20260616-212437.png

AgileSec API Endpoint

POST https://<platform-url>/v3/scan/create/

Request Format

Headers
Content-Type: application/json
isg-api-token: <your-api-token>
Request Body
JSON
  {
    "sensorName": "<sensor name>",
    "sensorType": "Thales CTM",
    "sensorConfig": {
       "base_url": "<ciphertrust manager url>",
       "username": "<username>",
       "password": "<password>",
       "domain": "root",
       "auth_domain": "root"
    },
    "callbackId": "<callback id>",
    "labels": [
        {
            "<label name>": "<label value>"
        }
    ],
    "priority": "<priority>"
  }

Remote Scan Execution

Scans may be run on remote host machines with the AgileSec Remote Sensor Package.

Download Remote Sensor Package
  1. Open your browser and navigate to the Keyfactor AgileSec Platform Web URL

  2. Log in with your credentials

  3. Click on "Sensors" in the left navigation menu under Scan

    image-20260616-210209.png
  4. Click Remote Scan.

    image-20260616-220921.png
  5. Click + Download Remote Sensor.

    image-20260616-221015.png
  6. Download the sensor binary for your remote machine’s operating system

    image-20260616-221050.png
Generate Platform Token
  1. In the Download Remote UI, click "Generate Token"

  2. Copy the generated token

  3. Store securely in an environment variable such as SENSOR_TOKEN:

     export SENSOR_TOKEN="your-generated-token"
    
Create Configuration File

Create a YAML configuration file (e.g., thales_ctm-config.yml) with your scan settings. An example configuration can be found in config/sample-configs/thales_ctm.yml.

Step 4: Run the Connector

Execute the Connector with your configuration file:

  • Linux/macOS

    Bash
    # Set environment variables
    export SENSOR_TOKEN="your-sensor-token"
    
    # Run Connector
    ./unified_sensor_linux -c thales_ctm-config.yml
    
  • Windows (PowerShell)

    PowerShell
    # Set environment variables
    $env:SENSOR_TOKEN = "your-sensor-token"
    
    # Run Connector
    .\\unified_sensor_windows.exe -c .\\thales_ctm-config.yml
    

Remote Scan Execution Configuration Examples

  • Username/Password Auth Example

    YAML
    scan_config:
      plugins:
        - thales_ctm
        - export
      config:
        thales_ctm:
          name: thales
          plugin_config:
            base_url: "<https://ciphertrust.company.com>"
            username: "${env:CTM_USER}"
            password: "${env:CTM_PASS}"
            domain: "root"
             # auth_domain: ""
             # client_id: ""
             # client_certificate: "/path/to/cert.pem"
             # client_private_key: "/path/to/privateKey.pem"
             # root_ca: "/path/to/rootca.pem"
             # interval: 60
             # page_limit: 100
    
  • mTLS Auth Example

    YAML
    scan_config:
      plugins:
        - thales_ctm
        - export
      config:
        thales_ctm:
          name: thales
          plugin_config:
            base_url: "<https://ciphertrust.company.com>"
            client_id: "3ec05d42-72f0-45aa-8196-f17d73a2f9f0"
            client_certificate: "/path/to/cert.pem"
            client_private_key: "/path/to/privateKey.pem"
            root_ca: "/path/to/rootca.pem"
            # auth_domain: ""
            # root_ca: "/path/to/rootca.pem"
            # interval: 60
            # page_limit: 100
    

Known Limitations

Authentication

mTLS authentication requires certificate and key files accessible at the specified paths on the machine running the Connector.

Pagination

Very large key inventories may require tuning the page_limit setting for optimal performance.

Troubleshooting Common Errors

  • CONFIG-404 – Unable to read/parse configuration file

    • Cause: The configuration file path is incorrect or the file is malformed.

    • Fix: Verify the config file path and validate JSON syntax.

  • CONFIG-500 – No Thales CTM scan target defined

    • Cause: A required configuration field is missing.

    • Fix: Ensure base_url is provided.

  • Authorization Error

    • Cause: Invalid credentials, expired certificate, or incorrect client_id.

    • Fix: Verify credentials or regenerate client certificate. Check domain and auth_domain settings.

  • No Thales CTM scan target defined

    • Cause: base_url is empty.

    • Fix: Set the base_url to the CipherTrust Manager URL.

Getting Support

Collect diagnostic information:

  • Connector version

  • Configuration file (redact credentials and keys)

  • Log output

  • CipherTrust Manager details (URL, version)

Contact Support