A key’s day

Part 3 recap · Systems

Systems: the short version

You can’t clean up every copy. You can make every copy useless.

Take the full lesson Part 4 recap: Agents

Where the copies are

Issued by the payment service, then 5 copies:

  1. Service settings
  2. Container image on the build machine
  3. Container registry
  4. Central log platform
  5. Cloud storage backup

The day, step by step

  1. Meet the key · Day 1, 9:00 AM Meet the key.
  2. Environment · Day 1, 9:30 AM Set as an environment variable.
  3. Container image · Day 1, 10:00 AM Baked into a container image.
  4. Registry · Day 1, 10:05 AM Pushed to a registry many teams pull from.
  5. Logs · Day 1, 10:30 AM Printed in the logs and shipped to a log platform.
  6. Storage · Day 2, 2:00 AM Backed up to cloud storage overnight.
  7. Sprawl · Day 30 Nobody chose to share it. It’s in five places.
  8. Detect · Day 30, 9:00 AM TruffleHog reads the registry, logs, and backups.
  9. Verify · Day 30, 9:05 AM Is it still live?
  10. Analyze and notify · Day 30, 9:20 AM Sized by what the key can do, then sent to its owner.
  11. Rotate · Day 30, 11:00 AM Swap in a new key.
  12. Confirm · Day 30, 11:15 AM Confirmed: the old key is dead.

How it ended

Swap in a new key. Every step before this found the problem. This step removes it, for every copy at once.

Confirmed: the old key is dead. The copies are harmless now, because their key is off.

Try it with TruffleHog open source

Install TruffleHog first; its README lists the options. Run these only on folders, images and buckets you’re allowed to scan.

  1. Settings. Scans a folder and the files in it, such as the service’s settings file.

    trufflehog filesystem ./checkout
  2. Image. Scans a container image on the build machine.

    trufflehog docker --image docker://example/checkout:latest --results=verified
  3. Registry. Scans an image straight from a registry, the same copy other teams pull.

    trufflehog docker --image example/checkout:latest --results=verified
  4. Storage. Scans an S3 bucket with the credentials already set on the machine.

    trufflehog s3 --bucket=example-checkout-backups --results=verified,unknown

Keep going