diff --git a/challenge/bash.bashrc b/challenge/bash.bashrc index d41b8edac..ab2098402 100755 --- a/challenge/bash.bashrc +++ b/challenge/bash.bashrc @@ -16,4 +16,14 @@ if [ -e "/challenge/README.md" ] && [ ! -e "/tmp/.dojo/readme-once" ]; then touch /tmp/.dojo/readme-once fi +AVAILABLE_M="$(df --block-size=1M --output=avail /home/hacker | tail -n +2 | head -n1)" +if [[ "$AVAILABLE_M" -lt 512 ]]; then + echo 'Note: Your home directory is running low on storage:' + df -h /home/hacker + echo '' + echo 'Filling your home directory completely could cause you to lose access to the workspace and/or desktop.' + echo 'You can view a list of the largest files and directories using the command:' + echo ' du -sh /home/hacker/* | sort -h' +fi + [ -f "/challenge/.bashrc" ] && source /challenge/.bashrc diff --git a/challenge/docker-initialize.sh b/challenge/docker-initialize.sh index 1a2485251..a55f58710 100755 --- a/challenge/docker-initialize.sh +++ b/challenge/docker-initialize.sh @@ -1 +1,8 @@ #!/bin/sh + +chown hacker:hacker /home/hacker +chmod 755 /home/hacker + +if [ -x "/challenge/.init" ]; then + /challenge/.init +fi diff --git a/dojo_plugin/api/v1/docker.py b/dojo_plugin/api/v1/docker.py index a7e03b046..d8990ca49 100644 --- a/dojo_plugin/api/v1/docker.py +++ b/dojo_plugin/api/v1/docker.py @@ -184,14 +184,8 @@ def insert_auth_token(auth_token): def initialize_container(): exec_run( f""" - /opt/pwn.college/docker-initialize.sh - export DOJO_PRIVILEGED={"1" if practice else "0"} - - if [ -x "/challenge/.init" ]; then - /challenge/.init - fi - + /opt/pwn.college/docker-initialize.sh touch /opt/pwn.college/.initialized """, shell=True