Sign inSign up

stevenaldinger/docker-blackbox

By stevenaldinger

•Updated about 8 years ago

Intended to wrap a git repository (mounted as a volume) and manage secret files with GPG encryption.

Image
0

778

stevenaldinger/docker-blackbox repository overview

⁠BlackBox Docker Image

This allows you to mount a git repo as a volume in the container and manage it with BlackBox⁠ and your host machine's ~/.ssh and ~/.gnupg directories.

⁠Building docker image

In the Makefile⁠ there are commands for both building and pushing the image to DockerHub⁠.

# Builds an image named 'stevenaldinger/docker-blackbox:latest'
make build \
  dockerhub_user='stevenaldinger' \
  version="latest"
# Pushes an image to 'stevenaldinger/docker-blackbox:latest'
make push \
  dockerhub_user='stevenaldinger' \
  version="latest"

⁠Usage

In general, when you run this docker image it will set your git user name/email, make sure the gpg agent is running, and create a directory named .blackbox if it doesn't already exist in the directory mounted at /repo to store your BlackBox config⁠ in. Then it will run any command you pass in.

⁠Example Docker Run
  1. cd into the git repo you want to manage with the image.

Then run the container as a daemon:

docker run --rm --name blackbox \
  -e GIT_USER_NAME="$(git config --get user.name)" \
  -e GIT_USER_EMAIL="$(git config --get user.email)" \
  -v $(pwd)/:/repo/ \
  -v "$HOME/.ssh":/root/.ssh \
  -v "$HOME/.gnupg":/root/.gnupg \
  -d stevenaldinger/docker-blackbox:latest \
  tail -f /dev/null
  1. cd into docker-blackbox/examples/⁠
  2. Run ./01.initialize-repo.sh⁠ script
  3. Export your gpg key email address:
export GPG_KEY_EMAIL_ADDRESS='[email protected]'
  1. Run ./02.add-admin.sh⁠ to add yourself as a BlackBox admin.
  2. Run ./03.create-sensitive-file.sh⁠ to create a .env file.
  3. Run ./04.cat-sensitive-file.sh⁠ to view the encrypted .env file.
  4. Run ./05.edit-sensitive-file.sh⁠ to edit the encrypted .env file.
  5. Run docker kill blackbox to finish up.
⁠Example Usage

The docker-compose.yml⁠ configuration runs tail -f /dev/null inside the container to keep it running and then the example files can be used to execute BlackBox commands inside the container.

For an example of how this image⁠ works:

  1. Set some important environment variables:
# used in the docker-compose.yml file
export GIT_USER_EMAIL="[email protected]"
export GIT_USER_NAME="Steven Aldinger"
# used in some of the example scripts
export GPG_KEY_EMAIL_ADDRESS='[email protected]'
  1. Run docker-compose up -d
  • runs a stevenaldinger/docker-blackbox:latest container named blackbox
  • creates a new directory ./example-repo on the host machine for usage the example scripts
  1. Run through each script in order in the examples/⁠ directory.
⁠Example Scripts

A directory of example scripts can be found at examples/⁠ and include:

  1. Initializing a new repo with BlackBox⁠
  2. Adding a BlackBox admin⁠
  3. Creating a sensitive .env file and encrypting it⁠
  4. Viewing the encrypted .env file⁠
  5. Editing the encrypted .env file⁠
  6. Leaving the .env file temporarily decrypted⁠
  7. Re-encrypt the .env file⁠
  8. Removing sensitive file from BlackBox⁠

Tag summary

Content type

Image

Digest

Size

110.9 MB

Last updated

about 8 years ago

docker pull stevenaldinger/docker-blackbox