Giter VIP home page Giter VIP logo

ssh-agent's Introduction

the pygmy stack - ssh-agent image

This image is a multiarchitecture compatible docker image

Originally derived from whilp/ssh-agent it builds a docker image with openssh pre-installed and configured.

Usage

1. Run a long-lived container named ssh-agent.

This container declares a volume that hosts the agent's socket so that other invocations of the ssh client can interact with it.

docker run -d --name=ssh-agent pygmystack/ssh-agent:latest

2. Add your ssh keys

Run a temporary container which has access to both the volumes from the long-lived ssh-agent container as well as a volume mounted from your host that includes your SSH keys. This container will only be used to load the keys into the long-lived ssh-agent container. Run the following command once for each key you wish to make available through the ssh-agent:

docker run --rm --volumes-from=ssh-agent -v ~/.ssh:/ssh -it pygmystack/ssh-agent:latest ssh-add /ssh/<host_key_file_name>

3. (optional) Add known_hosts

Host key verification failed is common if known_hosts are not setup. Hosts such as github.com or bitbucket.org will require host key validation. Follow this step to copy any known_hosts from your host to the ssh-agent.

docker run --rm --volumes-from=ssh-agent -v ~/.ssh:/ssh -it pygmystack/ssh-agent:latest cp /ssh/known_hosts /root/.ssh/known_hosts

4. Access via other containers

Now, other containers can access the keys via the ssh-agent by setting the SSH_AUTH_SOCK environment variable.

Example 1 - List Keys

docker run --rm -it --volumes-from=ssh-agent -e SSH_AUTH_SOCK=/root/.ssh/socket ubuntu /bin/bash -c "apt-get install -y openssh-client && ssh-add -l"

Example 2 - Test known_hosts

Test optional known_hosts configuration (assuming you followed step 3 above and have Github keys setup)

docker run --rm -it --volumes-from=ssh-agent -e SSH_AUTH_SOCK=/root/.ssh/socket ubuntu /bin/bash -c "apt-get install -y openssh-client && ssh -T [email protected]"

Compatibility

This approach is tested with:

  • OSX / Virtualbox / docker-machine

ssh-agent's People

Contributors

jwilger avatar renovate[bot] avatar rosskevin avatar schnitzel avatar tobybellwood avatar whilp avatar

Stargazers

 avatar

Watchers

 avatar  avatar

ssh-agent's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • alpine 3.19
github-actions
.github/workflows/build_and_test.yml
  • actions/checkout v4
  • docker/metadata-action v5
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • docker/login-action v3
  • docker/login-action v3
  • docker/build-push-action v5
  • actions/checkout v4
  • docker/metadata-action v5
  • jacobtomlinson/gha-find-replace v3
  • ubuntu 22.04

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.