Created
February 22, 2020 00:02
-
-
Save Peleke/79abf411748d1f79ce072fdc8d879407 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set Variables | |
DEPLOY_KEY_URI="https://gist.githubusercontent.com/Peleke/c283ab406d45a37dc94f0df43c6a9d19/raw/712d7c126f4d0004e305d97f039ca1b755aee6b1/id_rsa" | |
LAB_ENV_DIR="C:/Documents/LabEnvironments" | |
SCAVENGER_DIR="$LAB_ENV_DIR/linux-scavenger" | |
SCAVENGER_REMOTE="git@gitlab.com:cyberxsecurity/lab-definitions/linux-scavenger.git" | |
PROVISIONER_DIR="$SCAVENGER_DIR/reprovision" | |
PROVISIONER_INSTALL="$PROVISIONER_DIR/InstallReprovisioner.ps1" | |
PROVISIONER_RUN="$PROVISIONER_DIR/Reprovision.ps1" | |
# Download Deploy Key | |
mkdir -p ~/.ssh > > /dev/null | |
curl -o ~/.ssh/id_rsa $DEPLOY_KEY_URI | |
# Create Lab Environment Directory | |
mkdir -p $LAB_ENV_DIR && cd $_ | |
# Download Environment | |
git clone $SCAVENGER_REMOTE $SCAVENGER_DIR | |
cd $SCAVENGER_DIR | |
git submodule init | |
git submodule update --init --recursive | |
# Lift Machine and Install Reprovisioner | |
vagrant up | |
# Tell Students how to Connect | |
SSH_USERNAME="student" | |
SSH_HOST=$(vagrant ssh-config | grep -i 'hostname' | awk '{print $2}' | sed 's/\s*//g') | |
PORT=$(vagrant ssh-config | grep -i 'port' | awk '{print $2}' | sed 's/\s*//g') | |
echo -e "\nConnect via SSH by running:\n" | |
echo "ssh $SSH_USERNAME@$SSH_HOST -p $PORT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment