2.1. Docker

_images/logo_docker.png

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications. It only works on Linux.

2.1.1. Install prequesites

How does it works? First of all, you need install Docker on your Linux host:

  • Docker: easily create containers

2.1.2. Run Dockerfile

Once done, on your machine install the MySecureShell Dockerfile:

$ docker build -t mysecureshell \
https://raw.githubusercontent.com/mysecureshell/mysecureshell/master/deployment-tools/docker/Dockerfile

Here is the content of the Dockerfile:

FROM debian:stable
MAINTAINER Pierre Mavro <deimos@deimos.fr>

##################
# User Quick Try #
##################

RUN echo 'deb http://mysecureshell.free.fr/repository/index.php/debian/7.1 testing main' \
> /etc/apt/sources.list.d/mysecureshell.list
RUN echo 'deb-src http://mysecureshell.free.fr/repository/index.php/debian/7.1 testing main' \
>> /etc/apt/sources.list.d/mysecureshell.list
RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys E328F22B
RUN gpg --export E328F22B | apt-key add -
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" \
 -o Dpkg::Options::="--force-confold" install mysecureshell whois procps openssh-server
RUN apt-get clean
RUN mkdir /var/run/sshd
RUN pass=$(mkpasswd -m sha-512 -s mssuser) && useradd -m -s /usr/bin/mysecureshell -p $pass mssuser
RUN echo 'root:root' | chpasswd
RUN chmod 4755 /usr/bin/mysecureshell

# Start SSHd
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]

2.1.3. Boot the container

You can now launch the Docker container:

$ docker run -d -p 22222:22 mysecureshell

2.1.4. Connect and test

MySecureShell is now ready to serve! From your host machine, you can connect with user mssuser and mssuser for the password:

$ sftp -P 22222 mssuser@127.0.0.1
mssuser@127.0.0.1's password:
Connected to 127.0.0.1.
sftp> ls
sftp> pwd
Remote working directory: /

In parallel, connect from your host machine to the Virtual Machine (root password is root):

$ ssh -p 22222 root@127.0.0.1

and see the current connected user with sftp-who command:

$ sftp-who
--- 1 / 10 clients ---
Global used bandwith : 0 bytes/s / 0 bytes/s
PID: 3389   Name: mssuser   IP:
    Home: /home/mssuser
    Status: idle    Path: /
    File:
    Connected: 2014/08/19 15:38:27 [since 10s]
    Speed: Download: 0 bytes/s [5.00 kbytes/s]  Upload: 0 bytes/s [unlimited]
    Total: Download: 1398 bytes   Upload: 141 bytes

You can see the connected user :-). You can try to upload files to see the result. Of course you can use graphical clients. And if you want to play with the server configuration, look at /etc/ssh/sftp_config.