All Projects → nardeas → Ssh Agent

nardeas / Ssh Agent

Docker container for SSH agent forwarding on OSX/Linux

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Ssh Agent

Trezor Agent
Hardware-based SSH/PGP agent
Stars: ✭ 400 (+212.5%)
Mutual labels:  agent, ssh
Tmux Cssh
ClusterSSH with tmux
Stars: ✭ 123 (-3.91%)
Mutual labels:  ssh
Doom Net Pytorch
Reinforcement learning models in ViZDoom environment
Stars: ✭ 113 (-11.72%)
Mutual labels:  agent
Notebook
我的技术笔记本~
Stars: ✭ 118 (-7.81%)
Mutual labels:  ssh
Sshserver
This is a tutorial on how to build a basic SSH Server in C#, but you are welcome to try following in any language.
Stars: ✭ 114 (-10.94%)
Mutual labels:  ssh
Next Terminal
Next Terminal是一个轻量级堡垒机系统,易安装,易使用,支持RDP、SSH、VNC、Telnet、Kubernetes协议。
Stars: ✭ 2,354 (+1739.06%)
Mutual labels:  ssh
Superputty
The SuperPuTTY Window Manager for putty sessions
Stars: ✭ 1,572 (+1128.13%)
Mutual labels:  ssh
Awesome Ssh
💻 A curated list of SSH resources.
Stars: ✭ 1,742 (+1260.94%)
Mutual labels:  ssh
Plunder
A Modern automation platform
Stars: ✭ 121 (-5.47%)
Mutual labels:  ssh
Xxh
🚀 Bring your favorite shell wherever you go through the ssh.
Stars: ✭ 2,559 (+1899.22%)
Mutual labels:  ssh
Ssh Login Alert Telegram
Recieive telegram notfications when user connect to a server
Stars: ✭ 117 (-8.59%)
Mutual labels:  ssh
Quicssh
SSH over QUIC
Stars: ✭ 116 (-9.37%)
Mutual labels:  ssh
Getssl
obtain free SSL certificates from letsencrypt ACME server Suitable for automating the process on remote servers.
Stars: ✭ 1,687 (+1217.97%)
Mutual labels:  ssh
Addon Ssh
SSH & Web Terminal - Home Assistant Community Add-ons
Stars: ✭ 114 (-10.94%)
Mutual labels:  ssh
Mainframer Intellij Plugin
An intellij idea plugin for mainframer project
Stars: ✭ 125 (-2.34%)
Mutual labels:  ssh
Jvm Profiler
JVM Profiler Sending Metrics to Kafka, Console Output or Custom Reporter
Stars: ✭ 1,558 (+1117.19%)
Mutual labels:  agent
Gitnow
Speed up your Git workflow. 🐠
Stars: ✭ 117 (-8.59%)
Mutual labels:  ssh
Nassh Relay
Relay Server for the Secure Shell Chromium plugin
Stars: ✭ 118 (-7.81%)
Mutual labels:  ssh
Pssh
Parallel SSH Tools
Stars: ✭ 127 (-0.78%)
Mutual labels:  ssh
Sish
HTTP(S)/WS(S)/TCP Tunnels to localhost using only SSH.
Stars: ✭ 2,087 (+1530.47%)
Mutual labels:  ssh

Docker SSH Agent

Pulls Size

Lets you store your SSH authentication keys in a dockerized ssh-agent that can provide the SSH authentication socket for other containers. Works in OSX and Linux environments.

Why?

On OSX you cannot simply forward your authentication socket to a docker container to be able to e.g clone private repositories that you have access to. You don't want to copy your private key to all containers either. The solution is to add your keys only once to a long-lived ssh-agent container that can be used by other containers and stopped when not needed anymore.

hub.docker.com

You can pull the image from DockerHub via

docker pull nardeas/ssh-agent

How to use

Quickstart

If you don't want to build your own images, here's a 3-step guide:

1. Run agent

docker run -d --name=ssh-agent nardeas/ssh-agent

2. Add your keys

docker run --rm --volumes-from=ssh-agent -v ~/.ssh:/.ssh -it nardeas/ssh-agent ssh-add /root/.ssh/id_rsa

3. Now run your actual container:

docker run -it --volumes-from=ssh-agent -e SSH_AUTH_SOCK=/.ssh-agent/socket ubuntu:latest /bin/bash

Run script

You can run the run.sh script which will build the images for you, launch the ssh-agent and add your keys. If your keys are password protected (hopefully) you will just need to input your passphrase.

Launch everything:

./run.sh

Remove your keys from ssh-agent and stop container:

./run.sh -s

Step by step

0. Build

Navigate to the project directory and launch the following command to build the image:

docker build -t docker-ssh-agent:latest -f Dockerfile .

1. Run a long-lived container

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

2. Add your ssh keys

Run a temporary container with volume mounted from host that includes your SSH keys. SSH key id_rsa will be added to ssh-agent (you can replace id_rsa with your key name):

docker run --rm --volumes-from=ssh-agent -v ~/.ssh:/.ssh -it docker-ssh-agent:latest ssh-add /root/.ssh/id_rsa

The ssh-agent container is now ready to use.

3. Add ssh-agent socket to other container:

If you're using docker-compose this is how you forward the socket to a container:

  volumes_from:
    - ssh-agent
  environment:
    - SSH_AUTH_SOCK=/.ssh-agent/socket
For non-root users

The above only works for root. ssh-agent socket is accessible only to the user which started this agent or for root user. So other users don't have access to /.ssh-agent/socket. If you have another user in your container you should do the following:

  1. Install socat utility in your container
  2. Make proxy-socket in your container:
sudo socat UNIX-LISTEN:~/.ssh/socket,fork UNIX-CONNECT:/.ssh-agent/socket &
  1. Change the owner of this proxy-socket
sudo chown $(id -u) ~/.ssh/socket
  1. You will need to use different SSH_AUTH_SOCK for this user:
SSH_AUTH_SOCK=~/.ssh/socket
Without docker-compose

Here's an example how to run a Ubuntu container that uses the ssh authentication socket:

docker run -it --volumes-from=ssh-agent -e SSH_AUTH_SOCK=/.ssh-agent/socket ubuntu:latest /bin/bash

Deleting keys from the container

Run a temporary container and delete all known keys from ssh-agent:

docker run --rm --volumes-from=ssh-agent -it docker-ssh-agent:latest ssh-add -D
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].