diff --git a/charts/brokencrystals-experimental/Chart.yaml b/charts/brokencrystals-experimental/Chart.yaml index de101fe4..056f27a8 100644 --- a/charts/brokencrystals-experimental/Chart.yaml +++ b/charts/brokencrystals-experimental/Chart.yaml @@ -4,7 +4,7 @@ description: | Benchmark application that uses modern technologies and implements a set of common security vulnerabilities type: application -version: 0.0.21 +version: 0.0.22 keywords: - brokencrystals-exp - brkn-e diff --git a/charts/brokencrystals-experimental/templates/bc-prod-deployment.yaml b/charts/brokencrystals-experimental/templates/bc-prod-deployment.yaml index 128cf28e..5c2b986a 100644 --- a/charts/brokencrystals-experimental/templates/bc-prod-deployment.yaml +++ b/charts/brokencrystals-experimental/templates/bc-prod-deployment.yaml @@ -17,7 +17,7 @@ spec: spec: containers: - name: {{ include "brokencrystals.fullname" . }}-nodejs-app - image: brokencrystals:{{ .Values.images.main }} + image: brightsec/brokencrystals:{{ .Values.images.main }} # command: ["/bin/sleep"] # args: ["10000"] env: @@ -67,6 +67,10 @@ spec: scheme: HTTP initialDelaySeconds: 120 periodSeconds: 30 + volumes: + - name: {{ include "brokencrystals.fullname" . }}-nginx + configMap: + name: {{ include "brokencrystals.fullname" . }}-nginx --- kind: Service diff --git a/charts/brokencrystals-experimental/templates/ingress.yaml b/charts/brokencrystals-experimental/templates/ingress.yaml index 1f0aff24..adeb26ed 100644 --- a/charts/brokencrystals-experimental/templates/ingress.yaml +++ b/charts/brokencrystals-experimental/templates/ingress.yaml @@ -14,19 +14,19 @@ metadata: spec: tls: - hosts: - - {{ .Values.ingress.url }} + - {{ .Release.Name }}.{{ .Values.ingress.url }} secretName: {{ if eq .Values.ingress.cert "" }}{{ include "brokencrystals.fullname" . }}-brokencrystals-secret{{ else }}{{ .Values.ingress.cert }}{{ end }} rules: - - host: {{ .Values.ingress.url }} + - host: {{ .Release.Name }}.{{ .Values.ingress.url }} http: paths: - path: / pathType: Prefix backend: service: - name: {{ include "brokencrystals.fullname" . }}-nodejs-proxy-service + name: {{ include "brokencrystals.fullname" . }}-nodejs port: - number: 80 + number: 3000 --- apiVersion: networking.k8s.io/v1 diff --git a/charts/brokencrystals-experimental/templates/nginx-config.yaml b/charts/brokencrystals-experimental/templates/nginx-config.yaml new file mode 100644 index 00000000..43811f3f --- /dev/null +++ b/charts/brokencrystals-experimental/templates/nginx-config.yaml @@ -0,0 +1,75 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "brokencrystals.fullname" . }}-nginx + namespace: {{ .Release.Namespace }} +data: + # /etc/nginx/conf.d/default.conf + default.conf: | + server { + listen [::]:80 ipv6only=on; + listen 80; + + root /var/www/html; + + # Load configuration files for the default server block. + include /etc/nginx/default.d/*.conf; + + index index.html; + + location / { + autoindex on; + try_files $uri $uri/ /index.html =404; + } + + location /api { + # Forward API requests to the Node.js application + proxy_pass http://127.0.0.1:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /swagger { + # Forward /swagger requests to the Node.js application + proxy_pass http://127.0.0.1:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /graphiql { + # Forward /graphiql requests to the Node.js application + proxy_pass http://127.0.0.1:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /graphql { + # Forward /graphql requests to the Node.js application + proxy_pass http://127.0.0.1:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /put.raw { + # Forward /put.raw requests to the Node.js application + rewrite ^/put.raw /api/file/raw?path=./gil.txt break; + proxy_pass http://127.0.0.1:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location ~* ^/(config\.js|config\.json|\.htaccess|\.env|\.nginx\.conf|\.robots\.txt)$ { + allow all; + log_not_found off; + access_log off; + expires 1d; + } + + error_page 404 /404.html; + location = /404.html { + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + } + } diff --git a/charts/brokencrystals-experimental/values.yaml b/charts/brokencrystals-experimental/values.yaml index b7ff9c8c..9239c6c5 100644 --- a/charts/brokencrystals-experimental/values.yaml +++ b/charts/brokencrystals-experimental/values.yaml @@ -1,5 +1,5 @@ ingress: - url: brokencrystals-exp.dev.vuln.nexploit.app + url: k3s.brokencrystals.nexploit.app cert: "" authlevel: "." images: