A simple ssh bastion using public keys and google authenticator to keep things safe.
10K+
A simple ssh bastion using public keys and google authenticator to keep things safe.
SSH host keys will be generated on demand upon launch. You might want to
store them in a separate data container to have them persist when upgrading
or similar. For this purpose the volume /etc/ssh is defined and may used like:
$ docker volume create bastion-keys
$ docker run -v "bastion-keys:/etc/ssh" -p 2222:22 neochrome/bastion:latest
The user bastion is used for connection:
$ ssh bastion@hostname
When connecting to the bastion, google-authenticator will be run in order to
setup two-factor authentication unless existing settings are present.
If you want to share the generated authentication settings between multiple bastions or have them persisted when upgrading or similar, use a volume like this:
$ docker volume create bastion-ga
$ docker run -v "bastion-ga:/bastion" -p 2222:22 neochrome/bastion:latest
If you have existing authentication settings that you want to use, you may
mount those as /.google_authenticator and they will be copied in place
upon launch.
You may also use a data container to handle both volumes (/etc/ssh and /bastion)
together. E.g:
$ docker create --name bastion-data neochrome/bastion:latest
$ docker run --volumes-from bastion-data -p 2222:22 neochrome/bastion:latest
In order to authenticate, public keys need to be made available to the bastion. This may be done in a couple of different ways:
authorized_keys file as /authorized_keys,
the container will then copy the authorized_keys file in place and set correct permissions
upon launch.FROM neochrome/bastion:latest) and add the key(s) to
/bastion/authorized_keys, don't forget to set owner to bastion:users./bastion/authorized_keys file with correct ownership set
and mounted as /bastion.The image comes without a /etc/motd file. If you want one, you may either:
/motd and then the container will copy it in place upon launch./etc/motd.Content type
Image
Digest
sha256:cce072826…
Size
8.4 MB
Last updated
over 1 year ago
docker pull neochrome/bastion