Skip to content

Latest commit

 

History

History
148 lines (97 loc) · 3.56 KB

README.md

File metadata and controls

148 lines (97 loc) · 3.56 KB

Host

Requirements

Setup

Cluster

  1. Sign into GCP:
gcloud auth login
  1. Create a GCP project:
export PROJECT="ctf-$RANDOM"
gcloud projects create $PROJECT
gcloud config set project $PROJECT

NOTE: After you finish the CTF, you can delete the project, removing all resources associated with the project.

  1. Make sure that billing is enabled for your Cloud project.
echo "https://console.cloud.google.com/billing/linkedaccount\?project\=$PROJECT"
  1. Enable the GKE service API
gcloud services enable container.googleapis.com

NOTE: If you have an error regarding billing, please review the previous step

  1. Create a GKE cluster:
export NAME="$(whoami)-$RANDOM"
gcloud container clusters create "${NAME}" \
  --labels "usage=dev,owner=$(whoami)" \
  --zone us-west2-a \
  --num-nodes 1

Presentation Setup

  1. Setup /etc/hosts file:

NOTE: Updating the /etc/hosts file allows you to use a URL on your machines browser to view GitLab and access the bucket.

sudo -- sh -c -e "echo '127.0.0.1 gitlab.foobar.com' >> /etc/hosts";
sudo -- sh -c -e "echo '127.0.0.1 bucket.foobar.com' >> /etc/hosts";
  1. Unzip the GitLab data:
unzip gitlab.zip
  1. Run Docker Compose to create the local environment:
docker-compose up -d

NOTE: When running this for the first time, it can take 10 minutes to get GitLab up and running

  • Wait for it to return healthy:
docker ps

Application Setup

You currently have cluster-admin access to your cluster. This means we can setup the cluster for the CTF.

  1. Setup cluster applications:
./setup.sh
CONTAINER ID   IMAGE                     COMMAND                  CREATED          STATUS                    PORTS                                                                    NAMES
e4a54c804338   gitlab/gitlab-ce:latest   "/assets/wrapper"        12 minutes ago   Up 12 minutes (healthy)   0.0.0.0:80->80/tcp, 22/tcp, 0.0.0.0:443->443/tcp                         foobar-git
722027c82471   localstack/localstack     "docker-entrypoint.sh"   12 minutes ago   Up 12 minutes (healthy)   127.0.0.1:4510-4559->4510-4559/tcp, 127.0.0.1:4566->4566/tcp, 5678/tcp   foobar-saas

Checks

Use the following checks to give you confidence that everything is setup correctly to deliver your CTF!

foobar.com

[ ] Check <gitlab.foobar.com> and <bucket.foobar.com> are added to /etc/hosts

  • Open the /etc/hosts file with your preferred editor:
sudo nano /etc/hosts
  • Amend /etc/hosts/ accordingly:
127.0.0.1 gitlab.foobar.com
127.0.0.1 bucket.foobar.com

kubeconfig

  • Check config has been set

musicbox reset

  • Reset boombox
kubectl delete pods -A --selector app=musicbox

Tear down

When you've finished the CTF you can delete your cluster.

  1. Delete the GCP Project:
gcloud project delete $PROJECT

NOTE: If all else fails, delete the project from the Google Cloud Console UI