Skip to content

Different Authentication/Authorization for Different Use Cases (multiple listeners?) #3000

@forsberg

Description

@forsberg

Feature or Problem Description

Authentication/Authorization is always a tricky subject. I'm trying to wrap how Apicurio supports it around the use cases I see.

So let me describe my use cases, and how I currently use Confluent Registry + some nginx trickery to solve it.

Background

We have a Kubernetes cluster that runs, among other things, Kafka, the Confluent Schema Registry and a bunch of streaming applications.

We would like to migrate to Apicurio as it has a UI and supports more API types (specifically, AsyncAPI).

CI/CD API access to registry, from gitlab, verifying and registering schemas during build-time

Gitlab authenticates Vault to via gitlab's built in JWT issuer and gets a short-lived TLS certificate, which it then uses to authenticate to the nginx ingress that sits in front of Confluent Registry. I.e, I have configured in vault that some gitlab jobs, if they match the right set of claims, are allowed to retrieve this certificate, and hence, gain R/W access to the registry.

I guess with Apicurio, the idea is to use Keycloak, but I don't quite get how I would authenticate my gitlab jobs to Keycloak? I'm toying with the idea of using vault to retrieve a certificate that can authenticate to Keycloak's mTLS feature and then get access to an OIDC with the right roles to talk to Apicurio, but it feels... complicated.

Human Interface to Registry, mostly for read-only access.

We use nginx with some rules that forbid POST/PUT (except for one of the endpoints which will only verify schemas, not write them) in front of the registry, and then oauth2proxy for integration with Google Workspace OIDC. This provides developers with a read-only view of the schemas, which is fine for most purposes.

Here I can clearly see how Keycloak with federation can solve the problem.

Read-Only access to schema API from applications inside Kubernetes cluster

For streaming applications that run inside our Kubernetes cluster, the only requirement is read-only access to the Confluent REST API, as all schema registration happens at CI/CD time. For this, we use the same readonly nginx rules as above, and add some NetworkPolicy to restrict which applications is allowed to talk with the registry API. This has been deemed good enough for our use case, even though it could potentially leak some information about which schemas exist, to applications that should not have this information.

I have a hard time figuring out how I would implement this in a Keycloak-enabled Apicurio setup. Perhaps I'm missing some puzzle piece here in what the idea is on how to authenticate applications running Kubernetes to Keycloak so they can get an OIDC token and retrieve their schemas? But I also think this may be overkill and a bit too complicated for many installations.

Proposed Solution

One possible solution is to support multiple listeners for Apicurio Registry, where each listener have its own authentication access, a bit like Kafka Does it. To support my use cases above, I could then configure three different listeners:

  • One with Mutual TLS authentication for CI/CD access. How to authorize access to different subjects/groups is left as an exercise for the reader, but could be based on attributes in the certificate. Alternatively, this use case would be supported by via mTLS in Keycloak.
  • One protected by Keycloak, for human access.
  • One with read-only access to all schemas. For intra-cluster communication this doesn't even necessarily have to be encrypted.

Not saying this is the optimal solution, mostly I'm after some guidance on how to support my use cases in the best possible way. As it is now, I'm pondering doing something similar to what I have now, i.e nginx authentication in front of an unauthenticated keycloak instance.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions