From 6441d286aa8074f95fa96503f159d3c5bc900af1 Mon Sep 17 00:00:00 2001 From: bagushehe Date: Wed, 24 Oct 2018 23:16:47 +0800 Subject: [PATCH] perintah_linux --- perintah_linux/Dockerfile | 31 +++++++++++++++++++++++++++++++ perintah_linux/{ => chall}/aa.py | 0 2 files changed, 31 insertions(+) create mode 100644 perintah_linux/Dockerfile rename perintah_linux/{ => chall}/aa.py (100%) diff --git a/perintah_linux/Dockerfile b/perintah_linux/Dockerfile new file mode 100644 index 0000000..a284339 --- /dev/null +++ b/perintah_linux/Dockerfile @@ -0,0 +1,31 @@ +# Use ubuntu 16.04 +FROM ubuntu:16.04 + +RUN apt-get update && apt-get -y dist-upgrade --fix-missing --fix-broken + +# install socat editor ssh +RUN apt-get install curl netcat-openbsd vim nano openssh-server socat lib32ncurses5 python python-pip python-dev -y + +RUN adduser --disabled-password --gecos "" ksl +RUN echo "ksl:sebuahrahasiamas" | chpasswd + +ADD chall/. /chall +WORKDIR /chall + +RUN echo 'KSL{FEEL_BETTER_USE_LINUX}' > /chall/flag.txt # ubah isi flagnya + +# Secure ENV + +RUN echo 'alias kill="echo no kill please!"' >> ~/.bashrc +RUN chmod 700 /tmp /var/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 + + +RUN chown root:ksl /chall/aa.py # ubah nama file +RUN chmod 775 /chall/aa.py # ubah nama file + +# Run Service + +RUN echo '#!/bin/bash'"\n(socat TCP-LISTEN:7000,reuseaddr,fork EXEC:"/chall/aa.py,su=nobody")" > /var/tmp/.start.sh && chmod +x /var/tmp/.start.sh + +CMD ["/var/tmp/.start.sh"] diff --git a/perintah_linux/aa.py b/perintah_linux/chall/aa.py similarity index 100% rename from perintah_linux/aa.py rename to perintah_linux/chall/aa.py