Commit be1f9586 authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Added X calc container and enabled X formwarding in the SSH container.

parent 2eebb901
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ ChallengeResponseAuthentication no
UsePAM yes
Subsystem   sftp    /usr/lib/ssh/sftp-server
PidFile ${HOME}/custom_ssh/sshd.pid
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no
EOF

# Run

XCalc/Dockerfile

0 → 100644
+20 −0
Original line number Diff line number Diff line
FROM ssh
MAINTAINER Stefano Alberto Russo <stefano.russo@inaf.it>

# Switch to root
USER root

# Install Xclock
RUN apt-get install x11-apps -y

# Fix home permissions
RUN chmod 777 /home

# Set user (mainly for Singularity)
USER metauser

# Set container name
ENV CONTAINER_NAME='XCalc'


XCalc/build.sh

0 → 100755
+3 −0
Original line number Diff line number Diff line
#!/bin/bash

docker build  . -t xcalc
+39 −0
Original line number Diff line number Diff line
#/bin/bash

# Set port
if [ "x$BASE_PORT" == "x" ]; then
    BASE_PORT=22
fi

# Set password
if [ "x$AUTH_PASS" != "x" ]; then
    echo "[INFO] Setting linux password" # In the Dockerflie remove the -e
    echo -e "metapass\n$AUTH_PASS\n$AUTH_PASS" | passwd
fi

# Prepare conf
mkdir ${HOME}/custom_ssh
ssh-keygen -f ${HOME}/custom_ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f ${HOME}/custom_ssh/ssh_host_dsa_key -N '' -t dsa

cat << EOF > ${HOME}/custom_ssh/sshd_config
Port $BASE_PORT
HostKey ${HOME}/custom_ssh/ssh_host_rsa_key
HostKey ${HOME}/custom_ssh/ssh_host_dsa_key
AuthorizedKeysFile  .ssh/authorized_keys
ChallengeResponseAuthentication no
UsePAM yes
Subsystem   sftp    /usr/lib/ssh/sftp-server
PidFile ${HOME}/custom_ssh/sshd.pid
EOF

# Run
echo "[INFO] Now running SSH server on port $BASE_PORT and listening."
/usr/sbin/sshd -D -f ${HOME}/custom_ssh/sshd_config
EXIT_CODE=$?
echo "Exit code: $EXIT_CODE"
if [[ "x$EXIT_CODE" != "x0" ]] && [[ "x$EXIT_CODE" != "x130" ]] ; then
    echo "This exit code is an error, exiting." 
    exit $?
fi
echo ""
 No newline at end of file

XCalc/run.sh

0 → 100755
+2 −0
Original line number Diff line number Diff line
#!/bin/bash
docker run -v$PWD/:/data -p2222:2222 -eAUTH_PASS='testpass' -eBASE_PORT=2222 -it xcalc