Skip to content

Conversation

@KannarFr
Copy link
Contributor

Fixes #5720

Motivation

Provide "real" authz abilities to pulsar resources.

Modifications

Add stuff to AuthorizationProvider interface, and use them on every pulsar resource management auth (tenant, namespace, topics, functions, connectors, ...)

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

Will add specified test.

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? not documented (yet, will do)

@KannarFr KannarFr force-pushed the authorizationprovider-more-granularity branch 2 times, most recently from b1261bb to 9fc963e Compare February 26, 2020 15:31
@joefk
Copy link
Contributor

joefk commented Feb 27, 2020

I see that there is an unload permission being granted to namespace owners? What is the rationale?

A few many unloads, and you ZK and cluster is dead.

There is a reason these operations are restricted. So unless you are willing to introduce and implement adequate defense measures into Pulsar, these are all opening DOS and vulnerabilities into the system.

@KannarFr
Copy link
Contributor Author

@joefk I'm open to all discussion I don't know correctly this part. Can you explain why unloads are critical for Pulsar? We can imagine that only one unload is authorized at the same time.

The main goal of this issue is to provide real authz provider.

@KannarFr KannarFr force-pushed the authorizationprovider-more-granularity branch 2 times, most recently from 5e84419 to c816e0a Compare February 27, 2020 16:47
@joefk
Copy link
Contributor

joefk commented Feb 27, 2020

@KannarFr you should get familiar with the PIP-49 and the discussion on the dev list about it. Just because unload operates on a namespace, it does not imply that it should ever be executed by a namespace owner.

FWIW, I don't think it's feasible to implement an adequate restriction on unload in a simple way, because it's a system management operation, driven by system management needs.

At the least, these kind of shoot-yourself features should not be hard-coded into the broker as a possible option. It should be in a config file.

@KannarFr
Copy link
Contributor Author

KannarFr commented Feb 28, 2020

@joefk I think every permissions should be granted by authz provider. So we need to provide authz provider stuff to authorize or not, but it's not to the pulsar side to decide if access is grant or not. Maybe we can document critical stuff as mentioned unload but that's it. I'm not working on the PulsarAuthorizationProvider which is the default used, but on the AuthorizationProvider interface and its usages.

Thats being said, I can be wrong, WDYT?

@KannarFr KannarFr force-pushed the authorizationprovider-more-granularity branch 4 times, most recently from b6a2f25 to 95bd416 Compare February 28, 2020 14:11
@joefk
Copy link
Contributor

joefk commented Feb 29, 2020

@KannarF

I think every permissions should be granted by authz provider.

Some of them are not grantable. How did your arrive at that conclusion? That is a very simplistic view of the system. After going through PIP-49 and the discussions about that, what is your take?

As, you state in the description of your PR..

And the biggest part of the task: go through every usage of validateSuperUserAccess and validateAdminAccessForTenant and check if they can be replaced with finer grain access
Can you share your findings for that? I did not see any

My concern is this. How can I, as a Pulsar operator (NOT a tenant) decide which of these operations I will delegate to my tenants for finer control ?

Operators should not be put in a position where if they were to deploy this authz provider, they would have to go and turn off/on certain actions for all fine-grained resources every time someone creates a namespace or topic. And the things you are proposing to delegate here in this proposal are an operators nightmare for a large cluster. Hence my ask. Put the list of the things that can be delegated into a config file, so that operators can decide ONCE when they DEPLOY Pulsar, about what can be potentially delegated. Don't hardcode it into the server, and create runtime maintenance work for operators

@KannarFr
Copy link
Contributor Author

KannarFr commented Feb 29, 2020 via email

@sijie
Copy link
Member

sijie commented Feb 29, 2020

@KannarFr

Thank you for your contribution!

I think we should have a clear interface about resources and verbs. I feel that you are mixing resources with verbs and generating a lot of "unneeded" operations.

For example, each policy rule in a namespace policy should be treated as a resource. The operations to a given policy rule are write and read. So when you introduce a new policy rule, you don't need to introduce a new verb. Also, I don't think enum is a good way to allow extensibility. I think we can use a string for representing different policy rules within a namespace policy.

Kubernetes' API machinery provides a good example of this.


@joefk

I think the pull request here is to allow people to define their own authorization implementation since some organizations have the need to integrate Pulsar into its owner authentication/authorization system to control those resources. The purpose of this pull request is different from PIP-49. We attempt to improve the current authorization model. This pull request should NOT change our current authorization model as the concerns have been raised when discussing PIP-49.

@sijie sijie added this to the 2.6.0 milestone Feb 29, 2020
@KannarFr KannarFr force-pushed the authorizationprovider-more-granularity branch 5 times, most recently from a9a5ef2 to c5a3623 Compare March 9, 2020 13:54
@KannarFr
Copy link
Contributor Author

KannarFr commented Mar 9, 2020

@sijie operations like internalGrantPermissionOnNamespace in NamespacesBase.java are antipattern with the reworking I'm doing. I don't know how to manage them. I think I should let them as they are. Due to "real" authz plugin we should drop all roles/actions stuff which are in ZK. DefaultAuthzProvider should be updated regarding this.

That being said, we need maintain legacy stuff so I would like to have your opinions about this.

@joefk
Copy link
Contributor

joefk commented Mar 10, 2020

Due to "real" authz plugin we should drop all roles/actions stuff which are in ZK. DefaultAuthzProvider should be updated regarding this.That being said, we need maintain legacy stuff so I would like to have your opinions about this.

I would like to see legacy stuff work as it is.

My concern is that is trying to impose a model which is not supported in Pulsar. Assumptions like "Any resource operation should be managed/authorized by the resource which owns it." and "ClusterOperations should manage Tenants, TenantOperation should manage Namespaces, etc. Hierarchical approach" it only makes me think that is being designed for some other system, which is not Pulsar.

Pulsar has no operational hierarchy beyond tenants. It is not designed for namespace admins or topic admins. The premise of pulsar is that a tenant manages all its namespaces. There are operations that can be logically managed at the namespace and topic level, but that is a convenience for the tenant admin.

@KannarFr KannarFr force-pushed the authorizationprovider-more-granularity branch 4 times, most recently from 4e771a6 to 1ec4a95 Compare March 10, 2020 16:20
@jiazhai
Copy link
Member

jiazhai commented May 10, 2020

@tuteng @zymap Would you also please help review this PR?

@sijie sijie merged commit 029b6f4 into apache:master May 18, 2020
@sijie
Copy link
Member

sijie commented May 18, 2020

Merged this pull request to allow some time to bake the change for the 2.6.0 release.

Huanli-Meng pushed a commit to Huanli-Meng/pulsar that referenced this pull request May 27, 2020
Fixes apache#5720

### Motivation

Provide "real" authz abilities to pulsar resources.

### Modifications

Add stuff to `AuthorizationProvider` interface, and use them on every pulsar resource management auth (tenant, namespace, topics, functions, connectors, ...)
jiazhai added a commit to jiazhai/pulsar that referenced this pull request Jun 11, 2020
jiazhai added a commit that referenced this pull request Jun 24, 2020
### Motivation
In #6708, we change to use `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)` for the dynamic check of superuser using AuthenticationDataSource. And #6428 is using old method  `isSuperUser(String, ServiceConfiguration)`,
This change tries to change it back.

### Modifications

switch `isSuperUser(String, ServiceConfiguration)` to `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)`
codelipenghui pushed a commit to streamnative/pulsar-archived that referenced this pull request Jul 14, 2020
### Motivation
In apache#6708, we change to use `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)` for the dynamic check of superuser using AuthenticationDataSource. And apache#6428 is using old method  `isSuperUser(String, ServiceConfiguration)`,
This change tries to change it back.

### Modifications

switch `isSuperUser(String, ServiceConfiguration)` to `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)`

(cherry picked from commit 45afb56)
cdbartholomew pushed a commit to kafkaesque-io/pulsar that referenced this pull request Jul 21, 2020
### Motivation
In apache#6708, we change to use `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)` for the dynamic check of superuser using AuthenticationDataSource. And apache#6428 is using old method  `isSuperUser(String, ServiceConfiguration)`,
This change tries to change it back.

### Modifications

switch `isSuperUser(String, ServiceConfiguration)` to `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)`
cdbartholomew pushed a commit to kafkaesque-io/pulsar that referenced this pull request Jul 24, 2020
### Motivation
In apache#6708, we change to use `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)` for the dynamic check of superuser using AuthenticationDataSource. And apache#6428 is using old method  `isSuperUser(String, ServiceConfiguration)`,
This change tries to change it back.

### Modifications

switch `isSuperUser(String, ServiceConfiguration)` to `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)`
wolfstudy pushed a commit that referenced this pull request Jul 29, 2020
### Motivation
In #6708, we change to use `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)` for the dynamic check of superuser using AuthenticationDataSource. And #6428 is using old method  `isSuperUser(String, ServiceConfiguration)`,
This change tries to change it back.

### Modifications

switch `isSuperUser(String, ServiceConfiguration)` to `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)`

(cherry picked from commit 45afb56)
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
Fixes apache#5720

### Motivation

Provide "real" authz abilities to pulsar resources.

### Modifications

Add stuff to `AuthorizationProvider` interface, and use them on every pulsar resource management auth (tenant, namespace, topics, functions, connectors, ...)
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
### Motivation
In apache#6708, we change to use `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)` for the dynamic check of superuser using AuthenticationDataSource. And apache#6428 is using old method  `isSuperUser(String, ServiceConfiguration)`,
This change tries to change it back.

### Modifications

switch `isSuperUser(String, ServiceConfiguration)` to `isSuperUser(String, AuthenticationDataSource, ServiceConfiguration)`
codelipenghui pushed a commit that referenced this pull request Jun 13, 2022
#16026)

Cherry-pick #15956.
### Motivation
Currently, we need admin permissions to operate the schema API. This is because the admin permission was defined when the schema API was first added. See #1381.
Later, then adding authentication granularity with #6428, we don't change the schema API part.  So leave the admin permission today.

But the binary protocol allows the produce/consume permission to get the schema, so change the related method permission to `produce/consume`.
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jun 13, 2022
…#15956) (apache#16026)

Cherry-pick apache#15956.
### Motivation
Currently, we need admin permissions to operate the schema API. This is because the admin permission was defined when the schema API was first added. See apache#1381.
Later, then adding authentication granularity with apache#6428, we don't change the schema API part.  So leave the admin permission today.

But the binary protocol allows the produce/consume permission to get the schema, so change the related method permission to `produce/consume`.

(cherry picked from commit f3b4e86)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

authorize tenant level and namespace level access from the authorization provider

7 participants