Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE:none does not disable Identity-based authentication #18726

Closed
nicpuppa opened this issue May 22, 2024 · 4 comments · Fixed by #19823
Assignees
Labels
component/zeebe Related to the Zeebe component/team kind/bug Categorizes an issue or PR as a bug likelihood/high A recurring issue severity/mid Marks a bug as having a noticeable impact but with a known workaround support Marks an issue as related to a customer support request target:2024-july-patch Issue must be completed before this target release version:8.5.6 version:8.6.0-alpha4 Label that represents issues released on version 8.6.0-alpha4

Comments

@nicpuppa
Copy link
Contributor

Describe the bug

It should be possible to set the env var ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE=none, then use the Zeebe REST API without authenticating via Identity/Keycloak as mentioned in our docs

To Reproduce

  • Install using separated-ingress-values.yaml and helm charts 10.0.5.
  • Port forwarding the zeebe-gateway pod
  • Try to execute the GET topology REST API with no bearer token: rest.zeebe.c8.dev.local/v1/topology.

The result is a 401 Unauthorized error.

Expected behavior

Setting ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE to none should disable Identity-based authentication.

Hint

Customer said that: If the spring.profiles.active: identity-auth in zeebe-gateway/configmap.yaml is commented-out/deactivated, then the Identity-based authentication is disabled.

Environment:

  • Camunda version: 8.5
  • Helm chart version: 10.0.4

Related to support case SUPPORT-22024

@nicpuppa nicpuppa added kind/bug Categorizes an issue or PR as a bug support Marks an issue as related to a customer support request component/zeebe Related to the Zeebe component/team labels May 22, 2024
@korthout korthout added target:2024-july-patch Issue must be completed before this target release severity/mid Marks a bug as having a noticeable impact but with a known workaround likelihood/high A recurring issue labels May 22, 2024
@korthout
Copy link
Member

Likelihood high because it is documented as such, and severity mid because there is a workaround present.

We should probably resolve this in the helm charts.

@koevskinikola koevskinikola removed their assignment Jun 19, 2024
@korthout
Copy link
Member

I believe the culprit is: https://github.com/camunda/camunda-platform-helm/blob/95625f4295bcf141cf434a50f2005f7489aa00d9/charts/camunda-platform-alpha/templates/zeebe-gateway/configmap.yaml#L18-L21

{{- if .Values.zeebe.enabled -}}
kind: ConfigMap
metadata:
  name: {{ include "zeebe.fullname.gateway" . }}-configuration
  labels:
    {{- include "zeebe.labels.gateway" . | nindent 4 }}
apiVersion: v1
data:
  gateway-log4j2.xml: |
{{- if .Values.zeebeGateway.log4j2 }}
    {{ .Values.zeebeGateway.log4j2 | indent 4 | trim }}
{{- end }}
{{- if .Values.zeebeGateway.configuration }}
  application.yaml: |
    {{ .Values.zeebeGateway.configuration | indent 4 | trim }}
{{- else }}
  application.yaml: |
    {{- if .Values.global.identity.auth.enabled }}
    spring:
      profiles:
        active: "identity-auth"

@korthout
Copy link
Member

My thought is that we should change that the profile is not made active on the gateway if the security.authentication.mode=none.

@korthout korthout self-assigned this Jun 21, 2024
@korthout
Copy link
Member

@aabouzaid and I investigated resolving this in the helm charts.


Our first thought was that the value of the environment variable ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE=none could be problematic in helm charts, due to a quirk in yaml: none can be interpreted as null by some yaml parsers. We tested this by setting ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE=NONE instead and unsuccessfully rerunning the test:

curl https://89t564-gke-2039.ci.distro.ultrawombat.com/zeebe/v1/topology
{"type":"about:blank","title":"Unauthorized","status":401,"detail":"Not Authenticated","instance":"https://89t564-gke-2039.ci.distro.ultrawombat.com/zeebe/v1/topology"}%


We then explored some ideas how we could ensure that the spring profile identity-auth is not set to active when the ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE env var is set to none. However, this leads to complex logic in the helm charts and is typically not suggested.

A better solution is to allow users of Zeebe Gateway to both enable the identity-auth profile and set ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE=none simultaneously. The result should be that ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE=none disables the authentication, regardless of the auto configuration provided by the identity-auth spring profile. This way, users are in control and can override settings explicitly.

Next, I'll explore what the identity-auth profile actually does in Zeebe Gateway, to see what the best way is to allow ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE=none to take precedence.

github-merge-queue bot pushed a commit that referenced this issue Jul 2, 2024
## Description

<!-- Describe the goal and purpose of this PR. -->
<!-- -->
<!-- For structural or foundational CI changes request review from
@cmur2 -->

As documented, the authentication of the Gateway can be completely
disabled by setting `security.authentication.mode: none`.

>The authentication could be disabled by `setting
security.authentication.mode: none` in the Gateway configuration file or
via `ZEEBE_GATEWAY_SECURITY_AUTHENTICATION_MODE=none` as environment
variable.

See:
https://docs.camunda.io/docs/self-managed/zeebe-deployment/security/client-authorization/#camunda-identity-authorization

For the GRPC API, this already works because we explicitly apply the
security configuration:

https://github.com/camunda/camunda/blob/a5a1003acfbe210482b38eea445d880f3f0023f6/zeebe/gateway-grpc/src/main/java/io/camunda/zeebe/gateway/Gateway.java#L387

For the REST API, the security configuration is controlled through
Spring magix. This made it easy to fix, but hard to test. The only
solution I could think of was an integration test in the same style as
`GatewayAuthenticationIdentityIT`.

https://github.com/camunda/camunda/blob/a5a1003acfbe210482b38eea445d880f3f0023f6/dist/src/main/java/io/camunda/zeebe/shared/security/SecurityConfiguration.java#L62-L64

## Related issues

closes #18726
github-merge-queue bot pushed a commit that referenced this issue Jul 31, 2024
…onfiguration (#19953)

# Description
Backport of #19823 to `stable/8.5`.

relates to #18726
original author: @korthout
@berkaycanbc berkaycanbc added the version:8.6.0-alpha4 Label that represents issues released on version 8.6.0-alpha4 label Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/zeebe Related to the Zeebe component/team kind/bug Categorizes an issue or PR as a bug likelihood/high A recurring issue severity/mid Marks a bug as having a noticeable impact but with a known workaround support Marks an issue as related to a customer support request target:2024-july-patch Issue must be completed before this target release version:8.5.6 version:8.6.0-alpha4 Label that represents issues released on version 8.6.0-alpha4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants