Skip to content

Commit

Permalink
add challenge-base image with pluggable bashrc dir
Browse files Browse the repository at this point in the history
  • Loading branch information
psviderski committed Oct 22, 2015
1 parent 29a2490 commit 3148a84
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 0 deletions.
26 changes: 26 additions & 0 deletions challenge-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM phusion/baseimage
MAINTAINER Pavel Sviderski <[email protected]>

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
8 changes: 8 additions & 0 deletions challenge-base/bashrc/box
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions challenge-base/bashrc/root
Original file line number Diff line number Diff line change
@@ -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)
20 changes: 20 additions & 0 deletions challenge-base/greeting
Original file line number Diff line number Diff line change
@@ -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 <command>".
* 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

1 change: 1 addition & 0 deletions challenge-base/ssh/authorized_keys
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6Tx8U13CktlFNP4uFncrbXTWGweyVDG8KfuM+csoLfXp9VRYUZGpuFELKrfhgPaTjvRv0JfVCvoOWLsflma87k0Bq8s5OIPujAblwP1oBXFGOa//iSMOtZO9AtYYQwDhI7AUNlgAAsrmoPBzsQ1lHLbA+OAc5ckl9Vv+9l7xMZPyTaA894leuQSVNgYixwFmKKUBv+Go0w24CvYUDJL3KeIJCZDD7e7DzW2vACMYyjdfo3DDpNsabE9yfmsaITrs/zakESf3Gy6zUdTPgUo0NjIpT772BOmPK4cvWV3Lb9ExMH6psYqwh14B+Wz9gguDhkcdGioajXqNxKShRH/uF checker@checksystem
21 changes: 21 additions & 0 deletions challenge-base/start.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3148a84

Please sign in to comment.