Skip to content

CMInfo is a Python tool to quickly query CipherTrust Manager and present the results in readable tables.

License

Notifications You must be signed in to change notification settings

soconnor73/ciphertrust-info

Repository files navigation

Alt text

CMInfo

⚠️ Disclaimer: This script is an independent development and is not affiliated with, endorsed, approved, or supported by Thales Cyber Security Products (Thales CSP). Use this script at your own risk. We disclaim any responsibility for any issues, damages, or liabilities that may arise from its use.

CMINFO is a Python utility that presents CipherTrust information in an easy to visualize format.

Traditionally, the standard ksctl CLI tool returns all results as JSON structured output. This requires parsing the JSON with various methods to present information in a consumable format.

For example, to output a sorted list of keys with interesting fields, you could do the following in a bash shell:

ksctl keys list | jq -r '[.resources[] | {name: .name, algorithm: .algorithm, state: .state}] | sort_by(.name) | .[] | "\(.name), \(.algorithm), \(.state)"'

With cminfo, the same results are displayed with:

cminfo.py key list

Alt text

Contents

Pre-built All-In-One Binaries

Prebuilt binaries for Linux and Windows are available under Releases. Binaries include the Python runtime and required modules.

Source Installation

Prerequisites

  • Python 3.6+
  • Required Python libraries:
    • click
    • json
    • requests
    • urllib3
    • datetime
    • python-dotenv
    • rich
    • tqdm

Install Dependencies

You can install the required libraries using pip:

pip install -r requirements.txt

It is recommended to create a separate environment first using venv or conda.

Optional - Generate Binary

Compiled binaries can be generated using PyInstaller or cx_Freeze. For example, using PyInstaller:

pyinstaller -i .\images\logo.ico --onefile .\cminfo.py

Authentication

cminfo can use parameters, .env file, or environment variables for authentication into CipherTrust.

Option 1: No environment and no parameters

Run without any authentication information in the environment or passed on the CLI, cminfo will prompt for appropriate values.

Option 2: CLI parameters

If run with CLI parameters, cminfo will override any defaults or values received from the environment.

