buildkite/docker-ssh-env-config

Name: docker-ssh-env-config

Owner: Buildkite

Description: Sets up SSH config files within a container based on environment variables

Created: 2015-10-26 03:10:05.0

Updated: 2018-03-20 10:13:42.0

Pushed: 2016-02-25 06:51:01.0

Homepage: null

Size: 8

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

docker-ssh-env-config

A Docker entrypoint wrapper which sets up SSH config files based on the following environment variables:

You can also provide base64 encoded versions by adding _B64 to the end of the environment variable (e.g. SSH_PRIVATE_RSA_KEY_B64, useful for environments that don't support newlines) and _PATH for specifying a file to get the contents from (e.g. SSH_PRIVATE_RSA_KEY_PATH, useful for secret stores mounted as volumes).

Things to keep in mind:

Usage

After adding it to the Dockerfile:



u should use a commit hash rather than "master" in your own version of the below
curl -fL "https://raw.githubusercontent.com/buildkite/docker-ssh-env-config/master/ssh-env-config.sh" -o /usr/local/bin/ssh-env-config.sh \
&& chmod +x /usr/local/bin/ssh-env-config.sh \

YPOINT ["ssh-env-config.sh","some-command"]

You can then configure SSH via environment variables:

er run -e SSH_KNOWN_HOSTS="$(< ~/.ssh/known_hosts)" ...

Or you can pass in the base64 encoded version by appending _B64:

er run -e SSH_KNOWN_HOSTS_B64="$(base64 < ~/.ssh/known_hosts)" ...

Or you can pass a path to a file with the contents by appending _PATH:

er run -e SSH_KNOWN_HOSTS_PATH="/mnt/secrets/known-hosts" ...
Testing
sts.sh || echo "Boo, tests failed."

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.