CTF: Instalasi CTFd di Ubuntu 22.04 dengan docker
Sumber: https://docs.ctfd.io/docs/deployment/installation
Spec:
VirtualBox Ubuntu 22.04 Memory 3G Core 2
Basic
sudo su apt update apt -y install net-tools pip
Install Docker atau Docker Compose
Install
sudo snap install docker # version 20.10.17
Atau
sudo apt -y install docker-compose # version 1.29.2-1
salah satu saja, tidak perlu dua duanya
Install CTFd
Sebagai user biasa, download CTFd
cd ~ git clone https://github.com/CTFd/CTFd.git
Edit atau sesuaikan docker-compose.yml
cd ~/CTFd vi docker-compose.yml
Edit environment
environment: - SECRET_KEY=<SPECIFY_RANDOM_VALUE> - UPLOAD_FOLDER=/var/uploads - DATABASE_URL=mysql+pymysql://ctfd:ctfd@db/ctfd - REDIS_URL=redis://cache:6379 - WORKERS=1 - LOG_FOLDER=/var/log/CTFd - ACCESS_LOG=- - ERROR_LOG=- - REVERSE_PROXY=true
yang perlu di edit adalah
SECRET_KEY=<SPECIFY_RANDOM_VALUE> WORKERS=1
Run
cd ~/CTFd sudo docker-compose up
Ada error,
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available. You should consider upgrading via the '/opt/venv/bin/python -m pip install --upgrade pip' command. The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt && for d in CTFd/plugins/*; do if [ -f "$d/requirements.txt" ]; then pip install --no-cache-dir -r "$d/requirements.txt"; fi; done;' returned a non-zero code: 2 ERROR: Service 'ctfd' failed to build : Build failed onno@22041:~/CTFd$
Kalau berhasil, Browse
http://ip.address:8000
Alternatif Instalasi docker yang lebih susah
Install Docker
apt -y install curl curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7EA0A9C3F273FCD8 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt-cache policy docker-ce
sudo apt install -y docker-ce sudo systemctl status docker
Install Docker Compose
Sebagai user biasa
mkdir -p ~/.docker/cli-plugins/ curl -SL https://github.com/docker/compose/releases/download/v2.3.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
Set permissions,
chmod +x ~/.docker/cli-plugins/docker-compose
Cek
docker compose version