demo站服务器
欢迎
Tp0t OJ | CTFd | dasctf | |
---|---|---|---|
K8s |
✔️ | ❌ | ✔️ |
题目 |
✔️ | ❌ | ✔️ |
预构 |
✔️ | ❌ | ❌ |
✔️ | ❌ | ✔️ | |
动态积分+ |
✔️ | ❌ | ❌ |
✔️ | ❌ | ❌ | |
✔️ | ❌ | ❌ |
Install Docker Engine | Docker Documentation
如果/etc/docker/daemon.json
{
"bip": "192.168.100.1/24"
}
sudo systemctl daemon-reload
sudo systemctl restart docker
请确systemd
环境 什么
./ojtool prepare -MasterIP xxx.xxx.xxx.xxx --postgres
INSTALL_K3S_MIRROR=cn ./ojtool prepare -MasterIP xxx.xxx.xxx.xxx --postgres #for CHINA
执行ojtool prepare
resources
,https.crt
、https.key
home.html
为resources
home.html
.
├── agent-install.sh #「在 从节点 服 务器上 使用 」从节点 安 装 文 件
├── OJ #平台 二 进制文 件
├── ojtool #命令 行 工具 二 进制文 件
├── resources #配置 文 件 目 录
│ ├── ca.crt #镜像仓库自 签名根 证书备份
│ ├── config.yaml #「平台 启动前 请修改 」平台 配置 文 件 模 板
│ ├── docker-registry #镜像仓库相 关目录
│ │ ├── auth #镜像仓库授权文 件 目 录
│ │ │ └── htpasswd #授权文 件
│ │ ├── certs #镜像仓库证书目 录
│ │ │ ├── tls.crt #镜像仓库证书
│ │ │ └── tls.key #镜像仓库私 钥
│ │ └── data #镜像仓库数 据 存 储目录
| ├── [postgres] #postgres数 据 目 录
│ ├── [https.crt] #「非 自 动生成 」网站TLS证书
│ ├── [https.key] #「非 自 动生成 」网站TLS私 钥
│ ├── k3s.yaml #自 动生成 的 k3s配置 文 件 ,不 需要 修 改
| ├── [home.html] #「非 自 动生成 」如果存在 ,会 加 载该网页做为主 页面
| ├── [timeline.save] #「启动后 生成 」排 行 榜历史 数 据 存 储文件
| ├── [emails] #「非 自 动生成 」邮件模 板目 录
│ │ ├── [reset.html] #「非 自 动生成 」密 码重置 邮件模 板
│ │ └── [welcome.html] #「非 自 动生成 」导入账户初 始 化 邮件模 板
│ ├── tls.crt #镜像仓库公私 钥备份
│ └── tls.key #镜像仓库公私 钥备份
├── [writeup] #「启动后 生成 」writeup存 储目录
└── start.sh #「配置 完 毕后启动」启动脚本
start.sh
启动
agent-install.sh
./agent-install.sh xxx.xxx.xxx.xxx #从节点 服 务器公 网IP
INSTALL_K3S_MIRROR=cn ./agent-install.sh xxx.xxx.xxx.xxx #对于中国 用 户
如果
To uninstall K3s from a server node, run:
/usr/local/bin/k3s-uninstall.sh
To uninstall K3s from an agent node, run:
/usr/local/bin/k3s-agent-uninstall.sh
server: #平台 服 务器的 配置 参 数
host: 127.0.0.1 #设置为Host,用 于重置 密 码和CORS等 (仅hostname部分 不 含协议端口和 路 径 )
username: Tp0t #默 认admin用 户名
password: password #默 认admin账号密 码
mail: admin@example.com #默 认admin账号邮箱
port: 0 #0时自动选择80/443,非 0指定 端 口
salt: "xxxxxxxxxx" #用 于密码保护的salt,自 动生成
behaviorLog: false #用 于记录选手 关键行 为,默 认不开启
debug: #debug相 关功能 ,生 产环境 请勿开启
dockerOpDetail: false #开启可 以查看 容器 构建和 下 发的问题
noOriginCheck: false #开启禁 用 orgin检查,禁 用 csrf检查,禁 用 CSP
dbOpDetail: false #开启查看所有 数 据 库请求
cookieExpiresSeconds: 3600 #cookie过期秒 数 ,0表示 不 会 过期,-1表示 在 关闭浏览器 时过期
email: #邮件服 务配置
host: smtp.example.com #邮件服 务提供 商 服 务器
username: exampleUsername #邮件发送账号
password: examplePassword #邮件发送账号密 码(可能 为授权码)
challenge: #题目分数 控 制 参 数
firstBloodReward: 0.1 #一 血 分数 奖励比例
secondBloodReward: 0.08 #二 血 分数 奖励比例
thirdBloodReward: 0.05 #三 血 分数 奖励比例
halfLife: 20 #题目分 值减半 所 需解题人数
kubernetes: #k8s集 群 配置 参 数
portAllocBegin: 30000 #自 动分配 端 口 范围起点
portAllocEnd: 31000 #自 动分配 端 口 终点
username: xxxxxxxx #「不可 修 改 」镜像仓库用 户名
password: xxxxxxxx #「不可 修 改 」镜像仓库密 码
registryHost: xxx.xxx.xxx.xxx:5000 #「不可 修 改 」镜像仓库地 址 (与平 台 一致 )
database: #数 据 库连接 参 数
dsn: "..." #数 据 库连接 配置 ,自 动生成
timelineFile: "resources/timeline.save" #「不 建 议修改 」排 行 榜历史 数 据 存 储文件 路 径
邮件
题目
题目
题目flag
- 单flag
多 flag正 则flag- 动态
随 机 flag
对于PWN题,推荐xinetd
注意 对于所有 需要 执行的 文 件 ,附加 执行权限,否 则镜像 会 build成功 ,但 是 用 户申请创建 实例的 时候会 失 败对于singleton
的 题目(所有 选手共用 一个容器实例),请严格 注意 权限管 控
FROM ubuntu:20.04
RUN sed -i "s/http:\/\/archive.ubuntu.com/http:\/\/mirrors.ustc.edu.cn/g" /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y apt-utils lib32z1 xinetd
RUN useradd -u 8888 -m pwn
COPY share/libunicorn.so.1 /usr/local/lib/libunicorn.so.1
RUN chmod 755 /usr/local/lib/libunicorn.so.1
RUN ldconfig
COPY share/easiestpwn /home/pwn/easiestpwn
RUN chmod 755 /home/pwn/easiestpwn
RUN rm /etc/xinetd.d/*
COPY xinetd /etc/xinetd.d/xinetd
COPY entrypoint.sh /home/pwn/entrypoint.sh
ENTRYPOINT ["/home/pwn/entrypoint.sh"]
EXPOSE 8888
对于动态flagentrypoint.sh
entrypoint.sh
#!/bin/sh
echo $1 > flag #动态FLAG的 必须行 ,用 于平台 将 生成 的 FLAG写 入 ,也可自 行 调整写 入 位置
/usr/sbin/xinetd -dontfork #启动守 护进程
service pwn
{
disable = no
type = UNLISTED
wait = no
server = /bin/sh
# replace helloworld to your program
server_args = -c cd${IFS}/home/pwn;exec${IFS}./easiestpwn
socket_type = stream
protocol = tcp
user = pwn
port = 8888
# bind = 0.0.0.0
# safety options
flags = REUSE
per_source = 10 # the maximum instances of this service per source IP address
rlimit_cpu = 1 # the maximum number of CPU seconds that the service may use
#rlimit_as = 1024M # the Address Space resource limit for the service
#access_times = 2:00-9:00 12:00-24:00
nice = 18
}
举个/home/pwn/example
cd /home/pwn/example
tar -cvf ../example.tar ./*
yaml
name: dynamic_flag # challenge name
category: PWN # support [MISC|RE|PWN|WEB|CRYPTO|HARDWARE|RW]
score:
baseScore: 1000 # base score
dynamic: true # if the score change with solved number
flag:
value: xxxxxxxxxx # means that random dynamic flag length is 10
type: 3 # 0-Single 1-Multiple 2-Regexp 3-Dynamic
description: "description"
externalLink: ["http://link"]
singleton: false # false means this challenge will give every ctfer a container
# below is no need for singleton challenge
nodeConfig:
- name: "pwn1" # give this name same as your uploaded image
image: "pwn1" # give this name same as your uploaded image
servicePorts: # default & DON'T CHANGE IT
- name: http # default & DON'T CHANGE IT
protocol: TCP # default & DON'T CHANGE IT
external: 8888 # default & DON'T CHANGE IT
internal: 8888 # default & DON'T CHANGE IT
pod: 0 # default & DON'T CHANGE IT
ojtool
./ojtool export [-dir <export folder>]
-dir
data
ojtool
./ojtool load -welcome=<true/false> <csv file>
welcome
参 数 用 于指定 在 导入用 户后是 否 向 用 户发送 初 始 化 邮件<csv file>
为包含 需要 导入的 用 户数据 的 csv文 件 ,格式 为<mail>,<username>
,不 含表头
- 请在
app
目 录下打 开vscode - npm
相 关命令 ,请在app
目 录下运行 - 总之请将
app
做为工作 目 录
使用 Goland将 server
作 为工作 目 录
-
GraphQL
的 schema文 件 定 义在server/services/schema.graphql
目 录下 -
请求
成功 返 回 message 为空字 符 串 (没 有 消息 就是好 消息 )
npm install #必要 情 况下可 以删除 package-lock.json
如需
npm run prepare
构建
go run build.go --postgres #postgres版本
go run build.go --sqlite #sqlite版本 暂时弃用