Skip to content

Commit

Permalink
Return back insecure SSH (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Yushkovskiy authored Aug 10, 2020
1 parent 05ce088 commit ad7789e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash

if [ ! -z "$EXPOSE_SSH" ]; then
/usr/sbin/sshd -e
fi

# run command
exec "$@"
29 changes: 29 additions & 0 deletions targets/python37-jupyter-pytorch-tensorflow-jupyterlab/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,35 @@ RUN mkdir -p /var/notebooks
COPY files/var/notebooks/README.ipynb /var/notebooks


# ==================================================================
# Set up SSH for remote debug
# ------------------------------------------------------------------

# Setup environment for ssh session
RUN apt-get install -y --no-install-recommends openssh-server && \
echo "export PATH=$PATH" >> /etc/profile && \
echo "export LANG=$LANG" >> /etc/profile && \
echo "export LANGUAGE=$LANGUAGE" >> /etc/profile && \
echo "export LC_ALL=$LC_ALL" >> /etc/profile && \
echo "export PYTHONIOENCODING=$PYTHONIOENCODING" >> /etc/profile

# Create folder for openssh fifos
RUN mkdir -p /var/run/sshd

# Disable password for root
RUN sed -i -re 's/^root:[^:]+:/root::/' /etc/shadow
RUN sed -i -re 's/^root:.*$/root::0:0:System Administrator:\/root:\/bin\/bash/' /etc/passwd

# Permit root login over ssh
RUN echo "Subsystem sftp /usr/lib/sftp-server \n\
PasswordAuthentication yes\n\
ChallengeResponseAuthentication yes\n\
PermitRootLogin yes \n\
PermitEmptyPasswords yes\n" > /etc/ssh/sshd_config

# ssh port
EXPOSE 22

# ==================================================================
# config & cleanup
# ------------------------------------------------------------------
Expand Down

0 comments on commit ad7789e

Please sign in to comment.