• Stars
    star
    183
  • Rank 205,850 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 9 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🐳 standalone SSH server that connects you to your Docker containers

ssh2docker

🔧 SSH server that can create new Docker containers and/or join existing ones, with session, and dynamic configuration support

SSH chroot with steroids

Build Status GoDoc License

┌────────────┐
│bobby@laptop│
└────────────┘
       
       └──ssh container1@mycorp.biz──┐
                                     
                               ┌──────────┐
┌──────────────────────────────┤ssh2docker├──┐
                              └──────────┘  
              docker exec -it              
                 container1                
          ┌──────/bin/bash──────────┘       
 ┌────────┼───────────────────────────────┐ 
 │docker                                  
 │┌───────▼──┐ ┌──────────┐ ┌──────────┐   
 ││container1│ │container2│ │container3│   
 │└──────────┘ └──────────┘ └──────────┘   
 └────────────────────────────────────────┘ 
└────────────────────────────────────────────┘

Usage

NAME:
   ssh2docker - SSH portal to Docker containers

USAGE:
   ssh2docker [global options] command [command options] [arguments...]

AUTHOR(S):
   Manfred Touron <https://github.com/moul/ssh2docker>

COMMANDS:
   help, h	Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --verbose, -V                 Enable verbose mode
   --syslog-server               Configure a syslog server, i.e: udp://localhost:514
   --bind, -b ":2222"            Listen to address
   --host-key, -k "built-in"     Path or complete SSH host key to use, use 'system' for keys in /etc/ssh
   --allowed-images              List of allowed images, i.e: alpine,ubuntu:trusty,1cf3e6c
   --shell "/bin/sh"             DEFAULT shell
   --docker-run-args "-it --rm"  'docker run' arguments
   --no-join                     Do not join existing containers, always create new ones
   --clean-on-startup            Cleanup Docker containers created by ssh2docker on start
   --password-auth-script 	     Password auth hook file
   --publickey-auth-script 	     Public-key auth hook file
   --local-user 		         If setted, you can spawn a local shell (not withing docker) by SSHing to this user
   --banner 			         Display a banner on connection
   --help, -h			         show help
   --version, -v		         print the version

Example

Server

$ ssh2docker
INFO[0000] Listening on port 2222
INFO[0001] NewClient (0): User="alpine", ClientVersion="5353482d322e302d4f70656e5353485f362e362e317031205562756e74752d327562756e747532"
INFO[0748] NewClient (1): User="ubuntu", ClientVersion="5353482d322e302d4f70656e5353485f362e362e317031205562756e74752d327562756e747532"

Client

$ ssh localhost -p 2222 -l alpine
Host key fingerprint is 59:46:d7:cf:ca:33:be:1f:58:fd:46:c8:ca:5d:56:03
+--[ RSA 2048]----+
|          . .E   |
|         . .  o  |
|          o    +.|
|         +   . .*|
|        S    .oo=|
|           . oB+.|
|            oo.+o|
|              ...|
|              .o.|
+-----------------+

alpine@localhost's password:
/ # cat /etc/alpine-release
3.2.0
/ # ^D
$ ssh localhost -p 2222 -l ubuntu
Host key fingerprint is 59:46:d7:cf:ca:33:be:1f:58:fd:46:c8:ca:5d:56:03
+--[ RSA 2048]----+
|          . .E   |
|         . .  o  |
|          o    +.|
|         +   . .*|
|        S    .oo=|
|           . oB+.|
|            oo.+o|
|              ...|
|              .o.|
+-----------------+

ubuntu@localhost's password:
# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.3 LTS
Release:	14.04
Codename:	trusty
# ^D

Install

Install latest version using Golang (recommended)

$ go get github.com/moul/ssh2docker/cmd/ssh2docker

Install latest version using Homebrew (Mac OS X)

$ brew install https://raw.githubusercontent.com/moul/ssh2docker/master/contrib/homebrew/assh.rb --HEAD

