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

ACL host option support #519

Open
tolikkk opened this issue Aug 2, 2022 · 2 comments
Open

ACL host option support #519

tolikkk opened this issue Aug 2, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@tolikkk
Copy link

tolikkk commented Aug 2, 2022

In traditional ACL client (embedded kafka-acls.sh) it is possible to define host parameter (ip address) that ACL will affect to.

ACL for resource options:

  • principal
  • host
  • operation
  • permissionType

Example for ACL with host option:
kafka-acls.sh --bootstrap-server=broker.example.com:9092 --add --allow-principal User:* --allow-host 192.168.1.2 --operation ALL --topic bar1

list ACL:

Current ACLs for resource `ResourcePattern(resourceType=TOPIC, name=bar1, patternType=LITERAL)`:
 	(principal=User:*, host=192.168.1.2, operation=ALL, permissionType=ALLOW)

More than that I see host option in the julie ACL execution log and it has wildcard value "host" : "*".
Example for principal "User:Alice" with consumer access to topic bar1:

{
  "Operation" : "com.purbon.kafka.topology.actions.access.CreateBindings",
  "Bindings" : [ {
    "resourceType" : "GROUP",
    "resourceName" : "*",
    "host" : "*",
    "operation" : "READ",
    "principal" : "User:Alice",
    "pattern" : "LITERAL",
    "scope" : null
  }, {
    "resourceType" : "TOPIC",
    "resourceName" : "bar1",
    "host" : "*",
    "operation" : "READ",
    "principal" : "User:Alice",
    "pattern" : "LITERAL",
    "scope" : null
  }, {
    "resourceType" : "TOPIC",
    "resourceName" : "bar1",
    "host" : "*",
    "operation" : "DESCRIBE",
    "principal" : "User:Alice",
    "pattern" : "LITERAL",
    "scope" : null
  } ]
}

Is it possible to use option "host" in topology ACL configuration, like this?

context: "example"
projects:
  - name: "kafka"
    topics:
      - name: "bar1"
        config:
          retention.ms: "604800000"
        consumers:
          - principal: "User:Alice"
            host: "1.2.3.4"

Or maybe there is any other way to do it?

@tolikkk tolikkk added the enhancement New feature or request label Aug 2, 2022
@tolikkk
Copy link
Author

tolikkk commented Aug 4, 2022

I found the solution. It can be done via Custom JulieRoles - https://julieops.readthedocs.io/en/latest/futures/define-custom-roles.html

Steps:

  1. describe custom ACL in roles.yml
roles:
  - name: "custom_acl"
    acls:
      - resourceType: "Topic"
        resourceName: "bar1"
        patternType: "LITERAL"
        host: "1.2.3.4"
        operation: "READ"
        permissionType: "ALLOW"
      - resourceType: "Topic"
        resourceName: "bar1"
        patternType: "LITERAL"
        host: "1.2.3.4"
        operation: "DESCRIBE"
    - resourceType: "Group"
        resourceName: "*"
        patternType: "LITERAL"
        host: "1.2.3.4"
        operation: "READ"
  1. set custom role to topology config
context: "example"
projects:
  - name: "kafka"
    custom_acl:
      - principal: "User:Alice"
    topics:
      - name: "bar1"
        config:
          retention.ms: "604800000"
  1. set custom acl path in config
    julie.roles=/roles.yml

@purbon
Copy link
Collaborator

purbon commented Aug 5, 2022

yes, this is "the way" for now. but somehow I agree with you that introducing this to the other abstractions is a good idea. However, in my own bubble, the host is not usually one config often used as IP can and will certainly change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants