From b395741ebdba6519c89a7822d859419c008d32e8 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sat, 9 May 2026 00:38:36 +0200 Subject: [PATCH 1/3] Add networkpolicy in nextportal chart Dump version 1.0.0 --- charts/nextportal/CONTRIBUTING.md | 4 +-- charts/nextportal/Chart.yaml | 2 +- .../nextportal/templates/networkpolicy.yaml | 35 +++++++++++++++++++ charts/nextportal/values.yaml | 3 ++ 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 charts/nextportal/templates/networkpolicy.yaml diff --git a/charts/nextportal/CONTRIBUTING.md b/charts/nextportal/CONTRIBUTING.md index 146427d..e0613e3 100644 --- a/charts/nextportal/CONTRIBUTING.md +++ b/charts/nextportal/CONTRIBUTING.md @@ -21,7 +21,7 @@ Install the chart: ```bash helm upgrade --install nextportal . -f values.yaml -f values.mine.yaml \ - --set ingress.domain=nextportal.console.$SANDBOX_ID.instruqt.io \ + --set ingress.domain=nextportal.server.$SANDBOX_ID.instruqt.io \ --namespace nextportal --create-namespace ``` @@ -34,5 +34,5 @@ kubectl get all -n nextportal Open the web application in a browser. ```bash -echo "https://nextportal.console.${SANDBOX_ID}.instruqt.io" +echo "https://nextportal.server.${SANDBOX_ID}.instruqt.io" ``` diff --git a/charts/nextportal/Chart.yaml b/charts/nextportal/Chart.yaml index 69d77c8..cd17079 100644 --- a/charts/nextportal/Chart.yaml +++ b/charts/nextportal/Chart.yaml @@ -2,7 +2,7 @@ name: nextportal description: NextPortal web application - intentionally vulnerable by default for security workshops type: application -version: 0.1.0 +version: 1.0.0 appVersion: "0.1.0" keywords: - security diff --git a/charts/nextportal/templates/networkpolicy.yaml b/charts/nextportal/templates/networkpolicy.yaml new file mode 100644 index 0000000..7a6c1de --- /dev/null +++ b/charts/nextportal/templates/networkpolicy.yaml @@ -0,0 +1,35 @@ +{{- if .Values.networkpolicy.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: {{ include "nextportal.fullname" . }} + labels: + {{- include "nextportal.labels" . | nindent 4 }} +spec: + podSelector: + matchLabels: + {{- include "nextportal.selectorLabels" . | nindent 6 }} + policyTypes: + - Ingress + - Egress + ingress: + # allow traffic only from the ingress controller namespace + - from: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: kube-system + ports: + - protocol: TCP + port: {{ .Values.service.port }} + egress: + # allows DNS resolution + - ports: + - protocol: UDP + port: 53 + - protocol: TCP + port: 53 + # allows outbound HTTPS (for Google Fonts CDN) + - ports: + - protocol: TCP + port: 443 +{{- end }} diff --git a/charts/nextportal/values.yaml b/charts/nextportal/values.yaml index c04318f..3770fdd 100644 --- a/charts/nextportal/values.yaml +++ b/charts/nextportal/values.yaml @@ -72,6 +72,9 @@ nodeSelector: {} tolerations: [] affinity: {} +networkpolicy: + enabled: false + env: NODE_ENV: production NEXT_TELEMETRY_DISABLED: "1" From d32a1880d3a385ed83ca5af8bbb24c4f006d8c9a Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sat, 9 May 2026 00:39:05 +0200 Subject: [PATCH 2/3] Add tinyfilemanager chart --- charts/tinyfilemanager/CONTRIBUTING.md | 38 +++++++++ charts/tinyfilemanager/Chart.yaml | 14 ++++ charts/tinyfilemanager/README.md | 34 ++++++++ charts/tinyfilemanager/templates/NOTES.txt | 20 +++++ charts/tinyfilemanager/templates/_helpers.tpl | 49 +++++++++++ .../tinyfilemanager/templates/deployment.yaml | 76 +++++++++++++++++ charts/tinyfilemanager/templates/hpa.yaml | 22 +++++ charts/tinyfilemanager/templates/ingress.yaml | 33 ++++++++ .../templates/networkpolicy.yaml | 35 ++++++++ charts/tinyfilemanager/templates/service.yaml | 15 ++++ charts/tinyfilemanager/values.yaml | 83 +++++++++++++++++++ 11 files changed, 419 insertions(+) create mode 100644 charts/tinyfilemanager/CONTRIBUTING.md create mode 100644 charts/tinyfilemanager/Chart.yaml create mode 100644 charts/tinyfilemanager/README.md create mode 100644 charts/tinyfilemanager/templates/NOTES.txt create mode 100644 charts/tinyfilemanager/templates/_helpers.tpl create mode 100644 charts/tinyfilemanager/templates/deployment.yaml create mode 100644 charts/tinyfilemanager/templates/hpa.yaml create mode 100644 charts/tinyfilemanager/templates/ingress.yaml create mode 100644 charts/tinyfilemanager/templates/networkpolicy.yaml create mode 100644 charts/tinyfilemanager/templates/service.yaml create mode 100644 charts/tinyfilemanager/values.yaml diff --git a/charts/tinyfilemanager/CONTRIBUTING.md b/charts/tinyfilemanager/CONTRIBUTING.md new file mode 100644 index 0000000..0c66f90 --- /dev/null +++ b/charts/tinyfilemanager/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Contribution guide + +## Validate on a test cluster + +Create the chart configuration file: + +```bash +# example for an Instruqt track, with a Traefik ingress controller, with cert-manager and Let's Encrypt +cat > values.mine.yaml << 'EOF' +ingress: + enabled: true + className: "traefik" + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" + tls: + enabled: true +EOF +``` + +Install the chart: + +```bash +helm upgrade --install tinyfilemanager . -f values.yaml -f values.mine.yaml \ + --set ingress.domain=tinyfilemanager.server.$SANDBOX_ID.instruqt.io \ + --namespace tinyfilemanager --create-namespace +``` + +Wait for all pods to be ready: + +```bash +kubectl get all -n tinyfilemanager +``` + +Open the web application in a browser. + +```bash +echo "https://tinyfilemanager.server.${SANDBOX_ID}.instruqt.io" +``` diff --git a/charts/tinyfilemanager/Chart.yaml b/charts/tinyfilemanager/Chart.yaml new file mode 100644 index 0000000..1f92460 --- /dev/null +++ b/charts/tinyfilemanager/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +name: tinyfilemanager +description: Tiny File Manager - intentionally vulnerable by default for security workshops +type: application +version: 1.0.0 +appVersion: "2.4.6" +keywords: + - security + - vulnerable + - workshop + - owasp +maintainers: + - name: devpro + email: bertrand@devpro.fr diff --git a/charts/tinyfilemanager/README.md b/charts/tinyfilemanager/README.md new file mode 100644 index 0000000..f592dc1 --- /dev/null +++ b/charts/tinyfilemanager/README.md @@ -0,0 +1,34 @@ +# Tiny File Manager Helm Chart + +Helm chart for [Tiny File Manager](https://tinyfilemanager.github.io/) — designed for container security workshops. + +## Quick Start + +Add the chart repository: + +```bash +helm repo add devpro https://devpro.github.io/helm-charts +helm repo update +``` + +Create the `values.yaml` file to override [default values](values.yaml). + +Install the chart: + +```bash +helm upgrade --install tinyfilemanager devpro/nextportal -f values.yaml --namespace tinyfilemanager --create-namespace +``` + +## Uninstall + +```bash +helm uninstall tinyfilemanager -n tinyfilemanager +kubectl delete namespace tinyfilemanager +``` + +## Going further + +Check the [contribution guide](CONTRIBUTING.md). + +--- +> ⚠️ **FOR WORKSHOP USE ONLY** — intentionally vulnerable, never expose to the internet. diff --git a/charts/tinyfilemanager/templates/NOTES.txt b/charts/tinyfilemanager/templates/NOTES.txt new file mode 100644 index 0000000..75ea141 --- /dev/null +++ b/charts/tinyfilemanager/templates/NOTES.txt @@ -0,0 +1,20 @@ +1. Tiny File Manager web application has been deployed. + +{{- if .Values.ingress.enabled }} + URL: https://{{ .Values.ingress.domain }} + + TLS certificate will be issued automatically by cert-manager. + Watch progress with: + kubectl get certificate -n {{ .Release.Namespace }} + kubectl describe certificaterequest -n {{ .Release.Namespace }} +{{- else }} + Port-forward to access locally: + kubectl port-forward svc/{{ include "tinyfilemanager.fullname" . }} 3000:3000 -n {{ .Release.Namespace }} + then open http://localhost:3000 +{{- end }} + +2. Check pod status: + kubectl get pods -n {{ .Release.Namespace }} -l app.kubernetes.io/name={{ include "tinyfilemanager.name" . }} + +3. View logs: + kubectl logs -n {{ .Release.Namespace }} -l app.kubernetes.io/name={{ include "tinyfilemanager.name" . }} -f diff --git a/charts/tinyfilemanager/templates/_helpers.tpl b/charts/tinyfilemanager/templates/_helpers.tpl new file mode 100644 index 0000000..09da1b5 --- /dev/null +++ b/charts/tinyfilemanager/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "tinyfilemanager.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +*/}} +{{- define "tinyfilemanager.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Chart label. +*/}} +{{- define "tinyfilemanager.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels. +*/}} +{{- define "tinyfilemanager.labels" -}} +helm.sh/chart: {{ include "tinyfilemanager.chart" . }} +{{ include "tinyfilemanager.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels. +*/}} +{{- define "tinyfilemanager.selectorLabels" -}} +app.kubernetes.io/name: {{ include "tinyfilemanager.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/charts/tinyfilemanager/templates/deployment.yaml b/charts/tinyfilemanager/templates/deployment.yaml new file mode 100644 index 0000000..a805030 --- /dev/null +++ b/charts/tinyfilemanager/templates/deployment.yaml @@ -0,0 +1,76 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "tinyfilemanager.fullname" . }} + labels: + {{- include "tinyfilemanager.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + type: RollingUpdate + selector: + matchLabels: + {{- include "tinyfilemanager.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + # forces a rollout when values change even if the image tag is the same + checksum/config: {{ toYaml .Values.env | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "tinyfilemanager.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.podSecurityContext }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.containerSecurityContext }} + securityContext: + {{- toYaml .Values.containerSecurityContext | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: 80 + protocol: TCP + env: + {{- range $key, $val := .Values.env }} + - name: {{ $key }} + value: {{ $val | quote }} + {{- end }} + {{- with .Values.envFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + {{- if .Values.resources }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + restartPolicy: Always diff --git a/charts/tinyfilemanager/templates/hpa.yaml b/charts/tinyfilemanager/templates/hpa.yaml new file mode 100644 index 0000000..0f1106b --- /dev/null +++ b/charts/tinyfilemanager/templates/hpa.yaml @@ -0,0 +1,22 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "tinyfilemanager.fullname" . }} + labels: + {{- include "tinyfilemanager.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "tinyfilemanager.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} +{{- end }} diff --git a/charts/tinyfilemanager/templates/ingress.yaml b/charts/tinyfilemanager/templates/ingress.yaml new file mode 100644 index 0000000..5894081 --- /dev/null +++ b/charts/tinyfilemanager/templates/ingress.yaml @@ -0,0 +1,33 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "tinyfilemanager.fullname" . }} + labels: + {{- include "tinyfilemanager.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + rules: + - host: {{ .Values.ingress.domain | quote }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "tinyfilemanager.fullname" $ }} + port: + name: http + {{- if .Values.ingress.tls.enabled }} + tls: + - secretName: tinyfilemanager-tls + hosts: + - {{ .Values.ingress.domain | quote }} + {{- end }} +{{- end }} diff --git a/charts/tinyfilemanager/templates/networkpolicy.yaml b/charts/tinyfilemanager/templates/networkpolicy.yaml new file mode 100644 index 0000000..4650615 --- /dev/null +++ b/charts/tinyfilemanager/templates/networkpolicy.yaml @@ -0,0 +1,35 @@ +{{- if .Values.networkpolicy.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: {{ include "tinyfilemanager.fullname" . }} + labels: + {{- include "tinyfilemanager.labels" . | nindent 4 }} +spec: + podSelector: + matchLabels: + {{- include "tinyfilemanager.selectorLabels" . | nindent 6 }} + policyTypes: + - Ingress + - Egress + ingress: + # allow traffic only from the ingress controller namespace + - from: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: kube-system + ports: + - protocol: TCP + port: {{ .Values.service.port }} + egress: + # allows DNS resolution + - ports: + - protocol: UDP + port: 53 + - protocol: TCP + port: 53 + # allows outbound HTTPS (for Google Fonts CDN) + - ports: + - protocol: TCP + port: 443 +{{- end }} diff --git a/charts/tinyfilemanager/templates/service.yaml b/charts/tinyfilemanager/templates/service.yaml new file mode 100644 index 0000000..fd28b34 --- /dev/null +++ b/charts/tinyfilemanager/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "tinyfilemanager.fullname" . }} + labels: + {{- include "tinyfilemanager.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + selector: + {{- include "tinyfilemanager.selectorLabels" . | nindent 4 }} + ports: + - name: http + port: {{ .Values.service.port }} + targetPort: http + protocol: TCP diff --git a/charts/tinyfilemanager/values.yaml b/charts/tinyfilemanager/values.yaml new file mode 100644 index 0000000..d6897b2 --- /dev/null +++ b/charts/tinyfilemanager/values.yaml @@ -0,0 +1,83 @@ +image: + repository: ghcr.io/devpro/tinyfilemanager + tag: "2.4.6" + pullPolicy: IfNotPresent + +imagePullSecrets: [] + # - name: "" + +replicaCount: 1 + +podAnnotations: {} + +resources: {} + # requests: + # cpu: 100m + # memory: 128Mi + # limits: + # cpu: 500m + # memory: 512Mi + +service: + type: ClusterIP + port: 8080 + +ingress: + enabled: false + # e.g. traefik + className: "" + domain: "" + annotations: {} + # cert-manager.io/cluster-issuer: "letsencrypt-prod" + # traefik.ingress.kubernetes.io/router.entrypoints: websecure + # traefik.ingress.kubernetes.io/router.tls: "true" + # traefik.ingress.kubernetes.io/router.middlewares: default-redirect-https@kubernetescrd + tls: + enabled: false + +livenessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 15 + periodSeconds: 20 + +readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 5 + periodSeconds: 10 + +podSecurityContext: {} + # runAsNonRoot: true + # runAsUser: 1001 + # runAsGroup: 1001 + # fsGroup: 1001 + +containerSecurityContext: {} + # allowPrivilegeEscalation: false + # readOnlyRootFilesystem: false + # capabilities: + # drop: + # - ALL + +autoscaling: + enabled: false + minReplicas: 2 + maxReplicas: 10 + targetCPUUtilizationPercentage: 70 + +nodeSelector: {} +tolerations: [] +affinity: {} + +networkpolicy: + enabled: false + +env: + DUMMY: + +# envFrom: +# - secretRef: +# name: "" From efc07090121335403503758aea492a05b6864316 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sat, 9 May 2026 00:42:23 +0200 Subject: [PATCH 3/3] Fix typo in env --- charts/tinyfilemanager/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tinyfilemanager/values.yaml b/charts/tinyfilemanager/values.yaml index d6897b2..9546227 100644 --- a/charts/tinyfilemanager/values.yaml +++ b/charts/tinyfilemanager/values.yaml @@ -76,7 +76,7 @@ networkpolicy: enabled: false env: - DUMMY: + ENVIRONMENT: sandbox # envFrom: # - secretRef: