diff --git a/challenge-base/Dockerfile b/challenge-base/Dockerfile new file mode 100644 index 0000000..c2cdcd2 --- /dev/null +++ b/challenge-base/Dockerfile @@ -0,0 +1,26 @@ +FROM phusion/baseimage +MAINTAINER Pavel Sviderski + +RUN apt-get update && apt-get --no-install-recommends -y install \ + man wget vim nano screen tmux \ + python python-pip python-virtualenv python3.4 python3-pip \ + binutils build-essential gdb ltrace strace \ + sqlite sqlite3 \ + && apt-get clean \ + && useradd -m box + +RUN rm -f /etc/service/sshd/down && /etc/my_init.d/00_regen_ssh_host_keys.sh \ + && rm -rf /etc/service/cron /etc/service/syslog-forwarder /etc/service/syslog-ng \ + && echo "box ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/box \ + && mkdir -p /.box/bashrc.d/root /.box/bashrc.d/box + +COPY ssh /root/.ssh +COPY bashrc/root /root/.bashrc +COPY bashrc/box /home/box/.bashrc + +COPY greeting /.box/greeting +COPY start.sh /.box/start.sh + +EXPOSE 22 + +CMD /.box/start.sh diff --git a/challenge-base/bashrc/box b/challenge-base/bashrc/box new file mode 100644 index 0000000..03b9782 --- /dev/null +++ b/challenge-base/bashrc/box @@ -0,0 +1,8 @@ +PS1='\[\033[01;32m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h: \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]' +alias ls="ls --color=auto" + +cd ~/ + +while read bashrc_script; do + source "$bashrc_script" +done < <(find /.box/bashrc.d /.box/bashrc.d/box -maxdepth 1 -type f) diff --git a/challenge-base/bashrc/root b/challenge-base/bashrc/root new file mode 100644 index 0000000..84b5b3e --- /dev/null +++ b/challenge-base/bashrc/root @@ -0,0 +1,8 @@ +PS1='\[\033[01;32m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h: \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]' +alias ls="ls --color=auto" + +cd ~/ + +while read bashrc_script; do + source "$bashrc_script" +done < <(find /.box/bashrc.d /.box/bashrc.d/root -maxdepth 1 -type f) diff --git a/challenge-base/greeting b/challenge-base/greeting new file mode 100644 index 0000000..95a879f --- /dev/null +++ b/challenge-base/greeting @@ -0,0 +1,20 @@ +Welcome to Linux Challenge on + _ _ + | | (_) + ___| |_ ___ _ __ _ ___ ___ _ __ __ _ + / __| __/ _ \ '_ \| |/ __| / _ \| '__/ _` | + \__ \ || __/ |_) | | (__ | (_) | | | (_| | + |___/\__\___| .__/|_|\___(_)___/|_| \__, | + | | __/ | + |_| |___/ + +This box runs Ubuntu 14.04. You are logged in as user "box". +To run a command as administrator (user "root"), use "sudo ". + * Documentation: https://help.ubuntu.com/ + +Web terminal usage +================== + * Click the titlebar to drag + * Double-click the titlebar to maximize + * Click and drag the lower-right corner to resize + diff --git a/challenge-base/ssh/authorized_keys b/challenge-base/ssh/authorized_keys new file mode 100644 index 0000000..2c9a7f9 --- /dev/null +++ b/challenge-base/ssh/authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6Tx8U13CktlFNP4uFncrbXTWGweyVDG8KfuM+csoLfXp9VRYUZGpuFELKrfhgPaTjvRv0JfVCvoOWLsflma87k0Bq8s5OIPujAblwP1oBXFGOa//iSMOtZO9AtYYQwDhI7AUNlgAAsrmoPBzsQ1lHLbA+OAc5ckl9Vv+9l7xMZPyTaA894leuQSVNgYixwFmKKUBv+Go0w24CvYUDJL3KeIJCZDD7e7DzW2vACMYyjdfo3DDpNsabE9yfmsaITrs/zakESf3Gy6zUdTPgUo0NjIpT772BOmPK4cvWV3Lb9ExMH6psYqwh14B+Wz9gguDhkcdGioajXqNxKShRH/uF checker@checksystem diff --git a/challenge-base/start.sh b/challenge-base/start.sh new file mode 100755 index 0000000..a8f5bd8 --- /dev/null +++ b/challenge-base/start.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Start the SSH service +/sbin/my_init --skip-startup-files &> /dev/null & + +# Display the bold prompt +bold=$(tput bold) +normal=$(tput sgr0) +echo "${bold}Press ENTER to start hacking...${normal}" + +# Wait for ENTER +trap '' 2 # mock SIGINT on CTRL+C +read +trap 2 # enable SIGINT + +# Print the greeting +cat /.box/greeting 2> /dev/null + +while true; do + su box +done