or the latest released version

$ brew install https://raw.githubusercontent.com/moul/ssh2docker/master/contrib/homebrew/assh.rb

Test with Docker

You can test ssh2docker within Docker, but you will have some limitations, i.e: cannot run with boot2docker.

Here is an example about how to use ssh2docker inside Docker

$ docker run --privileged -v /var/lib/docker:/var/lib/docker -it --rm -p 2222:2222 moul/ssh2docker

Changelog

master (unreleased)

  • Support of docker-exec-args in hook scripts and in CLI args
  • Sending environment variables to auth scripts
  • TTY is now dynamic (@quentinperez)
  • Support of exec commands without tty, i.e: git-server, rsync, tftp, ...
  • Support of API hooks for password and public key authentication (#80)
  • Support of exec requests (#51)
  • Support of docker-run-args in hook scripts (#30)
  • Support of --syslog-server + refactored logs (#71)
  • Do not ask for a password if only --publickey-auth-script is present (#72)
  • Code refactor (split in modules), update examples, bump dependencies
  • Support of --syslog-server=unix:///dev/log (#74)

full commits list

v1.2.0 (2015-11-22)

  • Support of --host-key=system to use OpenSSH keys (#45)
  • Support of custom entrypoint (#63)
  • Support of public-key authentication (#2)
  • Handling custom environment variables, user and command in password script (#57)
  • Replacing "_" by "/" on default image name to handle ControlMaster on clients
  • Support of --banner option (#26)
  • Add a not-yet-implemented warning for exec (#51)
  • Support of --local-user option, to allow a specific user to be a local shell (#44)
  • Kill connection when exiting shell (ctrl+D) (#43)

full commits list

v1.1.0 (2015-10-07)

  • Fix runtime error on Linux (#38)
  • Initial version of the native Scaleway support (#36)
  • Support of 'ssh2docker --password-auth-script' options (#28)
  • Add docker support (#17)
  • Add GOXC support to build binaries for multiple architectures (#18)
  • Support of 'ssh2docker --clean-on-startup' (#23)
  • Add homebrew support (#16)
  • Add Changelog (#19)

full commits list

v1.0.1 (2015-09-27)

  • Using party to manage dependencies

full commits list

v1.0.0 (2015-09-27)

Initial release

Features

  • Basic logging
  • Handling environment-variable requests
  • Support of --allowed-images option (#4)
  • Ability to configure docker run arguments (#13)
  • Reconnecting to existing containers (#14)
  • Support of --no-join option (#6)

full commits list

License

MIT

More Repositories

1

assh

💻 make your ssh client smarter
Go
2,868
star
2

awesome-ssh

💻 A curated list of SSH resources.
2,245
star
3

sshportal

🎩 simple, fun and transparent SSH (and telnet) bastion server
Go
1,693
star
4

quicssh

SSH over QUIC
Go
775
star
5

http2curl

📐 Convert Golang's http.Request to CURL command line
Makefile
704
star
6

node-gitlab

DEPRECATED, see https://github.com/node-gitlab/node-gitlab
JavaScript
474
star
7

protoc-gen-gotemplate

📂 generic protocol generator based on golang's text/template (grpc/protobuf)
Go
430
star
8

gotty-client

🔧 terminal client for GoTTY
Go
296
star
9

golang-repo-template

🌀 A template for creating new Golang + Docker + Canonical Domain + Badges + Dependabot + Renovate + GolangCI-lint + Goreleaser + GitHub Actions + Gitpod + Depaware + Git Hooks + ...
Go
274
star
10

zapgorm2

⚡ zap logging driver for gorm v2
Go
246
star
11

alfred-workflow-gauth

🔑 TOTP - Google Authenticator Workflow for Alfred2 (Two-Factor authentication)
Python
238
star
12

docker-diff

🐳 Compare Docker images
Shell
154
star
13

depviz

👓 dependency visualizer for GitHub & GitLab (a.k.a., "auto-roadmap")
Go
139
star
14

grpcbin

httpbin like for gRPC
Go
128
star
15

travis-docker

🐳👨 Docker in Travis-CI
Shell
108
star
16

docker-icecast

📻 Icecast 2 in Dockerfile (Docker container, compatible with liquidsoap)
XSLT
103
star
17

iocat

🔧 Socket.io & WebSocket netcat-like utility
CoffeeScript
83
star
18

number-to-words

convert number into words (english, french, italian, roman, spanish, portuguese, belgium, dutch, swedish, polish, russian, iranian, roman, aegean)
Go
73
star
19

awesome-ascii-art

A curated list of ascii-art resources
49
star
20

docker-kernel-builder

🐧 Kernel build environment in Docker
48
star
21

docker-readthedocs

🐳 ReadTheDocs (RTD, read the docs) in docker
Shell
43
star
22

kafka-gateway

🌊 Kafka Gateway (gRPC/protobuf + http/json)
Go
40
star
23

zapgorm

⚡ Zap logger for GORM (support v1 and v2)
Go
38
star
24

retry

🐚 retry shell commands
Makefile
26
star
25

dockerpatch

🐳 Read, write, manipulate, convert & apply filters to Dockerfiles
Go
24
star
26

radioman

🎵 Web radio solution using Liquidsoap and Icecast
Go
21
star
27

dockerself

🐳 runtime self dockerizer
Go
21
star
28

anonuuid

🔧 Anonymize UUIDs outputs (written in Golang)
Go
20
star
29

chizap

⚡️ simple zap logging middleware for go-chi
Go
20
star
30

node-scaleway

🔧 Online Labs API client in Node.js and browser javascript
JavaScript
19
star
31

pb

C#
18
star
32

scaleway-ipxe

💃 custom IPXE config on Scaleway servers
17
star
33

gno-basics

Gnolang smart contract examples
Go
15
star
34

sapin

🎄 draw a beautiful christmas tree in ascii using Golang
Go
14
star
35

totp-keychain

🔒 TOTP cli backed by the OS X keychain
Go
14
star
36

cleanarch

🚿 the clean architecture, optimised for Golang
Go
14
star
37

grpcbin-example

Go
14
star
38

xbmc-remote-keyboard

📹 Send local keyboard presses to a remote XBMC/Kodi through JSON RPC api (javascript, coffee, ncurses)
CoffeeScript
14
star
39

captcha

🦾 a "Completely Automated Public Turing test to tell Computers and Humans Apart" CLI
Go
13
star
40

golang-boilerplate

🔧 Golang project bootstrap
Makefile
13
star
41

zapfilter

⚡💊 advanced filtering for uber's zap logger
Go
13
star
42

scaleway-cli-node

💻 Interract with Scaleway from command line (Mimics Docker CLI)
JavaScript
12
star
43

acl

👮 ACL micro-service (gRPC/protobuf + http/json)
Go
12
star
44

progress

🏗 progress, steps, completion patterns for golang
Go
12
star
45

node-icecast-admin

📻 Icecast admin nodejs library - used for statistics
JavaScript
12
star
46

stegaporn

8========D The art of hiding sensitive data in porn videos
Shell
11
star
47

docker-liquidsoap

📻 Liquidsoap in Docker - compatible with icecast
Dockerfile
11
star
48

pipotron

generic (& funny?) text generator
Go
11
star
49

bot

🤖 my personal bot / virtual assistant (GitHub, Discord, HTTP+gRPC API, Twitter, Coffee, etc)
Go
11
star
50

translator

🎤 Translator micro-service
Go
10
star
51

image-builder

⚠️ ARCHIVED ⚠️
10
star
52

node-leboncoin

🔧 leboncoin.fr nodejs library
CoffeeScript
10
star
53

node-netsoul

Netsoul client - Epitech, Epita, Ionis
JavaScript
9
star
54

internet-status

📶 Check internet connectivity
Go
9
star
55

totp-cli

🔒 TOTP CLI
Go
8
star
56

docker-coreos-img

🐳 CoreOS image in a docker image
Makefile
8
star
57

generate-fake-data

🧬 CLI to generate fake data for testing
Go
8
star
58

euler

🎲 Project Euler in Golang
Go
8
star
59

shikaku

🀄 Shikaku generator
Go
8
star
60

git-ci

♐ git subcommand to interract with CI/CD from command line
Go
8
star
61

nixpkgs

🧔 personal nix config #nixos
Nix
8
star
62

docker-binfmt-register

🐳 Register Binfmt-support in Docker, works with boot2docker to run armhf images
8
star
63

graphman

graph manipulation library in golang (pert, cpm, dijkstra, ...)
Go
8
star
64

3d-stereo-html5

3d anaglyph / stereoscopic html5 canvas viewer
8
star
65

libmusic

Manipulate Music in Golang
Go
8
star
66

converter

✂️ multiformat data conversion
Go
7
star
67

mbin

:neckbeard: plenty of more-or-less useful scripts I use(d)
Python
7
star
68

irccloud-desktop-app

💻 IRC Cloud Desktop Application (irccloud.com)
CSS
7
star
69

cryptoguess

Automatically detect and parse cryptography keys
Go
7
star
70

ascii2svg

Go
7
star
71

conf-du-loose

💀🔫 Hacked
Shell
7
star
72

as-a-service

👨 Me, as a service
Go
7
star
73

pkgman

📱 Package manipulation tool & library (ipa, etc)
Go
7
star
74

drunken-bishop

Drunken Bishop algorithm for Ascii-Art representation of Fingerprint
Makefile
7
star
75

image-tools-v1

⚠️ Archives ⚠️ Image Tools - Scripts to build images on Online Labs
7
star
76

hacker-typing

☠️🏴‍☠️🦜 impress your friends :)
Makefile
7
star
77

port-docker-image

🐳 Script to port Docker image on armhf architecture
Shell
7
star
78

u

🔬 Go common utility functions
Go
7
star
79

go-dl-extract

🐳 "curl | tar xf" as a static binary - ADD compressed tarball url on Docker scratch
Go
6
star
80

godev

A collection of helpers I use during Golang development
Makefile
6
star
81

amiga-ball

AMIGA!!!
HTML
6
star
82

tapas-icecast-analytics

Icecast Web Analytics using Tapas (nodejs)
CoffeeScript
6
star
83

docker-drupal

🐳 run Drupal in Docker
Shell
6
star
84

runcache

🔧 shell command caching
Shell
6
star
85

node-slumber

🔧 Port of Python's slumber library -- (RESTful API library)
CoffeeScript
6
star
86

guilhunize

Speak like Guilhem
Makefile
6
star
87

testman

😎 `go test` wrapper for advanced testing workflows in Go
Go
6
star
88

banner

lightweight Golang ascii-art text generator
Go
6
star
89

node-alfred-workflow

👨 Create Alfred Workflow with NodeJS (wrapper)
Python
6
star
90

awesome

awesome
Go
6
star
91

alfred-workflow-chromecast

👨 Chromecast Workflow for Alfred2
Python
6
star
92

docker-plan9port

🐳 plan9port in Docker
Dockerfile
6
star
93

term.js-cli

🔧 A command line interface client for term.js / tty.js
CoffeeScript
6
star
94

funcenter

function-level middlewares in golang
Go
6
star
95

image-service-travis

💽 WIP Official Travis-CI worker image on Online Labs
Makefile
6
star
96

zapring

💍 In-memory RING buffer backend for the Zap logger
Go
6
star
97

docker-emacs

🐳 run Emacs server in Docker
Emacs Lisp
5
star
98

wiki

✌️ life wiki
5
star
99

comments

GitHub-Based discussions for some posts of my website
HTML
5
star
100

music-paint

paint-based midi controller
Makefile
5
star