-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(reports): add auth proxy protecting report generators (#206)
- Loading branch information
1 parent
f6127ef
commit b91e9bd
Showing
14 changed files
with
366 additions
and
27 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{{- define "cryostat.reportsAuthProxy" -}} | ||
{{- if (.Values.authentication.openshift).enabled }} | ||
- name: {{ printf "%s-reports-%s" .Chart.Name "authproxy" }} | ||
securityContext: | ||
{{- toYaml .Values.openshiftOauthProxy.securityContext | nindent 4 }} | ||
image: "{{ .Values.openshiftOauthProxy.image.repository }}:{{ .Values.openshiftOauthProxy.image.tag }}" | ||
env: | ||
- name: COOKIE_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ default (printf "%s-cookie-secret" .Release.Name) .Values.authentication.cookieSecretName }} | ||
key: COOKIE_SECRET | ||
optional: false | ||
args: | ||
- --pass-access-token=false | ||
- --pass-user-bearer-token=false | ||
- --pass-basic-auth=false | ||
- --htpasswd-file=/etc/oauth2_proxy/basicauth/htpasswd | ||
- --upstream=http://localhost:10001/ | ||
- --cookie-secret=$(COOKIE_SECRET) | ||
- --request-logging=true | ||
- --openshift-service-account={{ include "cryostat.serviceAccountName" . }} | ||
- --proxy-websockets=true | ||
- --http-address=0.0.0.0:4180 | ||
- --https-address=:8443 | ||
- --tls-cert=/etc/tls/private/tls.crt | ||
- --tls-key=/etc/tls/private/tls.key | ||
- --proxy-prefix=/oauth2 | ||
- --bypass-auth-for=^/health$ | ||
imagePullPolicy: {{ .Values.openshiftOauthProxy.image.pullPolicy }} | ||
ports: | ||
- containerPort: 4180 | ||
name: http | ||
protocol: TCP | ||
- containerPort: 8443 | ||
name: https | ||
protocol: TCP | ||
resources: | ||
{{- toYaml .Values.openshiftOauthProxy.resources | nindent 4 }} | ||
volumeMounts: | ||
- name: {{ .Release.Name }}-proxy-tls | ||
mountPath: /etc/tls/private | ||
- name: {{ .Release.Name }}-reports-secret | ||
mountPath: /etc/oauth2_proxy/basicauth | ||
readOnly: true | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
{{- else }} | ||
- name: {{ printf "%s-reports-%s" .Chart.Name "authproxy" }} | ||
securityContext: | ||
{{- toYaml (.Values.oauth2Proxy).securityContext | nindent 4 }} | ||
image: "{{ (.Values.oauth2Proxy).image.repository }}:{{ (.Values.oauth2Proxy).image.tag }}" | ||
imagePullPolicy: {{ (.Values.oauth2Proxy).image.pullPolicy }} | ||
env: | ||
- name: OAUTH2_PROXY_CLIENT_ID | ||
value: dummy | ||
- name: OAUTH2_PROXY_CLIENT_SECRET | ||
value: none | ||
- name: OAUTH2_PROXY_HTTP_ADDRESS | ||
value: 0.0.0.0:4180 | ||
- name: OAUTH2_PROXY_UPSTREAMS | ||
value: http://localhost:10001/ | ||
- name: OAUTH2_PROXY_REDIRECT_URL | ||
value: "http://localhost:4180/oauth2/callback" | ||
- name: OAUTH2_PROXY_COOKIE_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ default (printf "%s-cookie-secret" .Release.Name) .Values.authentication.cookieSecretName }} | ||
key: COOKIE_SECRET | ||
optional: false | ||
- name: OAUTH2_PROXY_EMAIL_DOMAINS | ||
value: "*" | ||
- name: OAUTH2_PROXY_HTPASSWD_USER_GROUP | ||
value: write | ||
- name: OAUTH2_PROXY_HTPASSWD_FILE | ||
value: /etc/oauth2_proxy/basicauth/htpasswd | ||
- name: OAUTH2_PROXY_SKIP_AUTH_ROUTES | ||
value: "^/health$" | ||
- name: OAUTH2_PROXY_PROXY_WEBSOCKETS | ||
value: "false" | ||
ports: | ||
- containerPort: 4180 | ||
name: http | ||
protocol: TCP | ||
resources: | ||
{{- toYaml .Values.oauth2Proxy.resources | nindent 4 }} | ||
volumeMounts: | ||
- name: {{ .Release.Name }}-reports-secret | ||
mountPath: /etc/oauth2_proxy/basicauth | ||
readOnly: true | ||
{{- end }} | ||
{{- end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{- if empty .Values.reports.reportsSecretName -}} | ||
{{- $secretKey := include "cryostat.reportsPassSecretKey" . -}} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Release.Name }}-reports-secret | ||
labels: | ||
{{- include "cryostat.labels" $ | nindent 4 }} | ||
type: Opaque | ||
data: | ||
REPORTS_PASS: {{ $secretKey | b64enc }} | ||
htpasswd: {{ htpasswd "cryostat" $secretKey | b64enc }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
suite: test reports_secret.yaml | ||
templates: | ||
- reports_secret.yaml | ||
|
||
tests: | ||
- it: should create a reports secret if core.reportsSecretName is not set | ||
set: | ||
core.reportsSecretName: "" | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- equal: | ||
path: kind | ||
value: Secret | ||
- equal: | ||
path: metadata.name | ||
value: RELEASE-NAME-reports-secret | ||
- equal: | ||
path: type | ||
value: Opaque | ||
- exists: | ||
path: data.htpasswd | ||
- exists: | ||
path: data.REPORTS_PASS | ||
- equal: | ||
path: metadata.labels | ||
value: | ||
app.kubernetes.io/instance: RELEASE-NAME | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/name: cryostat | ||
app.kubernetes.io/part-of: cryostat | ||
app.kubernetes.io/version: 4.0.0-dev | ||
helm.sh/chart: cryostat-2.0.0-dev | ||
|
||
- it: should not create a database secret if reports.reportsSecretName is set | ||
set: | ||
reports.reportsSecretName: "custom-reports-secret" | ||
asserts: | ||
- hasDocuments: | ||
count: 0 |
Oops, something went wrong.