Skip to main content

csw-tools

A collection of automation utilities for Cisco Secure Workload (CSW, formerly Tetration), available through a single command-line package.

Available Commands

Command Status What it does Docs
init Core Create or replace the user's config.toml. Guide
configure-credentials Core Set user CSW API credentials in the OS keyring Guide
create-scopes Production Create scopes in bulk from .CSV Guide
sync-collection-rules Production Check (and fix) Collection Rules against defined IP sources, such as user labels Guide
clean-stale-labels DEV/TESTING Remove static labels for workloads absent from inventory Guide
convert-labels DEV/TESTING Persist dynamic labels as static labels Guide
prune-agents DEV/TESTING Preview and decommission stale agents and related objects Guide
prune-policy DEV/TESTING Remove or filter entries within a workspace policy Guide

Installation

The project requires Python 3.12 or later. uv is the preferred installation and development tool, although normal Python package installation also works.

Once uv is installed, install the package as a tool:

uv tool install csw-tools

Usage

List the available commands, common options, and project version information:

csw-tools --help
csw-tools --version

Global options must appear before the command name. The command and its own options follow:

csw-tools create-scopes scopes.csv
csw-tools --dashboard my-company.tetrationcloud.com prune-agents
csw-tools -d my-company configure-credentials

Command-generated files use csw-tools-outputs/ in the current working directory and a basic CLI log is enabled by default.

Every command's guide is linked from the tables above. The command help is the authoritative option list:

csw-tools COMMAND --help

CSW Dashboard Selection

A dashboard may be supplied as its short SaaS name, a full FQDN, or an HTTPS origin:

csw-tools -d my-company COMMAND
csw-tools -d my-company.tetrationcloud.com COMMAND
csw-tools -d mycsw.example.org COMMAND
csw-tools -d https://mycsw.example.org COMMAND

A short name is auto-appended by default with .tetrationcloud.com. Any FQDN is used as given with HTTPS. IP addresses and single-label on-premises hosts require HTTPS:// explicitly, such as -d https://192.0.2.10 or -d https://csw-local.

TLS certificate verification is enabled by default. Use --no-dashboard-verify-tls only for a trusted deployment whose certificate cannot be validated normally.

Configuration

Settings are resolved in this order:

  1. CLI arguments
  2. config.toml values
  3. Backend defaults from config_defaults.py
  4. Interactive prompt for an unresolved required value

config.toml is optional but useful for values that are reused often. Create or replace it interactively with:

csw-tools init

This copies the packaged config.example.toml to the OS-native per-user location:

  • macOS: ~/Library/Application Support/csw-tools/config.toml
  • Linux: ${XDG_CONFIG_HOME:-~/.config}/csw-tools/config.toml
  • Windows: %APPDATA%\csw-tools\config.toml

If needed, use --config PATH before the command name to select a different file.

Credentials

Secrets are stored through the operating system keyring. For a dashboard named my-company, the default identifiers are:

Service name Username Stored value
csw-tools:my-company csw:api_key CSW API key
csw-tools:my-company csw:api_secret CSW API secret

Inspect/replace the credential pair with:

csw-tools -d my-company configure-credentials

(If using a CSW Dashboard that is not .tetrationcloud.com, then the full HTTPS url is used instead as part of the service name)

Safe Change Workflow

Most edit/write commands default to --dry-run; review the complete plan before using --apply. Supported commands create a timestamped JSON backup before the first API change in the common output directory and update it around each attempted operation.

Rollback support and limitations differ by command. Read the individual command guide before applying or recovering changes.

Development

See DEV-GUIDELINES.md for architecture, shared APIs, contributor workflow, and project checks.

Metadata

Release files for csw-tools 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csw-tools 0.3.3
File Size Uploaded Provenance Actions
csw_tools-0.3.3.tar.gz 96.4 kB Without provenance Details for csw_tools-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for csw-tools 0.3.3
File Interpreter ABI Platform Actions
csw_tools-0.3.3-py3-none-any.whl Python 3 none any Details for csw_tools-0.3.3-py3-none-any.whl

Total release size: 184.7 kB

Release files / csw_tools-0.3.3.tar.gz

Download URL csw_tools-0.3.3.tar.gz
Size 96.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b7d88f9d8dfe2bf61cf264677770a8a3cfcbac3824479a6740385b2d9c9d20d2
BLAKE2b-256 checksum
How to use checksums
bb24d4340b96d805476514a0da6c9b34c6f1c1b7062042bf5cb3cc6eec129438
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / csw_tools-0.3.3-py3-none-any.whl

Download URL csw_tools-0.3.3-py3-none-any.whl
Size 88.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bf898826dd8596f8a60d66375e448f0e6141ccb04872d458cd9bb321d9374da
BLAKE2b-256 checksum
How to use checksums
371cdd6a8273b128d3458986e7735fad9eff88dd9d1c389bbee5e760ffd346a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for csw-tools 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page