-
Notifications
You must be signed in to change notification settings - Fork 4
/
k8s.yaml
365 lines (356 loc) · 9.11 KB
/
k8s.yaml
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: frontend
name: frontend
namespace: rctf
spec:
replicas: 3
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
enableServiceLinks: false
automountServiceAccountToken: false
containers:
- name: frontend
image: us-central1-docker.pkg.dev/<GCP PROJECT ID>/rctf/rctf:latest
imagePullPolicy: Always
# command: ['sleep', 'infinity']
env:
- name: PORT
value: "80"
- name: RCTF_INSTANCE_TYPE
value: frontend
envFrom:
- secretRef:
name: dbinfo
ports:
- containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 45
periodSeconds: 30
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 5
securityContext:
privileged: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
volumeMounts:
- name: config
mountPath: /app/conf.d
volumes:
- name: config
projected:
sources:
- configMap:
name: rctf-config
- secret:
name: chal-uploads-sa
items:
- key: uploads-yaml
path: 05-chal-uploads.yml
topologySpreadConstraints:
- maxSkew: 1
topologyKey: node
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: frontend
serviceAccountName: rctf
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: leaderboard
name: leaderboard
namespace: rctf
spec:
replicas: 1
serviceName: leaderboard
selector:
matchLabels:
app: leaderboard
template:
metadata:
labels:
app: leaderboard
spec:
enableServiceLinks: false
automountServiceAccountToken: false
containers:
- name: leaderboard
image: us-central1-docker.pkg.dev/<GCP PROJECT ID>/rctf/rctf:latest
imagePullPolicy: Always
env:
- name: PORT
value: "80"
- name: RCTF_INSTANCE_TYPE
value: leaderboard
envFrom:
- secretRef:
name: dbinfo
ports:
- containerPort: 80
protocol: TCP
securityContext:
privileged: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
volumeMounts:
- name: config
mountPath: /app/conf.d
volumes:
- name: config
projected:
sources:
- configMap:
name: rctf-config
- secret:
name: chal-uploads-sa
items:
- key: uploads-yaml
path: 05-chal-uploads.yml
serviceAccountName: rctf
---
apiVersion: v1
kind: Service
metadata:
name: frontend
namespace: rctf
spec:
type: ClusterIP
selector:
app: frontend
ports:
- port: 80
protocol: TCP
---
apiVersion: v1
kind: ConfigMap
metadata:
name: rctf-config
namespace: rctf
data:
01-ui.yml: |
ctfName: UIUCTF 2024
meta:
description: 'Solve challenges. Deliver passengers.'
homeContent: |
# UIUCTF 2024
UIUCTF is an annual capture-the-flag competition hosted by [SIGPwny](https://sigpwny.com/), the cybersecurity club at the University of Illinois Urbana-Champaign (UIUC).
Join our [Discord server](https://discord.gg/PytGqjq) for updates!
<action-button href="/register">
<span>Register Now</span>
<svg viewBox="4 4 16 16"><path fill="#ffffff" d="M16.01 11H4v2h12.01v3L20 12l-3.99-4z"></path></svg>
</action-button>
<timer></timer>
## Scenario
A massive outage is affecting the entire transit system!
The SIGPwny Transit Authority has issued an emergency call to CTF teams for help restore service.
Solve challenges to fix stations and deliver as many passengers as you can!
## Rules
1. **Don't cheat.** Each person can only compete on one team. Sharing flags or solves between teams will lead to immediate disqualification.
2. **Don't attack the infrastructure.** This includes brute-force attacks and tools that can generate excessive amounts of traffic, such as nmap, dirbuster, etc. unless otherwise specified.
3. **No flag hoarding or flag dumping!** It's not cool. We require teams to submit flags as they find them.
_Also, don't do anything orange and below on the [CTF tactics iceberg](https://twitter.com/gf_256/status/1206393845497376768/)._
## Sponsors
Thank you to our sponsors:
- [CrowdStrike](https://www.crowdstrike.com/)
- [Trail of Bits](https://www.trailofbits.com/)
- [Zellic](https://www.zellic.io/)
- [Battelle](https://www.battelle.org/)
- [REDLattice](https://redlattice.com/)
- [Google Cloud](https://goo.gle/ctfsponsorship)
02-ctf.yml: |
origin: https://rctf.2024.uiuc.tf
originFrontend: https://2024.uiuc.tf
divisions:
open: Open
defaultDivision: open
tokenKey: '<RCTF TOKEN>'
startTime: 1719619200000
endTime: 1719792000000
leaderboard:
maxLimit: 3000
03-db.yml: |
database:
sql:
host: postgres.rctf.svc.cluster.local
user: rctf
database: rctf
redis:
host: redis.rctf.svc.cluster.local
migrate: before
challengeProvider:
name: 'challenges/database'
04-email.yml: |
email:
from: no-reply@mail.uiuc.tf
provider:
name: 'emails/mailgun'
options:
apiKey: '<MAILGUN API KEY>'
domain: 'mail.uiuc.tf'
logoUrl: 'https://sigpwny.com/pwny8.svg'
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: traefik-role
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses
- ingressclasses
verbs:
- get
- list
- watch
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses/status
verbs:
- update
- apiGroups:
- traefik.io
resources:
- middlewares
- middlewaretcps
- ingressroutes
- traefikservices
- ingressroutetcps
- ingressrouteudps
- tlsoptions
- tlsstores
- serverstransports
- serverstransporttcps
verbs:
- get
- list
- watch
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-account
namespace: traefik
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: traefik-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: traefik-role
subjects:
- kind: ServiceAccount
name: traefik-account
namespace: traefik
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: traefik
namespace: traefik
labels:
app: traefik
spec:
replicas: 3
selector:
matchLabels:
app: traefik
template:
metadata:
labels:
app: traefik
spec:
serviceAccountName: traefik-account
containers:
- name: traefik
image: traefik:v3.0
args:
- --accesslog
- --entrypoints.http.Address=:80
- --entrypoints.https.Address=:443
- --entryPoints.chal.address=:1337
- --entryPoints.ping.address=:8082
- --entrypoints.http.http.redirections.entrypoint.to=https
- --entrypoints.http.http.redirections.entrypoint.scheme=https
- --ping.entryPoint=ping
- --providers.kubernetescrd
- --log.level=DEBUG
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
- name: chal
containerPort: 1337
- name: ping
containerPort: 8082
livenessProbe:
httpGet:
path: /ping
port: 8082
initialDelaySeconds: 45
periodSeconds: 30
readinessProbe:
httpGet:
path: /ping
port: 8082
initialDelaySeconds: 5
periodSeconds: 5
topologySpreadConstraints:
- maxSkew: 1
topologyKey: node
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: traefik
---
apiVersion: traefik.io/v1alpha1
kind: TLSOption
metadata:
name: default
namespace: default
spec:
sniStrict: false
---
apiVersion: traefik.io/v1alpha1
kind: TLSStore
metadata:
name: default
namespace: default
spec:
defaultCertificate:
secretName: tls-cert-chal