Skip to content

dd-japan/ctf-infra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What's this

This repository contains guides and configuration files of CTFd server, which is able to host on Google Cloud Run. And also including terraform code for swagstore GKE cluster, CTFd Cloud Run and datastores, and Datadog settings.

CTFd server architecture

CTFd on AWS(v1.0)

Single EC2 architecture

Datadog employees

If you are in Datadog Sandbox AWS account, it has the limitation: AWS Config automatically delete extensive security group rules.

CTFd on Google Cloud(v2.0)

Use Cloud Run as a CTFd container server, Cloud SQL as a database and Cloud Storage FUSE as an image upload folder.

If there are many CTFd users, which are more than 10, Cloud Run are recommended to be scaled out. CTFd server has the login cache locally in a container w/o a Redis server. Redis server is necessary to avoid 403 error due to this.

Single container architecture

Multiple container architecture

How to deploy CTFd server on Cloud Run

Open and authorize Google Cloud Shell

gcloud auth login --no-launch-browser

Clone the repository

git clone https://github.com/dd-japan/ctf-infra.git
cd ctf-infra/cloud-run/

Set environment variables

export PROJECT_ID="<project_id>"
export REGION="<region_name>"
export CLOUD_SQL_INSTANCE="<cloud_sql_instance_name>"
export DB_USER="<db_user>"
export DB_PASS="<db_pass>"
export DB_NAME="<db_name>"
exporot GCS_BUCKET="<cloud_storage_bucket_name>"
envsubst <ctfd-single-container.yaml.tamplate> ctfd-single-container.yaml

Deploy CTFd server on Cloud Run

gcloud run service replace ctfd-single-container.yaml

CTFd server configuration

CTFd documentation has the configuration page.

Datadog employees

If you are in Datadog Sandbox GCproject, it has the guardrail: Domain restricted sharing.

As a workaround, add a tag that adapts to the guardrail's exclusion rules: external-access:allowed in the case of Allowing unauthenticated Cloud Run invocations.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors