Skip to content

Commit 12984f3

Browse files
Add redis transit encryption (#3473)
1 parent 72a1b8d commit 12984f3

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

dojo/settings/settings.dist.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
DD_CELERY_BROKER_HOST=(str, ''),
5757
DD_CELERY_BROKER_PORT=(int, -1),
5858
DD_CELERY_BROKER_PATH=(str, '/dojo.celerydb.sqlite'),
59+
DD_CELERY_BROKER_PARAMS=(str, ''),
5960
DD_CELERY_TASK_IGNORE_RESULT=(bool, True),
6061
DD_CELERY_RESULT_BACKEND=(str, 'django-db'),
6162
DD_CELERY_RESULT_EXPIRES=(int, 86400),
@@ -162,7 +163,7 @@
162163
)
163164

164165

165-
def generate_url(scheme, double_slashes, user, password, host, port, path):
166+
def generate_url(scheme, double_slashes, user, password, host, port, path, params):
166167
result_list = []
167168
result_list.append(scheme)
168169
result_list.append(':')
@@ -181,6 +182,9 @@ def generate_url(scheme, double_slashes, user, password, host, port, path):
181182
if len(path) > 0 and path[0] != '/':
182183
result_list.append('/')
183184
result_list.append(path)
185+
if len(params) > 0 and params[0] != '?':
186+
result_list.append('?')
187+
result_list.append(params)
184188
return ''.join(result_list)
185189

186190

@@ -675,6 +679,7 @@ def generate_url(scheme, double_slashes, user, password, host, port, path):
675679
env('DD_CELERY_BROKER_HOST'),
676680
env('DD_CELERY_BROKER_PORT'),
677681
env('DD_CELERY_BROKER_PATH'),
682+
env('DD_CELERY_BROKER_PARAMS')
678683
)
679684
CELERY_TASK_IGNORE_RESULT = env('DD_CELERY_TASK_IGNORE_RESULT')
680685
CELERY_RESULT_BACKEND = env('DD_CELERY_RESULT_BACKEND')

helm/defectdojo/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v1
22
appVersion: "1.11.0-dev"
33
description: A Helm chart for Kubernetes to install DefectDojo
44
name: defectdojo
5-
version: 1.4.2
5+
version: 1.4.3
66
icon: https://www.defectdojo.org/img/favicon.ico

helm/defectdojo/templates/_helpers.tpl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ Create chart name and version as used by the chart label.
6363
{{- end -}}
6464
{{- end -}}
6565

66+
{{/*
67+
Determine the protocol to use for Redis.
68+
*/}}
69+
{{- define "redis.scheme" -}}
70+
{{- if eq .Values.celery.broker "redis" -}}
71+
{{- if .Values.redis.transportEncryption.enabled -}}
72+
{{- printf "rediss" -}}
73+
{{- else -}}
74+
{{- printf "redis" -}}
75+
{{- end -}}
76+
{{- end -}}
77+
{{- end -}}
78+
6679
{{/*
6780
Builds the repository names for use with local or private registries
6881
*/}}

helm/defectdojo/templates/configmap.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ data:
1414
DD_ADMIN_FIRST_NAME: {{ .Values.admin.FirstName | default "Admin" }}
1515
DD_ADMIN_LAST_NAME: {{ .Values.admin.LastName | default "User" }}
1616
DD_ALLOWED_HOSTS: {{ .Values.host }}
17-
DD_CELERY_BROKER_SCHEME: {{ if eq .Values.celery.broker "rabbitmq" }}amqp{{ end }}{{ if eq .Values.celery.broker "redis" }}redis{{ end }}
17+
DD_CELERY_BROKER_SCHEME: {{ if eq .Values.celery.broker "rabbitmq" }}amqp{{ end }}{{ if eq .Values.celery.broker "redis" }}{{ template "redis.scheme" . }}{{ end }}
1818
DD_CELERY_BROKER_USER: '{{ if eq .Values.celery.broker "rabbitmq" }}user{{ end }}'
1919
DD_CELERY_BROKER_HOST: {{ if eq .Values.celery.broker "rabbitmq" }}{{ .Release.Name }}-rabbitmq{{ else if eq .Values.celery.broker "redis" }}{{ template "redis.hostname" . }}{{ end }}
2020
DD_CELERY_BROKER_PORT: '{{ if eq .Values.celery.broker "rabbitmq" }}5672{{ end }}{{ if eq .Values.celery.broker "redis" }}6379{{ end }}'
21+
DD_CELERY_BROKER_PARAMS: '{{ if eq .Values.celery.broker "redis" }}{{- if .Values.redis.transportEncryption.enabled -}}{{ .Values.redis.transportEncryption.params | default "ssl_cert_reqs=optional" }}{{ end }}{{ end }}'
2122
DD_CELERY_LOG_LEVEL: {{ .Values.celery.logLevel }}
2223
DD_CELERY_WORKER_POOL_TYPE: {{ .Values.celery.worker.app_settings.pool_type | default "solo" }}
2324
DD_CELERY_WORKER_AUTOSCALE_MIN: '{{ if eq .Values.celery.worker.app_settings.pool_type "prefork" }}2{{ end }}'

helm/defectdojo/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,10 @@ postgresql:
191191
enabled: false
192192
service:
193193
port: 5432
194+
194195
# To use an external PostgreSQL instance, set enabled to false and uncomment
195196
# the line below:
196-
postgresServer: "127.0.0.1"
197+
# postgresServer: "127.0.0.1"
197198
master:
198199
affinity: {}
199200
nodeSelector: {}
@@ -233,6 +234,9 @@ rabbitmq:
233234

234235
redis:
235236
enabled: false
237+
transportEncryption:
238+
enabled: false
239+
params: ''
236240
existingSecret: defectdojo-redis-specific
237241
secretKey: redis-password
238242
password: ""

0 commit comments

Comments
 (0)