安装GZ::CTF 一个开源的CTF角逐平台

打印 上一主题 下一主题

主题 507|帖子 507|积分 1521

系统:Ubuntu 20.04.4 Focal Fossa
配置apt镜像源,可到清华镜像站探求合适版本
  1. sudo vi /etc/apt/sources.list
复制代码
以下为清华Ubuntu 20.04 LTS (focal)镜像源
  1. # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
  2. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
  3. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
  4. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
  5. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
  6. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
  7. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
  8. deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
  9. # deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
  10. # 预发布软件源,不建议启用
  11. # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
  12. # # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
复制代码
更新软件源,漫长的时间……
  1. sudo apt update
复制代码
更新完成之后安装docker和docker-compose
  1. sudo apt install docker.io docker-compose
复制代码
利用下列命令查看版本判断是否安装成功
  1. docker-compose -v
复制代码
docker-compose version 1.25.0, build unknown
  1. docker -v
复制代码
Docker version 24.0.5, build 24.0.5-0ubuntu1~20.04.1
接下来到GZ:CTF根据文档部署,起首创建一个GZCTF文件夹,根据文档创建配置appsettings.json和docker-compose.yml文件
appsettings.json
  1. vi appsettings.json
复制代码
  1. {
  2.   "AllowedHosts": "*",
  3.   "ConnectionStrings": {
  4.     "Database": "Host=db:5432;Database=gzctf;Username=postgres;Password=<Your POSTGRES_PASSWORD>"
  5.   },
  6.   "EmailConfig": {
  7.     "SendMailAddress": "a@a.com",
  8.     "UserName": "",
  9.     "Password": "",
  10.     "Smtp": {
  11.       "Host": "localhost",
  12.       "Port": 587
  13.     }
  14.   },
  15.   "XorKey": "<Your XOR_KEY>",
  16.   "ContainerProvider": {
  17.     "Type": "Docker", // or "Kubernetes"
  18.     "PortMappingType": "Default", // or "PlatformProxy"
  19.     "EnableTrafficCapture": false,
  20.     "PublicEntry": "<Your PUBLIC_ENTRY>", // or "xxx.xxx.xxx.xxx"
  21.     // optional
  22.     "DockerConfig": {
  23.       "SwarmMode": false,
  24.       "Uri": "unix:///var/run/docker.sock"
  25.     }
  26.   },
  27.   "RequestLogging": false,
  28.   "DisableRateLimit": true,
  29.   "RegistryConfig": {
  30.     "UserName": "",
  31.     "Password": "",
  32.     "ServerAddress": ""
  33.   },
  34.   "CaptchaConfig": {
  35.     "Provider": "None", // or "CloudflareTurnstile" or "GoogleRecaptcha"
  36.     "SiteKey": "<Your SITE_KEY>",
  37.     "SecretKey": "<Your SECRET_KEY>",
  38.     // optional
  39.     "GoogleRecaptcha": {
  40.       "VerifyAPIAddress": "https://www.recaptcha.net/recaptcha/api/siteverify",
  41.       "RecaptchaThreshold": "0.5"
  42.     }
  43.   },
  44.   "ForwardedOptions": {
  45.     "ForwardedHeaders": 5,
  46.     "ForwardLimit": 1,
  47.     "TrustedNetworks": ["192.168.12.0/8"]
  48.   }
  49. }
复制代码
docker-compose.yml
  1. vi docker-compose.yml
复制代码
  1. version: "3.0"
  2. services:
  3.   gzctf:
  4.     image: gztime/gzctf:latest
  5.     restart: always
  6.     environment:
  7.       - "LANG=zh_CN.UTF-8" # choose your backend language `en_US` / `zh_CN` / `ja_JP`
  8.       - "GZCTF_ADMIN_PASSWORD=<Your GZCTF_ADMIN_PASSWORD>"
  9.     ports:
  10.       - "80:8080"
  11.     volumes:
  12.       - "./data/files:/app/files"
  13.       - "./appsettings.json:/app/appsettings.json:ro"
  14.       # - "./kube-config.yaml:/app/kube-config.yaml:ro" # this is required for k8s deployment
  15.       - "/var/run/docker.sock:/var/run/docker.sock" # this is required for docker deployment
  16.     depends_on:
  17.       - db
  18.   db:
  19.     image: postgres:alpine
  20.     restart: always
  21.     environment:
  22.       - "POSTGRES_PASSWORD=<Your POSTGRES_PASSWORD>"
  23.     volumes:
  24.       - "./data/db:/var/lib/postgresql/data"
复制代码
搞完之后启动
  1. sudo docker-compose up -d
复制代码
  1. [sudo] password for osboxes:
  2. Creating network "gzctf_default" with the default driver
  3. Pulling db (postgres:alpine)...
  4. alpine: Pulling from library/postgres
  5. 4abcf2066143: Pull complete
  6. 8e53739c72bf: Pull complete
  7. 6b2f54332fe1: Pull complete
  8. 3ed99af0e76b: Pull complete
  9. f54035dfc9b0: Pull complete
  10. 16374409674c: Pull complete
  11. 09b009446613: Pull complete
  12. a76c5f01e503: Pull complete
  13. f6dfa742bdd5: Pull complete
  14. Digest: sha256:bbd7346fab25b7e0b25f214829d6ebfb78ef0465059492e46dee740ce8fcd844
  15. Status: Downloaded newer image for postgres:alpine
  16. Pulling gzctf (gztime/gzctf:latest)...
  17. latest: Pulling from gztime/gzctf
  18. e1caac4eb9d2: Pull complete
  19. bee002b96029: Pull complete
  20. e65deb0614ae: Pull complete
  21. 31a62e83c1b2: Pull complete
  22. 97d7b6e68a6e: Pull complete
  23. 67c6e8d22e3d: Pull complete
  24. 4edd0400ef8d: Pull complete
  25. c20d573e682c: Pull complete
  26. b468dfa08eb4: Pull complete
  27. Digest: sha256:e0222340c9a2ee8644cef5f037eb472a4fad81b85a476ae8efc5b5bb1728dd16
  28. Status: Downloaded newer image for gztime/gzctf:latest
  29. Creating gzctf_db_1 ... done
  30. Creating gzctf_gzctf_1 ... done
复制代码
就完成了,根据服务器对应IP访问即可
  1. osboxes@osboxes:~/GZCTF$ sudo docker ps
  2. CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS                            PORTS                                   NAMES
  3. 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
  4. fb8b49a2d948   postgres:alpine       "docker-entrypoint.s…"   43 seconds ago   Up 42 seconds                     5432/tcp                                gzctf_db_1
复制代码
好耶,完结撒花❀


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

雁过留声

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表