Skip to content

Commit fcee9a6

Browse files
authored
fix(argo-cd): Enable Redis authentication in the default installation (argoproj#2705)
1 parent f9eb0b3 commit fcee9a6

File tree

16 files changed

+352
-14
lines changed

16 files changed

+352
-14
lines changed

charts/argo-cd/Chart.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
apiVersion: v2
2-
appVersion: v2.11.0
2+
appVersion: v2.11.1
33
kubeVersion: ">=1.23.0-0"
44
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
55
name: argo-cd
6-
version: 6.9.3
6+
version: 6.10.0
77
home: https://github.com/argoproj/argo-helm
88
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
99
sources:
@@ -26,5 +26,7 @@ annotations:
2626
fingerprint: 2B8F22F57260EFA67BE1C5824B11F800CD9D2252
2727
url: https://argoproj.github.io/argo-helm/pgp_keys.asc
2828
artifacthub.io/changes: |
29-
- kind: fixed
30-
description: Restarting dex pod when `argocd-cm` configmap changes
29+
- kind: security
30+
description: Enable Redis authentication in the default installation (GHSA-9766-5277-j5hr)
31+
- kind: changed
32+
description: Bump argo-cd to v2.11.1

charts/argo-cd/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,39 @@ For full list of changes please check ArtifactHub [changelog].
278278

279279
Highlighted versions provide information about additional steps that should be performed by user when upgrading to newer version.
280280

281+
### 6.10.0
282+
283+
This version introduces authentication for Redis to mitigate GHSA-9766-5277-j5hr.
284+
285+
#### How to rotate Redis secret?
286+
287+
Upstream steps in the [FAQ] are not enough, since we chose a different approach.
288+
(We use a Kubernetes Job with [Chart Hooks] to create the auth secret `argocd-redis`.)
289+
290+
Steps to roteate the secret when using the helm chart (bold step is additional to upstream):
291+
* Delete `argocd-redis` secret in the namespace where Argo CD is installed.
292+
```bash
293+
kubectl delete secret argocd-redis -n <argocd namesapce>
294+
```
295+
* **Perform a helm upgrade**
296+
```bash
297+
helm upgrade argocd argo/argo-cd --reuse-values --wait
298+
```
299+
* If you are running Redis in HA mode, restart Redis in HA.
300+
```bash
301+
kubectl rollout restart deployment argocd-redis-ha-haproxy
302+
kubectl rollout restart statefulset argocd-redis-ha-server
303+
```
304+
* If you are running Redis in non-HA mode, restart Redis.
305+
```bash
306+
kubectl rollout restart deployment argocd-redis
307+
```
308+
* Restart other components.
309+
```bash
310+
kubectl rollout restart deployment argocd-server argocd-repo-server
311+
kubectl rollout restart statefulset argocd-application-controller
312+
```
313+
281314
### 6.9.0
282315
ApplicationSet controller is always created to follow [upstream's manifest](https://github.com/argoproj/argo-cd/blob/v2.11.0/manifests/core-install/kustomization.yaml#L9).
283316

@@ -1271,8 +1304,10 @@ The main options are listed here:
12711304
|-----|------|---------|-------------|
12721305
| redis-ha.additionalAffinities | object | `{}` | Additional affinities to add to the Redis server pods. |
12731306
| redis-ha.affinity | string | `""` | Assign custom [affinity] rules to the Redis pods. |
1307+
| redis-ha.auth | bool | `true` | Configures redis-ha with AUTH |
12741308
| redis-ha.containerSecurityContext | object | See [values.yaml] | Redis HA statefulset container-level security context |
12751309
| redis-ha.enabled | bool | `false` | Enables the Redis HA subchart and disables the custom Redis single node deployment |
1310+
| redis-ha.existingSecret | string | `"argocd-redis"` | Existing Secret to use for redis-ha authentication. By default the redis-secret-init Job is generating this Secret. |
12761311
| redis-ha.exporter.enabled | bool | `false` | Enable Prometheus redis-exporter sidecar |
12771312
| redis-ha.exporter.image | string | `"public.ecr.aws/bitnami/redis-exporter"` | Repository to use for the redis-exporter |
12781313
| redis-ha.exporter.tag | string | `"1.58.0"` | Tag to use for the redis-exporter |
@@ -1316,6 +1351,29 @@ If you want to use an existing Redis (eg. a managed service from a cloud provide
13161351
| externalRedis.secretAnnotations | object | `{}` | External Redis Secret annotations |
13171352
| externalRedis.username | string | `""` | External Redis username |
13181353

1354+
### Redis secret-init
1355+
1356+
The helm chart deploys a Job to setup a random password which is used to secure the Redis. The Redis password is stored in Kubernetes secret `argocd-redis` with key `auth` in the namespace where Argo CD is installed.
1357+
If you use an External Redis (See Option 3 above), this Job is not deployed.
1358+
1359+
| Key | Type | Default | Description |
1360+
|-----|------|---------|-------------|
1361+
| redisSecretInit.containerSecurityContext | object | See [values.yaml] | Application controller container-level security context |
1362+
| redisSecretInit.image.imagePullPolicy | string | `""` (defaults to global.image.imagePullPolicy) | Image pull policy for the Redis secret-init Job |
1363+
| redisSecretInit.image.repository | string | `""` (defaults to global.image.repository) | Repository to use for the Redis secret-init Job |
1364+
| redisSecretInit.image.tag | string | `""` (defaults to global.image.tag) | Tag to use for the Redis secret-init Job |
1365+
| redisSecretInit.imagePullSecrets | list | `[]` (defaults to global.imagePullSecrets) | Secrets with credentials to pull images from a private registry |
1366+
| redisSecretInit.jobAnnotations | object | `{}` | Annotations to be added to the Redis secret-init Job |
1367+
| redisSecretInit.name | string | `"redis-secret-init"` | Redis secret-init name |
1368+
| redisSecretInit.podAnnotations | object | `{}` | Annotations to be added to the Redis secret-init Job |
1369+
| redisSecretInit.podLabels | object | `{}` | Labels to be added to the Redis secret-init Job |
1370+
| redisSecretInit.resources | object | `{}` | Resource limits and requests for Redis secret-init Job |
1371+
| redisSecretInit.securityContext | object | `{}` | Redis secret-init Job pod-level security context |
1372+
| redisSecretInit.serviceAccount.annotations | object | `{}` | Annotations applied to created service account |
1373+
| redisSecretInit.serviceAccount.automountServiceAccountToken | bool | `true` | Automount API credentials for the Service Account |
1374+
| redisSecretInit.serviceAccount.create | bool | `true` | Create a service account for the redis pod |
1375+
| redisSecretInit.serviceAccount.name | string | `""` | Service account name for redis pod |
1376+
13191377
## ApplicationSet
13201378

13211379
| Key | Type | Default | Description |
@@ -1507,8 +1565,10 @@ Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/
15071565
[BackendConfigSpec]: https://cloud.google.com/kubernetes-engine/docs/concepts/backendconfig#backendconfigspec_v1beta1_cloudgooglecom
15081566
[CSS styles]: https://argo-cd.readthedocs.io/en/stable/operator-manual/custom-styles/
15091567
[changelog]: https://artifacthub.io/packages/helm/argo/argo-cd?modal=changelog
1568+
[Chart Hooks]: https://helm.sh/docs/topics/charts_hooks/
15101569
[DNS configuration]: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
15111570
[external cluster credentials]: https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#clusters
1571+
[FAQ]: https://argo-cd.readthedocs.io/en/stable/faq/
15121572
[FrontendConfigSpec]: https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features#configuring_ingress_features_through_frontendconfig_parameters
15131573
[declarative setup]: https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup
15141574
[gRPC-ingress]: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/

charts/argo-cd/README.md.gotmpl

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,39 @@ For full list of changes please check ArtifactHub [changelog].
278278

279279
Highlighted versions provide information about additional steps that should be performed by user when upgrading to newer version.
280280

281+
### 6.10.0
282+
283+
This version introduces authentication for Redis to mitigate GHSA-9766-5277-j5hr.
284+
285+
#### How to rotate Redis secret?
286+
287+
Upstream steps in the [FAQ] are not enough, since we chose a different approach.
288+
(We use a Kubernetes Job with [Chart Hooks] to create the auth secret `argocd-redis`.)
289+
290+
Steps to roteate the secret when using the helm chart (bold step is additional to upstream):
291+
* Delete `argocd-redis` secret in the namespace where Argo CD is installed.
292+
```bash
293+
kubectl delete secret argocd-redis -n <argocd namesapce>
294+
```
295+
* **Perform a helm upgrade**
296+
```bash
297+
helm upgrade argocd argo/argo-cd --reuse-values --wait
298+
```
299+
* If you are running Redis in HA mode, restart Redis in HA.
300+
```bash
301+
kubectl rollout restart deployment argocd-redis-ha-haproxy
302+
kubectl rollout restart statefulset argocd-redis-ha-server
303+
```
304+
* If you are running Redis in non-HA mode, restart Redis.
305+
```bash
306+
kubectl rollout restart deployment argocd-redis
307+
```
308+
* Restart other components.
309+
```bash
310+
kubectl rollout restart deployment argocd-server argocd-repo-server
311+
kubectl rollout restart statefulset argocd-application-controller
312+
```
313+
281314
### 6.9.0
282315
ApplicationSet controller is always created to follow [upstream's manifest](https://github.com/argoproj/argo-cd/blob/v2.11.0/manifests/core-install/kustomization.yaml#L9).
283316

@@ -722,6 +755,19 @@ If you want to use an existing Redis (eg. a managed service from a cloud provide
722755
{{- end }}
723756
{{- end }}
724757

758+
### Redis secret-init
759+
760+
The helm chart deploys a Job to setup a random password which is used to secure the Redis. The Redis password is stored in Kubernetes secret `argocd-redis` with key `auth` in the namespace where Argo CD is installed.
761+
If you use an External Redis (See Option 3 above), this Job is not deployed.
762+
763+
| Key | Type | Default | Description |
764+
|-----|------|---------|-------------|
765+
{{- range .Values }}
766+
{{- if hasPrefix "redisSecretInit" .Key }}
767+
| {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |
768+
{{- end }}
769+
{{- end }}
770+
725771
## ApplicationSet
726772

727773
| Key | Type | Default | Description |
@@ -750,8 +796,10 @@ Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/
750796
[BackendConfigSpec]: https://cloud.google.com/kubernetes-engine/docs/concepts/backendconfig#backendconfigspec_v1beta1_cloudgooglecom
751797
[CSS styles]: https://argo-cd.readthedocs.io/en/stable/operator-manual/custom-styles/
752798
[changelog]: https://artifacthub.io/packages/helm/argo/argo-cd?modal=changelog
799+
[Chart Hooks]: https://helm.sh/docs/topics/charts_hooks/
753800
[DNS configuration]: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
754801
[external cluster credentials]: https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#clusters
802+
[FAQ]: https://argo-cd.readthedocs.io/en/stable/faq/
755803
[FrontendConfigSpec]: https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features#configuring_ingress_features_through_frontendconfig_parameters
756804
[declarative setup]: https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup
757805
[gRPC-ingress]: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/

charts/argo-cd/templates/_helpers.tpl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,25 @@ Create the name of the redis service account to use
8686
{{- end -}}
8787
{{- end -}}
8888

89+
90+
{{/*
91+
Create Redis secret-init name
92+
*/}}
93+
{{- define "argo-cd.redisSecretInit.fullname" -}}
94+
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.redisSecretInit.name | trunc 63 | trimSuffix "-" -}}
95+
{{- end -}}
96+
97+
{{/*
98+
Create the name of the Redis secret-init service account to use
99+
*/}}
100+
{{- define "argo-cd.redisSecretInit.serviceAccountName" -}}
101+
{{- if .Values.redisSecretInit.serviceAccount.create -}}
102+
{{ default (include "argo-cd.redisSecretInit.fullname" .) .Values.redis.serviceAccount.name }}
103+
{{- else -}}
104+
{{ default "default" .Values.redisSecretInit.serviceAccount.name }}
105+
{{- end -}}
106+
{{- end -}}
107+
89108
{{/*
90109
Create argocd server name and version as used by the chart label.
91110
*/}}

charts/argo-cd/templates/argocd-application-controller/deployment.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,19 @@ spec:
199199
- name: REDIS_USERNAME
200200
valueFrom:
201201
secretKeyRef:
202-
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
202+
name: {{ default "argocd-redis" .Values.externalRedis.existingSecret }}
203203
key: redis-username
204204
optional: true
205205
- name: REDIS_PASSWORD
206206
valueFrom:
207207
secretKeyRef:
208-
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
208+
name: {{ default "argocd-redis" .Values.externalRedis.existingSecret }}
209+
{{- if .Values.externalRedis.host }}
209210
key: redis-password
210211
optional: true
212+
{{- else }}
213+
key: auth
214+
{{- end }}
211215
- name: ARGOCD_DEFAULT_CACHE_EXPIRATION
212216
valueFrom:
213217
configMapKeyRef:

charts/argo-cd/templates/argocd-application-controller/statefulset.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,19 @@ spec:
198198
- name: REDIS_USERNAME
199199
valueFrom:
200200
secretKeyRef:
201-
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
201+
name: {{ default "argocd-redis" .Values.externalRedis.existingSecret }}
202202
key: redis-username
203203
optional: true
204204
- name: REDIS_PASSWORD
205205
valueFrom:
206206
secretKeyRef:
207-
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
207+
name: {{ default "argocd-redis" .Values.externalRedis.existingSecret }}
208+
{{- if .Values.externalRedis.host }}
208209
key: redis-password
209210
optional: true
211+
{{- else }}
212+
key: auth
213+
{{- end }}
210214
- name: ARGOCD_DEFAULT_CACHE_EXPIRATION
211215
valueFrom:
212216
configMapKeyRef:

charts/argo-cd/templates/argocd-configs/externalredis-secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v1
33
kind: Secret
44
metadata:
5-
name: {{ include "argo-cd.redis.fullname" . }}
5+
name: argocd-redis
66
namespace: {{ include "argo-cd.namespace" . }}
77
labels:
88
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}

charts/argo-cd/templates/argocd-repo-server/deployment.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,19 @@ spec:
175175
- name: REDIS_USERNAME
176176
valueFrom:
177177
secretKeyRef:
178-
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
178+
name: {{ default "argocd-redis" .Values.externalRedis.existingSecret }}
179179
key: redis-username
180180
optional: true
181181
- name: REDIS_PASSWORD
182182
valueFrom:
183183
secretKeyRef:
184-
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
184+
name: {{ default "argocd-redis" .Values.externalRedis.existingSecret }}
185+
{{- if .Values.externalRedis.host }}
185186
key: redis-password
186187
optional: true
188+
{{- else }}
189+
key: auth
190+
{{- end }}
187191
- name: ARGOCD_DEFAULT_CACHE_EXPIRATION
188192
valueFrom:
189193
configMapKeyRef:

charts/argo-cd/templates/argocd-server/deployment.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,19 @@ spec:
243243
- name: REDIS_USERNAME
244244
valueFrom:
245245
secretKeyRef:
246-
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
246+
name: {{ default "argocd-redis" .Values.externalRedis.existingSecret }}
247247
key: redis-username
248248
optional: true
249249
- name: REDIS_PASSWORD
250250
valueFrom:
251251
secretKeyRef:
252-
name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
252+
name: {{ default "argocd-redis" .Values.externalRedis.existingSecret }}
253+
{{- if .Values.externalRedis.host }}
253254
key: redis-password
254255
optional: true
256+
{{- else }}
257+
key: auth
258+
{{- end }}
255259
- name: ARGOCD_DEFAULT_CACHE_EXPIRATION
256260
valueFrom:
257261
configMapKeyRef:
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{{- if not .Values.externalRedis.host }}
2+
apiVersion: batch/v1
3+
kind: Job
4+
metadata:
5+
name: {{ include "argo-cd.redisSecretInit.fullname" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
annotations:
8+
"helm.sh/hook": pre-install,pre-upgrade
9+
"helm.sh/hook-delete-policy": before-hook-creation
10+
{{- range $key, $value := .Values.redisSecretInit.jobAnnotations }}
11+
{{ $key }}: {{ $value | quote }}
12+
{{- end }}
13+
labels:
14+
{{- include "argo-cd.labels" (dict "context" . "component" .Values.redisSecretInit.name "name" .Values.redisSecretInit.name) | nindent 4 }}
15+
spec:
16+
template:
17+
metadata:
18+
labels:
19+
{{- include "argo-cd.labels" (dict "context" . "component" .Values.redisSecretInit.name "name" .Values.redisSecretInit.name) | nindent 8 }}
20+
{{- with (mergeOverwrite (deepCopy .Values.global.podLabels) .Values.redisSecretInit.podLabels) }}
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
{{- with (mergeOverwrite (deepCopy .Values.global.podAnnotations) .Values.redisSecretInit.podAnnotations) }}
24+
annotations:
25+
{{- range $key, $value := . }}
26+
{{ $key }}: {{ $value | quote }}
27+
{{- end }}
28+
{{- end }}
29+
spec:
30+
{{- with .Values.global.imagePullSecrets }}
31+
imagePullSecrets:
32+
{{ toYaml . | nindent 8 }}
33+
{{- end }}
34+
containers:
35+
- command:
36+
- argocd
37+
- admin
38+
- redis-initial-password
39+
image: {{ default .Values.global.image.repository .Values.redisSecretInit.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.redisSecretInit.image.tag }}
40+
imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.redisSecretInit.image.imagePullPolicy }}
41+
name: secret-init
42+
resources:
43+
{{- toYaml .Values.redisSecretInit.resources | nindent 10 }}
44+
{{- with .Values.redisSecretInit.containerSecurityContext }}
45+
securityContext:
46+
{{- toYaml . | nindent 10 }}
47+
{{- end }}
48+
{{- with .Values.redisSecretInit.securityContext }}
49+
securityContext:
50+
{{- toYaml . | nindent 8 }}
51+
{{- end }}
52+
restartPolicy: OnFailure
53+
serviceAccountName: {{ include "argo-cd.redisSecretInit.serviceAccountName" . }}
54+
{{- end }}

0 commit comments

Comments
 (0)