Usage: cminfo.py [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --host TEXT        CipherTrust node FQDN or IP
  -u, --username TEXT    Username
  -p, --password TEXT    Password
  -d, --domain TEXT      Domain
  -a, --authdomain TEXT  Authentication domain
  --debug
  --version              Show the version and exit.
  --help                 Show this message and exit.

For example, the command:

python .\cminfo.py -h cm1.aperture.lab -u admin -d root -a root key list

This prompts only for the password since the other values were provided as parameters.

Option 3: Environment variables

cminfo will check for a .env file in the same directory. This file may provide defaults to the following:

CM_HOST=
CM_USER=
CM_PW=
CM_DOMAIN=root
CM_AUTHDOMAIN=root
CM_LIMIT=100

The same values can also be pulled from the shell environment if no .env file is present.

Usage

Alarm


Alarm List

To list alarms, use the following command:

Usage: cminfo.py alarm list [OPTIONS]

Options:
  -l, --limit TEXT                Maximum number of objects to show
  --state [on|off]
  --severity [info|warning|error|critical]
  --help                          Show this message and exit.

Alt text

CTE


CTE CLIENT LIST

List registered CTE client information:

Usage: cminfo.py cte client list [OPTIONS]

Options:
  -l, --limit TEXT  Maximum number of clients to show
  --help            Show this message and exit.

Alt text

CTE CLIENT HEALTH

Show CTE client health information:

Usage: cminfo.py cte client health [OPTIONS]

Options:
  -l, --limit TEXT  Maximum number of clients to show
  --help            Show this message and exit.

Alt text

CTE GUARDPOINTS

List guardpoints on a specific client:

Usage: cminfo.py cte guardpoints [OPTIONS]

Options:
  -c, --client TEXT  client name or identifier  [required]
  -l, --limit TEXT   Maximum number of clients to show
  --help             Show this message and exit.

Alt text

CTE CLIENT AUTH

Show CTE client authenticated binaries:

Usage: cminfo.py cte client auth [OPTIONS]

Options:
  -c, --client TEXT  client name or identifier  [required]
  --help             Show this message and exit.

Alt text Alt text

Download


Download KSCTL

This is a convenience function to download the ksctl tool package from the CipherTrust Manager.

NOTE: cminfo does not required ksctl to function.

Usage: cminfo.py download ksctl [OPTIONS]

Options:
  -h, --host TEXT  Download from this CipherTrust node
  -p, --path TEXT  Download file to this directory
  --help           Show this message and exit.

Alt text

Interface


Interface List

To list protocol interfaces, use the following command:

Usage: cminfo.py interface list [OPTIONS]

Options:
  -t, --type [kmip|nae|ssh|web]
  --sort [port|interface_type|enabled|minimum_tls_version]
  --help                          Show this message and exit.

Alt text

Key


Key Dates

To list key dates, use the following command:

Usage: cminfo.py key dates [OPTIONS]

Options:
  -l, --limit TEXT                Maximum number of objects to show
  -s, --state [Pre-Active|Active|Deactivated|Destroyed|Compromised|Destroyed Compromised]
  -t, --type [AES|RSA|EC|OPAQUE]
  --help                          Show this message and exit.

Alt text

Key IDs

To list key with all ID values, use the following command:

Usage: cminfo.py key ids [OPTIONS]

Options:
  -l, --limit TEXT                Maximum number of objects to show
  -t, --truncate INTEGER          only show first and last X characters
                                  (default 8)
  -s, --state [Pre-Active|Active|Deactivated|Destroyed|Compromised|Destroyed Compromised]
  -a, --type [AES|RSA|EC|OPAQUE]
  --sort [name|version|state|algorithm|exportable|deletable]
  --latest                        Show only the latest key version
  --help                          Show this message and exit.

Alt text

Key Labels

Display all key labels currently applied to keys.

Usage: cminfo.py key labels [OPTIONS]

Options:
  -l, --limit TEXT  Maximum number of objects to show
  --help            Show this message and exit.

Alt text

Key List

List all keys. Supports filtering by algorithm and state. Sorting is supported by column name.

Usage: cminfo.py key list [OPTIONS]

Options:
  -l, --limit TEXT                Maximum number of objects to show
  -s, --state [Pre-Active|Active|Deactivated|Destroyed|Compromised|Destroyed Compromised]
  -a, --type [AES|RSA|EC|OPAQUE]
  --sort [name|version|state|algorithm|exportable|deletable]
  --latest                        Show only the latest key version
  --help                          Show this message and exit.

Alt text

Key Weak

List all weak keys. Supports filtering by algorithm. Sorting is supported by column name.

Usage: cminfo.py key list [OPTIONS]

Options:
  -l, --limit TEXT                Maximum number of objects to show
  -a, --type [AES|RSA|EC|OPAQUE]
  --sort [name|version|state|algorithm|exportable|deletable]
  --latest                        Show only the latest key version
  --help                          Show this message and exit.

Alt text

Schedule


Schedule List

Show all schedule configurations.

Usage: cminfo.py schedule list [OPTIONS]

Options:
  -l, --limit TEXT                Maximum number of objects to show
  --sort [name|version|state|algorithm|exportable|deletable]

Alt text

Service


Service List

Show the state of all CipherTrust microservices.

Usage: cminfo.py service list [OPTIONS]

Options:
  --help                          Show this message and exit.

Alt text

System


System Info

To CipherTrust node information, use the following command:

Usage: cminfo.py system info

Options:
  --help                          Show this message and exit.

Alt text

User


User Inactive

Show users not logged in for the past X days.

Usage: cminfo.py user inactive [OPTIONS]

Options:
  -l, --limit TEXT  Maximum number of objects to show
  -d, --days TEXT   Consider inactive if not logged in during this window
  --help            Show this message and exit.

Alt text

User Logins

Show login information for each user.

Usage: cminfo.py user logins [OPTIONS]

Options:
  -l, --limit TEXT  Maximum number of objects to show
  --help            Show this message and exit.

Alt text

⚠️ Disclaimer: This script is an independent development and is not affiliated with, endorsed, approved, or supported by Thales Cyber Security Products (Thales CSP). Use this script at your own risk. We disclaim any responsibility for any issues, damages, or liabilities that may arise from its use.

About

CMInfo is a Python tool to quickly query CipherTrust Manager and present the results in readable tables.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages