From 985d771edd7b706f39a4966e621acf06ff71ecf0 Mon Sep 17 00:00:00 2001 From: paulussimanjuntak Date: Mon, 22 Oct 2018 19:17:27 +0800 Subject: [PATCH] ping-service --- ping-service/Dockerfile | 31 ++++++++++++++++++++++++ ping-service/README.md | 1 - ping-service/{ => chall}/ping-service.py | 0 ping-service/start.sh | 4 --- 4 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 ping-service/Dockerfile delete mode 100644 ping-service/README.md rename ping-service/{ => chall}/ping-service.py (100%) delete mode 100755 ping-service/start.sh diff --git a/ping-service/Dockerfile b/ping-service/Dockerfile new file mode 100644 index 0000000..7d2df0d --- /dev/null +++ b/ping-service/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{U14RZ_M4M4NXX_KERENZX_4ANEETTT!!}' > /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/ping-service.py # ubah nama file +RUN chmod 775 /chall/ping-service.py # ubah nama file + +# Run Service + +RUN echo '#!/bin/bash'"\n(socat TCP-LISTEN:7000,reuseaddr,fork EXEC:"/chall/ping-service.py,su=nobody")" > /var/tmp/.start.sh && chmod +x /var/tmp/.start.sh + +CMD ["/var/tmp/.start.sh"] diff --git a/ping-service/README.md b/ping-service/README.md deleted file mode 100644 index eb74650..0000000 --- a/ping-service/README.md +++ /dev/null @@ -1 +0,0 @@ -ping-service.py diff --git a/ping-service/ping-service.py b/ping-service/chall/ping-service.py similarity index 100% rename from ping-service/ping-service.py rename to ping-service/chall/ping-service.py diff --git a/ping-service/start.sh b/ping-service/start.sh deleted file mode 100755 index 7c75a88..0000000 --- a/ping-service/start.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -#nc ip port - -socat TCP-LISTEN:5000,reuseaddr,fork EXEC:./ping-service.py