-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
340 lines (328 loc) · 7.93 KB
/
Copy pathdocker-compose.yml
File metadata and controls
340 lines (328 loc) · 7.93 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# Auto-generated by ./scripts/setup.sh from config/arena.env.
# Re-run that script instead of editing this file.
name: sandcastle
x-sandcastle-arena:
team_count: 2
service_port: 8080
ssh_base_port: 2200
ssh_bind_host: 127.0.0.1
startup_timeout_seconds: 120
round_duration_seconds: 120
flag_expiry_rounds: 5
checker_max_concurrency: 8
gameserver_port: 8000
visualizer_port: 4173
submission_rate_limit: 60
submission_rate_window_seconds: 60
score_attack_points: 10
score_defense_points: 2
score_sla_points: 1
team_vuln_mem_limit: 512m
team_vuln_cpu_limit: 0.50
team_vuln_pids_limit: 200
team_ssh_mem_limit: 128m
team_ssh_cpu_limit: 0.25
team_ssh_pids_limit: 100
team_app_mem_limit: 256m
team_app_cpu_limit: 0.50
team_app_pids_limit: 100
team_max_restarts: 5
visualizer_mem_limit: 128m
visualizer_cpu_limit: 0.25
log_max_size: 50m
log_max_files: 3
agent_provider: fake
agent_model: gpt-5.4-mini
agent_max_calls_per_round: 2
agent_max_calls_per_match: 30
agent_max_cost_usd_per_match: 5.00
networks:
ctf-network:
driver: bridge
ipam:
config:
- subnet: 10.10.0.0/16
gateway: 10.10.0.1
control-plane:
driver: bridge
services:
team1-vuln:
build:
context: .
dockerfile: docker/vuln/Dockerfile
args:
TEAM_ID: "1"
TEAM_NAME: "team1"
TEAM_USER: "team1"
TEAM_PASS: "team1pass"
TEAM_UID: "1000"
image: sandcastle/team1-vuln:latest
container_name: team1-vuln
hostname: team1-vuln
networks:
ctf-network:
ipv4_address: 10.10.1.3
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config/arena.env:/tmp/arena.env:ro
- ./teams/generated/team1/example-vuln:/home/team1/example-vuln
- ./services/example-vuln:/srv/example-vuln:ro
cap_add:
- NET_ADMIN
labels:
sandcastle.role: "vuln-machine"
sandcastle.team: "team1"
deploy:
resources:
limits:
memory: 512m
cpus: '0.50'
pids: 200
logging:
driver: json-file
options:
max-size: "50m"
max-file: "3"
restart: "on-failure:5"
team1-ssh:
build:
context: .
dockerfile: docker/ssh/Dockerfile
args:
TEAM_ID: "1"
TEAM_NAME: "team1"
TEAM_USER: "team1"
TEAM_PASS: "team1pass"
TEAM_UID: "1000"
image: sandcastle/team1-ssh:latest
container_name: team1-ssh
hostname: team1-ssh
depends_on:
- team1-vuln
networks:
ctf-network:
ipv4_address: 10.10.1.2
ports:
- "127.0.0.1:2201:22"
cap_add:
- NET_ADMIN
labels:
sandcastle.role: "ssh-gateway"
sandcastle.team: "team1"
deploy:
resources:
limits:
memory: 128m
cpus: '0.25'
pids: 100
logging:
driver: json-file
options:
max-size: "50m"
max-file: "3"
restart: "on-failure:5"
team2-vuln:
build:
context: .
dockerfile: docker/vuln/Dockerfile
args:
TEAM_ID: "2"
TEAM_NAME: "team2"
TEAM_USER: "team2"
TEAM_PASS: "team2pass"
TEAM_UID: "1000"
image: sandcastle/team2-vuln:latest
container_name: team2-vuln
hostname: team2-vuln
networks:
ctf-network:
ipv4_address: 10.10.2.3
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config/arena.env:/tmp/arena.env:ro
- ./teams/generated/team2/example-vuln:/home/team2/example-vuln
- ./services/example-vuln:/srv/example-vuln:ro
cap_add:
- NET_ADMIN
labels:
sandcastle.role: "vuln-machine"
sandcastle.team: "team2"
deploy:
resources:
limits:
memory: 512m
cpus: '0.50'
pids: 200
logging:
driver: json-file
options:
max-size: "50m"
max-file: "3"
restart: "on-failure:5"
team2-ssh:
build:
context: .
dockerfile: docker/ssh/Dockerfile
args:
TEAM_ID: "2"
TEAM_NAME: "team2"
TEAM_USER: "team2"
TEAM_PASS: "team2pass"
TEAM_UID: "1000"
image: sandcastle/team2-ssh:latest
container_name: team2-ssh
hostname: team2-ssh
depends_on:
- team2-vuln
networks:
ctf-network:
ipv4_address: 10.10.2.2
ports:
- "127.0.0.1:2202:22"
cap_add:
- NET_ADMIN
labels:
sandcastle.role: "ssh-gateway"
sandcastle.team: "team2"
deploy:
resources:
limits:
memory: 128m
cpus: '0.25'
pids: 100
logging:
driver: json-file
options:
max-size: "50m"
max-file: "3"
restart: "on-failure:5"
firewall:
build:
context: ./firewall
image: sandcastle/firewall:latest
container_name: sandcastle-firewall
hostname: sandcastle-firewall
network_mode: host
environment:
CTF_NETWORK: "10.10.0.0/16"
CTF_GATEWAY: "10.10.0.1"
WS_PORT: "6789"
PROXY_PORT: "15000"
EVENT_QUEUE_SIZE: "2048"
CAPTURE_RCVBUF_BYTES: "4194304"
RECENT_ICMP_LIMIT: "4096"
cap_add:
- NET_ADMIN
- NET_RAW
labels:
sandcastle.role: "firewall"
deploy:
resources:
limits:
memory: 128m
cpus: '0.50'
logging:
driver: json-file
options:
max-size: "50m"
max-file: "3"
restart: unless-stopped
gameserver:
build:
context: .
dockerfile: gameserver/Dockerfile
image: sandcastle/gameserver:latest
container_name: sandcastle-gameserver
hostname: sandcastle-gameserver
networks:
ctf-network:
ipv4_address: 10.10.0.2
control-plane: {}
ports:
- "8000:8000"
volumes:
- gameserver-data:/app/data
- ./config/arena.env:/app/config/arena.env:ro
environment:
CHECKER_MASTER_SECRET: "sandcastle-local-checker-secret-change-me"
GAMESERVER_OPERATOR_TOKEN: "sandcastle-local-operator-token-change-me"
labels:
sandcastle.role: "gameserver"
deploy:
resources:
limits:
memory: 512m
cpus: '1.00'
logging:
driver: json-file
options:
max-size: "50m"
max-file: "3"
restart: unless-stopped
bot-controller:
build:
context: .
dockerfile: bot/Dockerfile
image: sandcastle/bot-controller:latest
container_name: sandcastle-bot-controller
hostname: sandcastle-bot-controller
networks:
ctf-network:
ipv4_address: 10.10.0.4
control-plane: {}
ports:
- "127.0.0.1:7878:7878"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config/arena.env:/app/config/arena.env:ro
- ./challenges:/app/challenges
- bot-controller-data:/data
environment:
ARENA_BOT_API_PORT: "7878"
CHALLENGE_VALIDATION_NETWORK: "sandcastle_ctf-network"
OPENAI_API_KEY: "${OPENAI_API_KEY:-}"
GEMINI_API_KEY: "${GEMINI_API_KEY:-}"
labels:
sandcastle.role: "bot-controller"
sandcastle.visualizer.hidden: "true"
deploy:
resources:
limits:
memory: 256m
cpus: '0.50'
logging:
driver: json-file
options:
max-size: "50m"
max-file: "3"
restart: unless-stopped
visualizer:
build:
context: .
dockerfile: visualizer/Dockerfile
image: sandcastle/visualizer:latest
container_name: sandcastle-visualizer
hostname: sandcastle-visualizer
network_mode: host
labels:
sandcastle.role: "visualizer"
deploy:
resources:
limits:
memory: 128m
cpus: '0.25'
logging:
driver: json-file
options:
max-size: "50m"
max-file: "3"
restart: unless-stopped
volumes:
gameserver-data:
name: sandcastle_gameserver-data
labels:
sandcastle.role: "gameserver-data"
bot-controller-data:
name: sandcastle_bot-controller-data
labels:
sandcastle.role: "bot-controller-data"