Public | Automated Build

Last pushed: 2 days ago
Short Description
Dockerized OpenSSH on Alpine Linux to be used as a jump host
Full Description

ssh-jumper

Run an OpenSSH service to be used as a jump host

Building

$ docker build -t 4km3/ssh-jumper .

Configuration

Default values

: "${LOCAL_USER_ID:=9001}"
: "${LOCAL_USER_NAME:=luser}"

Recommended values

By passing these values when running:

LOCAL_USER_ID=$(id -u $USER)
LOCAL_USER_NAME=$USER

you will be able to share both the UID and the user name from the host machine.

Running

Add some actual pub keys to $PWD/authorized_keys,
and then run the container like this:

$ docker run                                                            \
    -d                                                                  \
    -p 2222:22                                                          \
    --name ssh-jumper                                                   \
    -e LOCAL_USER_NAME="${USER}"                                        \
    -e LOCAL_USER_ID=$(id -u "${USER}")                                 \
    -v $PWD/authorized_keys:/home/"${USER}"/.ssh/authorized_keys:ro     \
    4km3/ssh-jumper

Testing

We find it useful to use these settings for repeatedly testing the ssh-jumper container:

$ ssh                                   \
    -o StrictHostKeyChecking=no         \
    -o UserKnownHostsFile=/dev/null     \
    -i id_ed25519-jumper                \
    -p 2222                             \
    localhost                           \
    -W localhost:22

If everything goes OK, you should see something like:

Warning: Permanently added '[localhost]:2222' (ECDSA) to the list of known hosts.
SSH-2.0-OpenSSH_7.2p2-hpn14v4

And, upon pressing Enter,

Protocol mismatch.

Sample usage

$ ssh -i id_ed25519-jumper localhost -p 2222 -W somehost:22

Acknowledgements

Thanks a lot to Raúl Sánchez @rawmind0 for his assistance!

Docker Pull Command
Owner
4km3
Source Repository

Comments (0)