diff --git a/SSH/files/entrypoint.sh b/SSH/files/entrypoint.sh index 02db98c1295b8ae0aaf5d9d785e9f02f75bb5a0e..d725605c884d64c7656fda5bd5c534290adb9fcf 100644 --- a/SSH/files/entrypoint.sh +++ b/SSH/files/entrypoint.sh @@ -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 diff --git a/XCalc/Dockerfile b/XCalc/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ff133c635e2d40e1bed4fb49bca8df1297473d1a --- /dev/null +++ b/XCalc/Dockerfile @@ -0,0 +1,20 @@ +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' + + + diff --git a/XCalc/build.sh b/XCalc/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..dedf43846885228a3635f3d2811fefefcd121161 --- /dev/null +++ b/XCalc/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker build . -t xcalc diff --git a/XCalc/files/entrypoint.sh b/XCalc/files/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..02db98c1295b8ae0aaf5d9d785e9f02f75bb5a0e --- /dev/null +++ b/XCalc/files/entrypoint.sh @@ -0,0 +1,39 @@ +#/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 diff --git a/XCalc/run.sh b/XCalc/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..070e561853b3fd49eb23daec972479856a86d924 --- /dev/null +++ b/XCalc/run.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker run -v$PWD/:/data -p2222:2222 -eAUTH_PASS='testpass' -eBASE_PORT=2222 -it xcalc