废话
老弟,信我,一篇过
不管你是用的是Centos、kali还是Ubuntu,大概步骤都差不多,无非就是命令和目录不一样
搭建过程中如果有什么问题可以私信我
OK,废话不多说,正式开始
搭建过程
GZCTF用的数据库是postgresql,不是mysql
这里我用kali搭建的,因为kali自带postgresql
第一步
安装docker和docker-compose
执行下面的命令
apt install docker.io docker-compose
如果感觉下载的慢可以换一下源
# See https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
#deb http://http.kali.org/kali kali-rolling main contrib non-free non-free-firmware
#清华
deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free non-free-firmware
然后验证一下安装是否成功
docker -v
docker-compose -v
第二步
docker配置加速地址
进入/etc/docker目录
新建一个名为daemon.json的文件
然后写入
{
"registry-mirrors": [
"https://docker.m.daocloud.io"
]
}
重新加载系统服务和重启服务
systemctl daemon-reload
systemctl restart docker.service
验证一下
docker info
第三步
安装GZCTF
新建目录GZCTF
在这个目录下建立appsettings.json和docker-compose.yml文件
vi appsettings.json
{
"AllowedHosts": "*",
"ConnectionStrings": {
"Database": "Host=db:5432;Database=gzctf;Username=postgres;Password=Admin1234."
},
"EmailConfig": {
"SendMailAddress": "a@a.com",
"UserName": "",
"Password": "",
"Smtp": {
"Host": "localhost",
"Port": 587
}
},
"XorKey": "Admin1234.",
"ContainerProvider": {
"Type": "Docker", // or "Kubernetes"
"PortMappingType": "Default", // or "PlatformProxy"
"EnableTrafficCapture": false,
"PublicEntry": "192.168.100.131", // 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"]
}
}
vi docker-compose.yml
version: "3.0"
services:
gzctf:
image: gztime/gzctf:latest
restart: always
environment:
- "GZCTF_ADMIN_PASSWORD=Admin1234."
# 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=Admin1234."
volumes:
- "./data/db:/var/lib/postgresql/data"
配置好这两个文件后,执行下面的命令
sudo docker-compose up -d
验证一下
第四步
完成上面的操作,来到最后一步,访问自己的ip
欧克。完成!!!!
开始折磨新人😎
总结
搭建这个有几个抗,我和大家说一下
1、要配置docker加速地址,要不然sudo docker-compose up -d这个命令会执行失败
2、那两个配置文件,有点小恶心,按照我上面的要求改应该是没用什么意思的
3、这里只是搭建,和数据库没什么太大的关系,不要卡在数据库那里