Skip to content

Commit 5fd17cc

Browse files
committed
fix: clean balancer
Signed-off-by: osamamagdy <[email protected]>
1 parent c78854c commit 5fd17cc

File tree

6 files changed

+680
-54
lines changed

6 files changed

+680
-54
lines changed

helm/package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "charts",
3+
"version": "v1.0.0",
4+
"description": "Wrongsecrets helm chart",
5+
"main": "index.js",
6+
"scripts": {
7+
"build": "helm package ./wrongsecrets-ctf-party",
8+
"subcharts": "helm dependency update ./wrongsecrets-ctf-party",
9+
"lint": "helm lint ./wrongsecrets-ctf-party",
10+
"validate": "npm run lint && npm run test",
11+
"template": "helm template --debug -f ./test-values.yaml myrelease ./wrongsecrets-ctf-party -n myns > test.tmp.yaml",
12+
"dry-run": "helm install --dry-run -f ./test-values.yaml unknown ./wrongsecrets-ctf-party",
13+
"doc": "helm-docs -s file",
14+
"preversion": "git fetch --prune --prune-tags && npm run lint && npm run build",
15+
"version": " export version=v$(node -p -e 'require(`./package.json`).version') && export app_version=$(echo $version | cut -d. -f2-).0 && yq e -i '.version=strenv(version)' ./tactful/Chart.yaml && yq e -i '.appVersion=strenv(app_version)' ./tactful/Chart.yaml && git add . ",
16+
"postversion": "git push && git push --tags"
17+
},
18+
"repository": {
19+
"type": "git",
20+
"url": "git+ssh://[email protected]/slickblox/charts.git"
21+
},
22+
"author": "Tactful.ai",
23+
"license": "ISC",
24+
"homepage": "https://bitbucket.org/slickblox/charts#readme"
25+
}

