当前位置:   article > 正文

安装GZ::CTF 一个开源的CTF比赛平台_gzctf

gzctf

系统:Ubuntu 20.04.4 Focal Fossa

配置apt镜像源可到清华镜像站寻找合适版本

sudo vi /etc/apt/sources.list
  • 1

以下为清华Ubuntu 20.04 LTS (focal)镜像源

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

更新软件源,漫长的时间……

sudo apt update 
  • 1

更新完成之后安装docker和docker-compose

sudo apt install docker.io docker-compose
  • 1

使用下列命令查看版本判断是否安装成功

docker-compose -v
  • 1

docker-compose version 1.25.0, build unknown

docker -v
  • 1

Docker version 24.0.5, build 24.0.5-0ubuntu1~20.04.1

接下来到GZ:CTF根据文档部署,首先创建一个GZCTF文件夹,根据文档创建配置appsettings.json和docker-compose.yml文件

appsettings.json

vi appsettings.json
  • 1
{
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "Database": "Host=db:5432;Database=gzctf;Username=postgres;Password=<Your POSTGRES_PASSWORD>"
  },
  "EmailConfig": {
    "SendMailAddress": "a@a.com",
    "UserName": "",
    "Password": "",
    "Smtp": {
      "Host": "localhost",
      "Port": 587
    }
  },
  "XorKey": "<Your XOR_KEY>",
  "ContainerProvider": {
    "Type": "Docker", // or "Kubernetes"
    "PortMappingType": "Default", // or "PlatformProxy"
    "EnableTrafficCapture": false,
    "PublicEntry": "<Your PUBLIC_ENTRY>", // or "xxx.xxx.xxx.xxx"
    // optional
    "DockerConfig": {
      "SwarmMode": false,
      "Uri": "unix:///var/run/docker.sock"
    }
  },
  "RequestLogging": false,
  "DisableRateLimit": true,
  "RegistryConfig": {
    "UserName": "",
    "Password": "",
    "ServerAddress": ""
  },
  "CaptchaConfig": {
    "Provider": "None", // or "CloudflareTurnstile" or "GoogleRecaptcha"
    "SiteKey": "<Your SITE_KEY>",
    "SecretKey": "<Your SECRET_KEY>",
    // optional
    "GoogleRecaptcha": {
      "VerifyAPIAddress": "https://www.recaptcha.net/recaptcha/api/siteverify",
      "RecaptchaThreshold": "0.5"
    }
  },
  "ForwardedOptions": {
    "ForwardedHeaders": 5,
    "ForwardLimit": 1,
    "TrustedNetworks": ["192.168.12.0/8"]
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49

docker-compose.yml

vi docker-compose.yml
  • 1
version: "3.0"
services:
  gzctf:
    image: gztime/gzctf:latest
    restart: always
    environment:
      - "LANG=zh_CN.UTF-8" # choose your backend language `en_US` / `zh_CN` / `ja_JP`
      - "GZCTF_ADMIN_PASSWORD=<Your GZCTF_ADMIN_PASSWORD>"
    ports:
      - "80:8080"
    volumes:
      - "./data/files:/app/files"
      - "./appsettings.json:/app/appsettings.json:ro"
      # - "./kube-config.yaml:/app/kube-config.yaml:ro" # this is required for k8s deployment
      - "/var/run/docker.sock:/var/run/docker.sock" # this is required for docker deployment
    depends_on:
      - db
 
  db:
    image: postgres:alpine
    restart: always
    environment:
      - "POSTGRES_PASSWORD=<Your POSTGRES_PASSWORD>"
    volumes:
      - "./data/db:/var/lib/postgresql/data"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

搞完之后启动

sudo docker-compose up -d
  • 1
[sudo] password for osboxes: 
Creating network "gzctf_default" with the default driver
Pulling db (postgres:alpine)...
alpine: Pulling from library/postgres
4abcf2066143: Pull complete
8e53739c72bf: Pull complete
6b2f54332fe1: Pull complete
3ed99af0e76b: Pull complete
f54035dfc9b0: Pull complete
16374409674c: Pull complete
09b009446613: Pull complete
a76c5f01e503: Pull complete
f6dfa742bdd5: Pull complete
Digest: sha256:bbd7346fab25b7e0b25f214829d6ebfb78ef0465059492e46dee740ce8fcd844
Status: Downloaded newer image for postgres:alpine
Pulling gzctf (gztime/gzctf:latest)...
latest: Pulling from gztime/gzctf
e1caac4eb9d2: Pull complete
bee002b96029: Pull complete
e65deb0614ae: Pull complete
31a62e83c1b2: Pull complete
97d7b6e68a6e: Pull complete
67c6e8d22e3d: Pull complete
4edd0400ef8d: Pull complete
c20d573e682c: Pull complete
b468dfa08eb4: Pull complete
Digest: sha256:e0222340c9a2ee8644cef5f037eb472a4fad81b85a476ae8efc5b5bb1728dd16
Status: Downloaded newer image for gztime/gzctf:latest
Creating gzctf_db_1 ... done
Creating gzctf_gzctf_1 ... done
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

就完成了,根据服务器对应IP访问即可

osboxes@osboxes:~/GZCTF$ sudo docker ps
CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS                            PORTS                                   NAMES
295d52db022b   gztime/gzctf:latest   "dotnet GZCTF.dll"       42 seconds ago   Up 9 seconds (health: starting)   0.0.0.0:80->8080/tcp, :::80->8080/tcp   gzctf_gzctf_1
fb8b49a2d948   postgres:alpine       "docker-entrypoint.s…"   43 seconds ago   Up 42 seconds                     5432/tcp                                gzctf_db_1
  • 1
  • 2
  • 3
  • 4

好耶,完结撒花❀
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/559843
推荐阅读
相关标签
  

闽ICP备14008679号