GZCTF搭建记录

手动安装

之前在2023年已经用CentOS 7搭过一次,但是一直没有更新,现在落后了多个版本,于是索性直接重新搭一个,因为CentOS 7停止维护了,所以这次改用Ubuntu Server 22.04,已经进行了换源并预先安装了docker docker-compose curl wget等

注意点:

1.密码强度不要太弱

2.字符编码是否是UTF-8

配置ssh允许root:

vim /etc/ssh/sshd_config

PermitRootLogin yes

systemctl restart ssh

1
2
3
4
5
6
wget https://github.com/GZTimeWalker/GZCTF/archive/refs/tags/v1.1.3.zip
apt install zip unzip -y
unzip *.zip
mkdir /app
mv GZCTF-1.1.3 /app/GZCTF
cd /app/GZCTF

快速上手 - GZ::CTF (gzti.me) 根据官方文档的内容,编辑并保存appsettings.json和docker-compose.yml

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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
{
"AllowedHosts": "*",
"ConnectionStrings": {
"Database": "Host=db:5432;Database=gzctf;Username=postgres;Password=<Database Password>" //你的psql密码
// redis is optional
// "RedisCache": "cache:6379,password=<Redis Password>",
// external storage (minio s3, aws s3, azure blob) is optional, aws s3 for example
// "Storage": "minio.s3://keyId=<YOUR_KEY_ID>;key=<YOUR_KEY>;bucket=<YOUR_BUCKET>;region=<YOUR_REGION>"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
"Loki": {
"Enable": true,
"EndpointUri": "http://loki:3100",
"Labels": [
{
"Key": "app",
"Value": "gzctf"
}
],
"PropertiesAsLabels": ["app"],
"Credentials": {
"Login": "login",
"Password": "password"
},
"Tenant": "my-tenant",
"MinimumLevel": "Trace"
}
},
"Telemetry": {
"Prometheus": {
"Enable": false,
"Port": 3000,
"TotalNameSuffixForCounters": false
},
"OpenTelemetry": {
"Enable": false,
"Protocol": "Grpc",
"EndpointUri": "http://jaeger-collector:4317"
},
"AzureMonitor": {
"Enable": false,
"ConnectionString": "InstrumentationKey=12345678-abcd-abcd-abcd-12345678..."
},
"Console": {
"Enable": false
}
},
"EmailConfig": {
"SenderAddress": "",
"SenderName": "",
"UserName": "",
"Password": "",
"Smtp": {
"Host": "localhost",
"Port": 587,
"BypassCertVerify": false
}
},
"XorKey": "<Random Key Str>", // 你的Xor key
"ContainerProvider": {
"Type": "Docker", // or "Kubernetes"
"PortMappingType": "Default",
"EnableTrafficCapture": false,
"PublicEntry": "ctf.example.com", // 给出的容器地址
"DockerConfig": {
// optional
"SwarmMode": false,
"ChallengeNetwork": "",
"Uri": "unix:///var/run/docker.sock",
"UserName": "",
"Password": ""
},
"KubernetesConfig": {
// optional
"Namespace": "gzctf-challenges",
"ConfigPath": "kube-config.yaml",
"AllowCIDR": [
// allow the cluster CIDR for LB
"10.0.0.0/8"
],
"DNS": [
// custom DNS to avoid cluster DNS
"8.8.8.8",
"223.5.5.5"
]
}
},
"RequestLogging": false,
"DisableRateLimit": false,
"RegistryConfig": {
"UserName": "",
"Password": "",
"ServerAddress": ""
},
"CaptchaConfig": {
"Provider": "None",
"SiteKey": "...",
"SecretKey": "...",
// optional
"GoogleRecaptcha": {
"VerifyAPIAddress": "https://www.recaptcha.net/recaptcha/api/siteverify",
"RecaptchaThreshold": "0.5"
},
// optional
"HashPow": {
"Difficulty": 18
}
},
"ForwardedOptions": {
"ForwardedHeaders": 7, // a flag enum, see following link
"ForwardLimit": 1,
"ForwardedForHeaderName": "X-Forwarded-For",
// use the following options to allow proxy
"TrustedNetworks": ["10.0.0.0/8"],
"TrustedProxies": ["10.0.0.1"]
},
"Kestrel": {
"Endpoints": {
"Web": {
"Url": "http://*:8080"
},
"Prometheus": {
"Url": "http://*:3000"
}
},
"Limits": {
"MaxResponseBufferSize": 2048,
"MaxRequestBufferSize": 1048576,
"MaxRequestLineSize": 8192,
"MaxRequestHeadersTotalSize": 32768,
"MaxRequestHeaderCount": 100,
"MaxRequestBodySize": 27262946,
"KeepAliveTimeout": "0.0:5:0",
"RequestHeadersTimeout": "0.0:5:0",
"MaxConcurrentConnections": null,
"MaxConcurrentUpgradedConnections": null
},
"AddServerHeader": true,
"AllowResponseHeaderCompression": true,
"AllowSynchronousIO": false,
"AllowAlternateSchemes": false,
"DisableStringReuse": false,
"ConfigurationLoader": null
}
}
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
services:
gzctf:
image: registry.cn-shanghai.aliyuncs.com/gztime/gzctf:develop
restart: always
environment:
- "GZCTF_ADMIN_PASSWORD=<Your GZCTF_ADMIN_PASSWORD>" # 设置管理员密码
# choose your backend language `en_US` / `zh_CN` / `ja_JP`
- "LC_ALL=zh_CN.UTF-8"
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>" # 和之前设置的psql的密码一样
volumes:
- "./data/db:/var/lib/postgresql/data"

然后因为一些不可言说的原因,需要进行docker换源,这个可以关注dongyubin/DockerHub: 目前国内可用Docker镜像源汇总,DockerHub国内镜像加速列表,🚀DockerHub镜像加速器 (github.com)

1
2
3
echo '{"registry-mirrors": ["https://docker.1ms.run"]}' | sudo tee /etc/docker/daemon.json > /dev/null
systemctl daemon-reload
systemctl restart docker

然后执行docker-compose up -d进行构建

使用自动脚本安装

https://github.com/Cyr1s-dev/GZCTF-QUICK-DEPLOY/releases/tag/v1.0

注意:

需要使用Ubuntu 20/22,且最好不要使用最小化安装,可能会出现缺少依赖,同时仍然需要docker换源或使用caddy


GZCTF搭建记录
https://more678.github.io/2025/01/09/GZCTF搭建记录/
作者
tenstrings
发布于
2025年1月9日
许可协议