helm/test-values.yaml

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
# Default values for Wrongecret-ctf-party.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
imagePullPolicy: Always
6+
nodeSelector: {}
7+
8+
ingress:
9+
enabled: false
10+
annotations: {}
11+
# kubernetes.io/ingress.class: nginx
12+
# kubernetes.io/tls-acme: "true"
13+
hosts:
14+
- host: wrongsecrets-ctf-party.local
15+
paths:
16+
- "/"
17+
tls: []
18+
# - secretName: chart-example-tls
19+
# hosts:
20+
# - chart-example.local
21+
22+
service:
23+
type: ClusterIP
24+
port: 3000
25+
26+
balancer:
27+
cookie:
28+
# SET THIS TO TRUE IF IN PRODUCTION
29+
# Sets secure Flag in cookie
30+
# -- Sets the secure attribute on cookie so that it only be send over https
31+
secure: false
32+
# -- Changes the cookies name used to identify teams. Note will automatically be prefixed with "__Secure-" when balancer.cookie.secure is set to `true`
33+
name: balancer
34+
# -- Set this to a fixed random alpa-numeric string (recommended length 24 chars). If not set this get randomly generated with every helm upgrade, each rotation invalidates all active cookies / sessions requirering users to login again.
35+
cookieParserSecret: null
36+
repository: jeroenwillemsen/wrongsecrets-balancer
37+
tag: 1.6.4aws
38+
# -- Number of replicas of the wrongsecrets-balancer deployment. Changing this in a commit? PLEASE UPDATE THE GITHUB WORKLFOWS THEN!(NUMBER OF "TRUE")
39+
replicas: 2
40+
service:
41+
# -- Kubernetes service type
42+
type: ClusterIP
43+
# -- internal cluster service IP
44+
clusterIP: null
45+
# -- IP address to assign to load balancer (if supported)
46+
loadBalancerIP: null
47+
# -- list of IP CIDRs allowed access to lb (if supported)
48+
loadBalancerSourceRanges: null
49+
# -- IP address to assign to load balancer (if supported)
50+
externalIPs: null
51+
resources:
52+
requests:
53+
memory: 256Mi
54+
cpu: 400m
55+
limits:
56+
memory: 1024Mi
57+
cpu: 1000m
58+
securityContext:
59+
allowPrivilegeEscalation: false
60+
readOnlyRootFilesystem: true
61+
runAsNonRoot: true
62+
capabilities:
63+
drop:
64+
- ALL
65+
add:
66+
- CAP_NET_ADMIN
67+
- CAP_NET_BIND_SERVICE
68+
seccompProfile:
69+
type: RuntimeDefault
70+
# -- Optional Configure kubernetes scheduling affinity for the created JuiceShops (see: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
71+
affinity: {}
72+
# -- Optional Configure kubernetes toleration for the created JuiceShops (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
73+
tolerations: []
74+
# -- If set to true this skips setting ownerReferences on the teams JuiceShop Deployment and Services. This lets MultiJuicer run in older kubernetes cluster which don't support the reference type or the app/v1 deployment type
75+
skipOwnerReference: false
76+
env:
77+
REACT_APP_MOVING_GIF_LOGO: "https://i.gifer.com/9kGQ.gif" #displayed at the frontend when you enter the CTF
78+
REACT_APP_HEROKU_WRONGSECRETS_URL: "https://wrongsecrets-ctf.herokuapp.com" #required for 3 domain setup
79+
REACT_APP_CTFD_URL: "https://ctfd.io" #requierd for 2 and 3 domain setup
80+
REACT_APP_S3_BUCKET_URL: "s3://funstuff" #the s3 bucket you use for teh aws challenges, don't forget to make it accessible!
81+
K8S_ENV: "k8s" #or 'aws'
82+
REACT_APP_ACCESS_PASSWORD: "" #DEFAULT NO PASSWORD, PLAYING THIS IN PUBLIC? PUT A FANCY STRING HERE, BUT BE GENTLE: USERS NEED TO BE ABLE TO COPY THAT STUFF...
83+
REACT_APP_CREATE_TEAM_HMAC_KEY: "hardcodedkey"
84+
IRSA_ROLE: arn:aws:iam::233483431651:role/wrongsecrets-secret-manager #change this in your own AWS role!
85+
SECRETS_MANAGER_SECRET_ID_1: "wrongsecret" #only change if you need non-default AWS SM entries
86+
SECRETS_MANAGER_SECRET_ID_2: "wrongsecret-2" #only change if you need non-default AWS SM entries
87+
metrics:
88+
# -- enables prometheus metrics for the balancer. If set to true you should change the prometheus-scraper password
89+
enabled: true
90+
dashboards:
91+
# -- if true, creates a Grafana Dashboard Config Map. (also requires metrics.enabled to be true). These will automatically be imported by Grafana when using the Grafana helm chart, see: https://github.com/helm/charts/tree/main/stable/grafana#sidecar-for-dashboards
92+
enabled: false
93+
serviceMonitor:
94+
# -- If true, creates a Prometheus Operator ServiceMonitor (also requires metrics.enabled to be true). This will also deploy a servicemonitor which monitors metrics from the Juice Shop instances
95+
enabled: false
96+
basicAuth:
97+
username: prometheus-scraper
98+
# -- Should be changed when metrics are enabled.
99+
password: ERzCT4pwBDxfCKRGmfrMa8KQ8sXf8GKy
100+
101+
##TODO:
102+
#1. UPDATE WRONGSECRETS TO DEFINITION WHERE K8S IS USED FOR AWS!
103+
#2. UPDATE VIRTUALDESKTOP TO DEFINITION WHERE IT CN BE USED
104+
#3. ADD VAULT INSTANCE PER TEAM!
105+
106+
wrongsecrets:
107+
# -- Specifies how many Wrongsecrets instances should start at max. Set to -1 to remove the max Wrongsecrets instance cap
108+
maxInstances: 500
109+
# -- Wrongsecrets Image to use
110+
image: jeroenwillemsen/wrongsecrets
111+
tag: 1.6.4-no-vault
112+
# -- Change the key when hosting a CTF event. This key gets used to generate the challenge flags. See: https://github.com/OWASP/wrongsecrets#ctf
113+
ctfKey: "[email protected]!9uR_K!NfkkTr"
114+
# -- Specify a custom Juice Shop config.yaml. See the JuiceShop Config Docs for more detail: https://pwning.owasp-juice.shop/part1/customization.html#yaml-configuration-file
115+
# @default -- See values.yaml for full details
116+
config: |
117+
K8S_ENV: aws
118+
# application:
119+
# logo: https://raw.githubusercontent.com/iteratec/multi-juicer/main/images/multijuicer-icon-only-padding.png
120+
# favicon: https://raw.githubusercontent.com/iteratec/multi-juicer/main/wrongsecrets-balancer/ui/public/favicon.ico
121+
# showVersionNumber: false
122+
# showGitHubLinks: false
123+
# challenges:
124+
# showHints: true
125+
# hackingInstructor:
126+
# isEnabled: true
127+
# ctf:
128+
# showFlagsInNotifications: false
129+
# -- Specify a custom NODE_ENV for JuiceShop. If value is changed to something other than 'wrongsecrets-ctf-party' it's not possible to set a custom config via `juiceShop.config`.
130+
nodeEnv: "wrongsecrets-ctf-party"
131+
# -- Optional resources definitions to set for each JuiceShop instance
132+
resources:
133+
requests:
134+
cpu: 256Mi
135+
memory: 300Mi
136+
# limits:
137+
# cpu: 100m
138+
# memory: 200Mi
139+
# -- Optional securityContext definitions to set for each JuiceShop instance
140+
securityContext:
141+
allowPrivilegeEscalation: false
142+
readOnlyRootFilesystem: true
143+
runAsNonRoot: true
144+
capabilities:
145+
drop:
146+
- ALL
147+
seccompProfile:
148+
type: RuntimeDefault
149+
# -- Optional environment variables to set for each JuiceShop instance (see: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/)
150+
env:
151+
- name: K8S_ENV
152+
value: k8s
153+
- name: SPECIAL_K8S_SECRET
154+
valueFrom:
155+
configMapKeyRef:
156+
name: secrets-file
157+
key: funny.entry
158+
- name: SPECIAL_SPECIAL_K8S_SECRET
159+
valueFrom:
160+
secretKeyRef:
161+
name: funnystuff
162+
key: funnier
163+
# env:
164+
# - name: FOO
165+
# valueFrom:
166+
# secretKeyRef:
167+
# key: FOO
168+
# name: secret-resource
169+
# -- Optional mount environment variables from configMaps or secrets (see: https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#configure-all-key-value-pairs-in-a-secret-as-container-environment-variables)
170+
envFrom: []
171+
# -- Optional Volumes to set for each JuiceShop instance (see: https://kubernetes.io/docs/concepts/storage/volumes/)
172+
volumes: []
173+
# create config map with a custom logo via: kubectl create configmap custom-logo --from-file custom.png=your-logo.png
174+
# then switch out the logo parameter in the wrongsecrets config section above to the mounted filename.
175+
# volumes:
176+
# - name: logo
177+
# configMap:
178+
# name: custom-logo
179+
# -- Optional VolumeMounts to set for each JuiceShop instance (see: https://kubernetes.io/docs/concepts/storage/volumes/)
180+
volumeMounts: []
181+
# volumeMounts:
182+
# - name: logo
183+
# mountPath: /wrongsecrets/frontend/dist/frontend/assets/public/images/custom.png
184+
# subPath: custom.png
185+
# readOnly: true
186+
187+
# -- Optional Configure kubernetes scheduling affinity for the created JuiceShops (see: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
188+
affinity: {}
189+
# -- Optional Configure kubernetes toleration for the created JuiceShops (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
190+
tolerations: []
191+
192+
# -- Optional Can be used to configure the runtime class for the JuiceShop pods to add an additional layer of isolation to reduce the impact of potential container escapes. (see: https://kubernetes.io/docs/concepts/containers/runtime-class/)
193+
runtimeClassName: null
194+
195+
# Deletes unused JuiceShop instances after a configurable period of inactivity
196+
197+
#the virtual desktop for the deploymebt
198+
virtualdesktop:
199+
# -- Specifies how many JuiceShop instances MultiJuicer should start at max. Set to -1 to remove the max Juice Shop instance cap
200+
maxInstances: 500
201+
# -- Juice Shop Image to use
202+
image: jeroenwillemsen/wrongsecrets-desktop-k8s
203+
tag: 1.6.4
204+
repository: commjoenie/wrongSecrets
205+
resources:
206+
request:
207+
memory: 1GB
208+
cpu: 50m
209+
limits:
210+
memory: 2GB
211+
cpu: 1200m
212+
securityContext:
213+
allowPrivilegeEscalation: false
214+
readOnlyRootFilesystem: true
215+
runAsNonRoot: true
216+
capabilities:
217+
drop:
218+
- ALL
219+
seccompProfile:
220+
type: RuntimeDefault
221+
runtimeClassName: {}
222+
affinity: {}
223+
# -- Optional mount environment variables from configMaps or secrets (see: https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#configure-all-key-value-pairs-in-a-secret-as-container-environment-variables)
224+
225+
envFrom: []
226+
tolerations: []
227+
228+
# Deletes unused Wrongsecrets namespaces after a configurable period of inactivity
229+
wrongsecretsCleanup:
230+
repository: jeroenwillemsen/wrongsecrets-ctf-cleaner
231+
tag: 0.4
232+
enabled: true
233+
# -- Specifies when Juice Shop instances will be deleted when unused for that period.
234+
gracePeriod: 2d
235+
# -- Specifies if the clean up job should delete the outdated namespaces or just report them. Set to false to only report outdated namespaces.
236+
SHOULD_DELETE: false
237+
# -- Cron in which the clean up job is run. Defaults to once in a quarter. Change this if your grace period if shorter than 15 minutes. See "https://crontab.guru/#0,15,30,45_*_*_*_*" for more details.
238+
cron: "0,15,30,45 * * * *"
239+
successfulJobsHistoryLimit: 1
240+
failedJobsHistoryLimit: 1
241+
resources:
242+
requests:
243+
memory: 256Mi
244+
limits:
245+
memory: 256Mi
246+
# -- Optional Configure kubernetes scheduling affinity for the wrongsecretsCleanup Job(see: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
247+
affinity: {}
248+
# -- Optional Configure kubernetes toleration for the wrongsecretsCleanup Job (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
249+
tolerations: []

0 commit comments

Comments
 (0)