├── docker-compose.yml ├── run.sh ├── Dockerfile └── README.md /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | wetty: 5 | image: svenihoney/wetty 6 | environment: 7 | - VIRTUAL_HOST=wetty.example.com 8 | - VIRTUAL_PORT=3000 9 | - LETSENCRYPT_HOST=wetty.example.com 10 | - LETSENCRYPT_EMAIL=webmaster@example.com 11 | - REMOTE_SSH_SERVER=ssh.example.com 12 | - REMOTE_SSH_PORT=22 13 | - REMOTE_SSH_USER=root 14 | 15 | nginx-proxy: 16 | image: jwilder/nginx-proxy 17 | container_name: nginx-proxy 18 | ports: 19 | - "80:80" 20 | volumes: 21 | - /var/run/docker.sock:/tmp/docker.sock:ro -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${BASE}" == "x" ]; then 4 | BASE="/" 5 | fi 6 | 7 | if [ "x${REMOTE_SSH_SERVER}" == "x" ]; then 8 | # Login mode, no SSH_SERVER 9 | npm start -- -p ${WETTY_PORT} 10 | else 11 | # SSH connect mode 12 | # 13 | # Preload key 14 | mkdir ~/.ssh && \ 15 | ssh-keyscan -H -p ${REMOTE_SSH_PORT} ${REMOTE_SSH_SERVER} > ~/.ssh/known_hosts 16 | 17 | cmd="npm start -- -p ${WETTY_PORT} --sshhost ${REMOTE_SSH_SERVER} --sshport ${REMOTE_SSH_PORT} --base ${BASE}" 18 | if ! [ "x${REMOTE_SSH_USER}" == "x" ]; then 19 | cmd="${cmd} --sshuser ${REMOTE_SSH_USER}" 20 | fi 21 | if ! [ "x${SSH_AUTH}" == "x" ]; then 22 | cmd="${cmd} --sshauth ${SSH_AUTH}" 23 | fi 24 | if ! [ "x${KNOWN_HOSTS}" == "x" ]; then 25 | cmd="${cmd} --knownhosts ${KNOWNHOSTS}" 26 | fi 27 | if ! [ "x${SSH_KEY}" == "x" ]; then 28 | cmd="${cmd} --sshkey ${SSH_KEY}" 29 | fi 30 | su -c "${cmd}" node 31 | fi 32 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:carbon-alpine as builder 2 | RUN apk add -U build-base python git 3 | WORKDIR /app 4 | #COPY . /app 5 | RUN git clone https://github.com/butlerx/wetty /app && \ 6 | git checkout d0aaa35dbfcb30d8739c22cb3226238ad23a6d7d && \ 7 | yarn && \ 8 | yarn build && \ 9 | yarn install --production --ignore-scripts --prefer-offline 10 | 11 | FROM node:carbon-alpine 12 | LABEL maintainer="Sven Fischer " 13 | WORKDIR /app 14 | ENV NODE_ENV=production 15 | EXPOSE 3000 16 | COPY --from=builder /app/dist /app/dist 17 | COPY --from=builder /app/node_modules /app/node_modules 18 | COPY --from=builder /app/package.json /app/package.json 19 | COPY --from=builder /app/index.js /app/index.js 20 | RUN apk add -U openssh-client sshpass 21 | # 22 | ADD run.sh /app 23 | 24 | # Default ENV params used by wetty 25 | ENV REMOTE_SSH_SERVER=127.0.0.1 \ 26 | REMOTE_SSH_PORT=22 \ 27 | WETTY_PORT=3000 28 | 29 | EXPOSE 3000 30 | 31 | ENTRYPOINT "./run.sh" 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Dockerized Wetty 2 | ================ 3 | 4 | This project has been archived, since the changes have been incorporated in the [wetty](https://github.com/butlerx/wetty) project itself. 5 | Please use the wetty containers instead of this one. 6 | 7 | This is a dockerized version of Wetty butlerx (https://github.com/butlerx/wetty), 8 | with additional ideas from Robert Szymczak (https://github.com/m451/docker-wetty). Both docker images available in these 9 | repositories are node base, with sized up to 1G. This one is based on alpine-node, which gives 10 | a docker image of around 30MB with all npm modules. 11 | 12 | This project is linked to the docker hub, so you may always pull the latest build from any docker environment. 13 | 14 | ``` 15 | docker pull svenihoney/wetty 16 | ``` 17 | 18 | Then you can run the application using: 19 | 20 | ``` 21 | docker run -dt -e REMOTE_SSH_SERVER=10.10.10.10 -e REMOTE_SSH_PORT=22 -e REMOTE_SSH_USER=root -p 3000 --name term svenihoney/wetty 22 | ``` 23 | The environment parameters 24 | 25 | - REMOTE_SSH_SERVER 26 | - REMOTE_SSH_PORT 27 | - REMOTE_SSH_USER 28 | - WETTY_PORT 29 | 30 | are optional and will be used to configure wetty. If not set, a connection to 127.0.0.1:22 using root will be performed. 31 | In order to access the web application, you have to get the IP and PORT it is hosted at within your docker environment. 32 | You may use "docker ps" or "docker inspect" to get the informations. The following command will return the external PORT back the container is mapped back to you. 33 | 34 | ``` 35 | docker port term 3000 36 | ``` 37 | 38 | You may then access the application using http://DockerHostIP:PORT. You may dynamicly change the login-user by utilizing wetty's HTTP GET syntax, e.g.: 39 | 40 | ``` 41 | http://DockerHostIP:PORT/ssh/your-ssh-user 42 | ``` 43 | 44 | Reverse Proxy 45 | ------------- 46 | 47 | I recommend running the image behind a nginx proxy. Please have a look at https://github.com/jwilder/nginx-proxy, 48 | which is used by the included ![docker compose](docker-compose.yml) file. 49 | 50 | SSH Keyfiles 51 | ------------- 52 | 53 | You can set the following environmental variables to use SSH keyfiles: 54 | 55 | - SSH_AUTH=publickey 56 | - SSH_KEY=/path/to/key 57 | 58 | Example: 59 | ``` 60 | docker run -dt -e REMOTE_SSH_SERVER=10.10.10.10 -e REMOTE_SSH_PORT=22 -e REMOTE_SSH_USER=root -p 3000 --name term -e 'SSH_AUTH=publickey' -e 'SSH_KEY=/config/id_rsa' -v /path/to/key/id_rsa:/config/id_rsa:ro svenihoney/wetty 61 | ``` 62 | 63 | SSH Host Checking 64 | ------------- 65 | 66 | You can enable strict host checking with the following options: 67 | 68 | - `-e KNOWNHOSTS=/path/to/known/hosts` 69 | - `-v /path/to/known/hosts:/path/to/known/hosts` 70 | 71 | 72 | Example: 73 | ``` 74 | docker run -dt -e REMOTE_SSH_SERVER=10.10.10.10 -e REMOTE_SSH_PORT=22 -e REMOTE_SSH_USER=root -p 3000 --name term -e 'KNOWNHOSTS=/config/known_hosts' -v '/path/to/known/hosts:/config/known_hosts' svenihoney/wetty 75 | ``` 76 | --------------------------------------------------------------------------------