Giter Club home page Giter Club logo

docker-ssh-agent-forward's Introduction

Forward SSH agent socket into a container

Still experimental -- contact [email protected] if you want help.

Installation

Assuming you have a /usr/local

$ git clone git://github.com/avsm/docker-ssh-agent-forward
$ make
$ make install

On every boot, do:

$ pinata-ssh-forward

and the you can run pinata-ssh-mount to get a Docker CLI fragment that adds the SSH agent socket and set SSH_AUTH_SOCK within the container.

$ pinata-ssh-mount 
-v /Users/avsm/.pinata-sshd/ssh-1azk9Mmd27/agent.16:/tmp/ssh-agent.sock --env SSH_AUTH_SOCK=/tmp/ssh-agent.sock

$ docker run -it `pinata-ssh-mount` ocaml/opam ssh [email protected]
The authenticity of host 'github.com (192.30.252.128)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi avsm! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

Contributors

  • Justin Cormack

License is ISC.

docker-ssh-agent-forward's People

Contributors

avsm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-ssh-agent-forward's Issues

Improve usability

I think usability could be greatly improved here.
Here's what I have in mind:

  1. User has a wrapper script for her project, run.sh
  2. User copies scripts from this project to her project.
  3. User modifies run.sh script to have this:
cd ssh-agent-forward
. ./ssh-agent-forward.sh
cd ..
docker-compose up ...
  1. User creates an ssh script ./docker/ssh_keys to be run inside a targeted docker container:
cat <<EOF >> ~/.ssh/config
Host *
User $SSH_USER
EOF
  1. User modifies docker-compose.yml to have this:
environment:
  SSH_AUTH_SOCK: $SSH_AUTH_SOCK
  SSH_USER: $USER # can override in docker-compose.override.yml
command: sh -c "./docker/ssh_keys"

For this to work, SSH forward script should run the thing (skip if it's already done) and export SSH_AUTH_SOCK variable.

Working fork

I see some unmerged PR's attempting to fix issues. Even with those PRs I was not able to make this work on my system. Also since this has not been updated since 2 years I searched for alternatives.

If you, like me, just search for a working solution, you can try https://github.com/abrugh/docker-ssh-agent-forward. It's a fork of this one and worked right out of the box for me.

Documentation

I think this project could benefit from an illustration:
docker and ssh

I hope it's a correct representation of what's going on here.

Release Tag

I was wondering if you could tag v1 release so we can have a specific SHA for a stable release.
Many thanks.

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.