30 lines
821 B

# Use ubuntu 16.04
FROM ubuntu:16.04
EXPOSE 2020
RUN apt-get update
# install socat editor ssh
RUN apt-get install socat -y
RUN adduser --disabled-password --gecos "" ksl
RUN echo "ksl:sebuahrahasiamas" | chpasswd
RUN mkdir chall
WORKDIR /chall
# Secure ENV
COPY flag.txt .
COPY version002 .
RUN echo 'alias kill="echo no kill please!"' >> ~/.bashrc
RUN chmod 700 /tmp /usr/bin/* /bin/* /dev/shm
# RUN chmod 755 /usr/bin/env /bin/dash /bin/bash /bin/sh /bin/nc /bin/cat /usr/bin/curl /usr/bin/groups /usr/bin/id /bin/ls /usr/bin/python /usr/bin/ruby
RUN chown root:ksl /chall/version002
RUN chmod 775 /chall/version002
# Run Service
RUN echo '#!/bin/bash'"\n(socat TCP-LISTEN:2020,reuseaddr,fork EXEC:"/chall/version002,su=nobody")" > /var/tmp/.start.sh && chmod +x /var/tmp/.start.sh
CMD ["/var/tmp/.start.sh"]