Docker, Compose and Swarm
Containers are replaced on every deploy, so give each service one canary in the environment file or secret it already loads. Give the Docker host itself a per-machine canary too.
Compose
Write the decoy to an environment file that only you can read, next to the service's other secrets:
umask 077
curl -fsSL https://get.snitchwallet.com | sh -s -- --decoy env:- --name prod-compose > ./secrets/payout.envLoad it in the service:
services:
api:
env_file:
- ./secrets/payout.envKeep ./secrets/ out of git, like your other secrets.
docker run
docker run --env-file ./secrets/payout.env your-imageSwarm
Create a Swarm secret straight from the pipe:
curl -fsSL https://get.snitchwallet.com | sh -s -- --decoy env:- --name prod-swarm | docker secret create payout_signer -Give it to the service; each container sees it at /run/secrets/payout_signer:
services:
api:
secrets:
- payout_signer
secrets:
payout_signer:
external: trueNever in the image
Don't COPY a decoy into an image or set it with ENV in a Dockerfile. Images get pushed, cached and pulled to many places, so a canary in one can't tell you where it leaked.