Skip to content

Enabling new ssh auth features #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#FROM gliderlabs/alpine
FROM mhart/alpine-node:6.2.0
FROM mhart/alpine-node:14

WORKDIR /src
ADD . .

RUN apk --update add python make g++ nodejs \
RUN apk --update add python3 make g++ nodejs \
&& npm install \
&& apk del make gcc g++ python \
&& apk del make gcc g++ python3 \
&& rm -rf /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp


# make coffee executable
RUN chmod +x ./node_modules/coffee-script/bin/coffee
RUN chmod +x ./node_modules/coffeescript/bin/coffee

# Connect to container with name/id
ENV CONTAINER=
Expand All @@ -31,6 +31,6 @@ ENV HTTP_ENABLED=true
# HTTP Port
ENV HTTP_PORT=8022

EXPOSE 22 8022
EXPOSE 22

CMD ["npm", "start"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Docker-SSH

SSH Server for Docker containers
This is an extension of [Docker-SSH](https://github.com/jeroenpeeters/docker-ssh) which adds capability of logging in into multiple Docker containers.
This is an extension of [Docker-SSH](https://github.com/maxivak/docker-ssh) which adds capability of logging in into multiple Docker containers updated for 2022

Run one Docker SSH server through which you can connect to multiple Docker containers depending on user.

Expand All @@ -15,7 +15,7 @@ Features:

* build Docker image
```
docker build -t docker-ssh github.com/maxivak/docker-ssh
docker build -t docker-ssh github.com/g-alfieri/docker-ssh
```

* run SSH server in Docker container
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "docker-ssh",
"version": "1.0.0",
"version": "0.5",
"description": "Provides SSH capabilities to any Docker container",
"repository": "https://github.com/jeroenpeeters/docker-ssh",
"repository": "https://github.com/g-alfieri/docker-ssh",
"main": "server.coffee",
"scripts": {
"start": "./node_modules/forever/bin/forever -c ./node_modules/coffee-script/bin/coffee server.coffee | ./node_modules/bunyan/bin/bunyan",
"start": "./node_modules/forever/bin/forever -c ./node_modules/coffeescript/bin/coffee server.coffee | ./node_modules/bunyan/bin/bunyan",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "GPL-2.0",
"dependencies": {
"body-parser": "~1.14.1",
"bunyan": "~1.5.1",
"coffee-script": "~1.10.0",
"dockerode": "^2.2.9",
"express": "~4.13.3",
"forever": "^0.15.1",
"ssh2": "~0.4.11",
"ssh2-connect": "0.0.7",
"body-parser": "~1.20.1",
"bunyan": "~1.8.15",
"coffeescript": "2.7.0",
"dockerode": "^3.3.4",
"express": "~4.18.2",
"forever": "^4.0.3",
"ssh2": "~1.11.0",
"ssh2-connect": "3.4.1",
"buffer-equal-constant-time": "1.0.1",
"uuid": "~2.0.1"
"uuid": "~9.0.0"
}
}
11 changes: 3 additions & 8 deletions server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@ fs = require 'fs'
ssh2 = require 'ssh2'
bunyan = require 'bunyan'
log = bunyan.createLogger name: 'sshServer'

webserver = require './src/webserver'
handlerFactory = require './src/session-handler-factory'

sshPort = process.env.PORT or 22
httpPort = process.env.HTTP_PORT or 80
httpEnabled = process.env.HTTP_ENABLED or true
ip = process.env.IP or '0.0.0.0'
keypath = process.env.KEYPATH
container = process.env.CONTAINER
shell = process.env.CONTAINER_SHELL
authMechanism = process.env.AUTH_MECHANISM
authenticationHandler = require('./src/auth') authMechanism

httpEnabled = httpEnabled == 'true' || httpEnabled == true

exitOnConfigError = (errorMessage) ->
console.error "Configuration error: #{errorMessage}"
process.exit(1)
Expand All @@ -29,7 +24,9 @@ exitOnConfigError 'No AUTH_MECHANISM specified' unless authMechani
exitOnConfigError "Unknown AUTH_MECHANISM: #{authMechanism}" unless authenticationHandler

options =
privateKey: fs.readFileSync keypath
{
hostKeys: [fs.readFileSync(keypath)]
}

sessionFactory = handlerFactory container, shell

Expand Down Expand Up @@ -64,5 +61,3 @@ sshServer = new ssh2.Server options, (client, info) ->
sshServer.listen sshPort, ip, ->
log.info 'Docker-SSH ~ Because every container should be accessible'
log.info {host: @address().address, port: @address().port}, 'Listening'

webserver.start httpPort, sessionFactory if httpEnabled
10 changes: 0 additions & 10 deletions src/public/css/term.css

This file was deleted.

75 changes: 0 additions & 75 deletions src/public/index.html

This file was deleted.

5 changes: 0 additions & 5 deletions src/public/js/jquery-1.11.3.min.js

This file was deleted.

Loading