Skip to main content

CLI for managing Tracebit canary credentials on headless servers

Project description

tracebit-python

PyPI Python License transrights enbyware pluralmade

Python CLI for deploying Tracebit canary credentials on headless servers.

Tracebit provides canary tokens — fake credentials that trigger alerts when used by an attacker. Their official CLI requires browser-based OAuth, which doesn't work on headless servers. This tool uses the Tracebit API directly with pre-generated API tokens.

Installation

pip install tracebit-python

Or from source:

git clone https://github.com/SiteRelEnby/tracebit-python
cd tracebit-python
pip install -e .

Quick Start

1. Get an API token

Log in to community.tracebit.com and create an API token from the web UI.

2. Configure

tracebit configure
# paste your API token when prompted

Or use an environment variable:

export TRACEBIT_API_TOKEN=your-token-here

3. Deploy a canary

tracebit deploy aws --profile staging

This issues canary AWS credentials from Tracebit, writes them to ~/.aws/credentials under the specified profile, and confirms the deployment. If anyone (or anything) uses these credentials, Tracebit fires an alert.

4. Test it

tracebit trigger aws

Runs aws sts get-caller-identity against the canary profile. You should see an alert on the Tracebit dashboard within a few minutes.

5. Keep credentials fresh

Canary credentials expire after ~24 hours. Set up a cron job to refresh them:

# crontab -e
0 */12 * * * /path/to/tracebit refresh

Commands

tracebit configure [TOKEN]

Save an API token to ~/.config/tracebit/token. Reads from argument, stdin, or interactive prompt.

tracebit deploy aws

Issue and deploy canary AWS credentials.

Option Default Description
--name hostname Credential name (shown on Tracebit dashboard)
--profile staging AWS profile name in ~/.aws/credentials
--region from API AWS region
--labels Metadata as key=value pairs
--force Replace existing profile (expires old canary first)

Choose a realistic profile name — staging, backup, legacy-admin, etc. The whole point is for these to look like real credentials to an attacker.

tracebit refresh

Re-issue any credentials expiring within the given threshold. Designed to run from cron.

Option Default Description
--hours 13 Refresh credentials expiring within this many hours

With 24h credentials and a 12h cron, the default of 13 hours ensures every cron run refreshes credentials.

tracebit trigger aws

Test-fire a canary by calling aws sts get-caller-identity with the canary profile. Requires the AWS CLI to be installed.

Option Default Description
--name first found Credential name to trigger

tracebit show

Display deployed canary credentials, their profiles, and expiration status.

tracebit remove

Remove canary credentials locally and expire them on Tracebit's server.

Option Default Description
--name all Name of credential to remove

Global Options

Option Description
--token TOKEN API token (overrides env var and config file)
--base-url URL Override Tracebit API URL
--json JSON output (where supported)

Token Resolution

The API token is resolved in this order:

  1. --token command-line flag
  2. TRACEBIT_API_TOKEN environment variable
  3. ~/.config/tracebit/token file

How It Works

  1. Issue — requests canary AWS credentials from the Tracebit API
  2. Deploy — writes them to ~/.aws/credentials and ~/.aws/config under the chosen profile name
  3. Confirm — tells Tracebit the credentials were deployed, so it starts monitoring for usage
  4. Alert — any AWS API call using these credentials triggers a detection on the Tracebit dashboard

The credentials have an explicit deny policy — they can't actually do anything in AWS. But any attempt to use them (by an attacker who found them on disk, in a config file, etc.) is logged and alerted on.

File Permissions

  • ~/.aws/ directory: 0700
  • ~/.aws/credentials, ~/.aws/config: 0600
  • ~/.config/tracebit/token: 0600
  • ~/.config/tracebit/state.json: 0600

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracebit_python-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tracebit_python-0.1.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file tracebit_python-0.1.0.tar.gz.

File metadata

  • Download URL: tracebit_python-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tracebit_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5f72dfd1e4a808111476f839e991cc87296ff95f5aaae3e4eb0340a7f907953f
MD5 befdb50e353c3b72f9ce99fa60ebde96
BLAKE2b-256 364be297c0a17fe6b461abf45490aba4b2d96554a5f92024d47aed6d23c4bd03

See more details on using hashes here.

Provenance

The following attestation bundles were made for tracebit_python-0.1.0.tar.gz:

Publisher: release.yml on SiteRelEnby/tracebit-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tracebit_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tracebit_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df6e799aa54531520a53c79d82752038d0afb49ca4f41c9b7cb41329cfc066c0
MD5 f131537f1a2f5b697f9bc647c5c8b070
BLAKE2b-256 8df9a6c5f4bbdc02300cbbcb3b2e629240fa712916e428efcdd61a467598f92a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tracebit_python-0.1.0-py3-none-any.whl:

Publisher: release.yml on SiteRelEnby/tracebit-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page