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

RBAC: Unclear required access level for the audit topic #460

Open
4 tasks done
Ilyin-V-V opened this issue Jun 27, 2024 · 11 comments
Open
4 tasks done

RBAC: Unclear required access level for the audit topic #460

Ilyin-V-V opened this issue Jun 27, 2024 · 11 comments
Labels
area/audit area/rbac Related to Role Based Access Control feature good first issue Up for grabs hacktoberfest Issues good for hacktoberfest goal scope/backend Related to backend changes status/confirmed A bug that is a confirmed one. Applicable only for the bug label. status/triage/completed Automatic triage completed type/bug Something isn't working

Comments

@Ilyin-V-V
Copy link

Issue submitter TODO list

  • I've looked up my issue in FAQ
  • I've searched for an already existing issues here
  • I've tried running main-labeled docker image and the issue still persists there
  • I'm running a supported version of the application which is listed here

Describe the bug (actual behavior)

Lack of access to _kui_audit_log topic messages when configuring LDAP, RBAC.
If you disable RBAC, then access to messages is available, what could be the reason for this behavior?

Expected behavior

Reading messages in the _kui_audit_log topic using kui even if RBAC is enabled

Your installation details

auth:
type: LDAP

spring:
jmx:
enabled: true

ldap:
urls: ldap://ms.it.domain.com:389
base:
admin-user:
admin-password:
user-filter-search-base: DC=it,DC=domain,DC=com
user-filter-search-filter: (&(uid={0})(objectClass=inetOrgPerson))
group-filter-search-base: ou=Groups,DC=it,DC=domain,DC=com

kafka:
clusters:
-
name: Kafka-cluster-1
bootstrapServers: kafka1.com,kafka2.com,kafka3.com
ssl:
truststorelocation: /truststore.jks
truststorepassword:
properties:
security:
protocol: SASL_SSL
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="" password="";

  audit:
    topicAuditEnabled: true
    consoleAuditEnabled: true
    topic: "__kui-audit-log" # default name
    auditTopicProperties: # any kafka topic properties in format of a map
      retention.ms: 43200000
    auditTopicsPartitions: 1 # how many partitions, default is 1
    level: ALTER_ONLY # either ALL or ALTER_ONLY (default). ALL will log all read operations.**

rbac:
roles:
- name: "admins"
clusters:
- Kafka-cluster-1
subjects:
- provider: ldap
type: group
value: "MS"

  permissions:
    - resource: applicationconfig
      actions: all

    - resource: clusterconfig
      actions: all

    - resource: topic
      value: ".*"
      actions: all

    - resource: consumer
      value: ".*"
      actions: all

    - resource: acl
      value: ".*"
      actions: all

    - resource: schema
      value: ".*"
      actions: all

    - resource: connect
      value: ".*"
      actions: all

    - resource: ksql
      value: ".*"
      actions: all

Steps to reproduce

Enable LDAP, enable RBAC

Screenshots

No response

Logs

, String, String, Long, Long, String, String, String, ServerWebExchange)
2024-06-27 15:35:40,259 DEBUG [reactor-http-epoll-4] o.s.w.s.a.HttpWebHandlerAdapter: [ea53e5a8-59] Completed 403 FORBIDDEN
2024-06-27 15:35:41,638 DEBUG [reactor-http-epoll-4] o.s.w.s.a.HttpWebHandlerAdapter: [ea53e5a8-60] HTTP GET "/api/clusters/Kafka-cluster-1/topics/__kui-audit-log/messages/v2?limit=100&mode=LATEST"
2024-06-27 15:35:41,640 DEBUG [reactor-http-epoll-4] o.s.w.r.r.m.a.RequestMappingHandlerMapping: [ea53e5a8-60] Mapped to io.kafbat.ui.controller.MessagesController#getTopicMessagesV2(String, String, PollingModeDTO, List, Integer, String, String, Long, Long, String, String, String, ServerWebExchange)

Additional context

similar problem on https://github.com/provectus/kafka-ui, perhaps you need to explicitly set the access rules acl is disabled on kafka

@Ilyin-V-V Ilyin-V-V added status/triage Issues pending maintainers triage type/bug Something isn't working labels Jun 27, 2024
@kapybro kapybro bot added status/triage/manual Manual triage in progress status/triage/completed Automatic triage completed and removed status/triage Issues pending maintainers triage labels Jun 27, 2024
Copy link

Hi Ilyin-V-V! 👋

Welcome, and thank you for opening your first issue in the repo!

Please wait for triaging by our maintainers.

As development is carried out in our spare time, you can support us by sponsoring our activities or even funding the development of specific issues.
Sponsorship link

If you plan to raise a PR for this issue, please take a look at our contributing guide.

@Haarolean
Copy link
Member

_kui_audit_log is just a topic and has no special treatment from the perspective of RBAC. You have to add RBAC rules for that topic manually. Let me know if there's anything else we could help with.

@Haarolean Haarolean closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2024
@Haarolean Haarolean added status/invalid This doesn't seem right and removed status/triage/manual Manual triage in progress labels Jun 27, 2024
@Ilyin-V-V
Copy link
Author

And I think that _kui_audit_log is just a topic, but why then the rule:

  • resource: topic
    value: ".*"
    actions: all
    results in Completed 403 FORBIDDEN. I also tried to write the rule explicitly:
  • resource: topic
    value: ".*audit-log"
    actions: [view, messages_read]

but I still get 403 FORBIDDEN

@Haarolean
Copy link
Member

Aah, sorry, there actually is a special treatment for the audit topic:
In order to be able to view its messages you have to add the following RBAC permission:

        - resource: audit
          actions: all

Please let me know if it works for you

@Haarolean Haarolean reopened this Jun 28, 2024
@Haarolean Haarolean added status/feedback-requested and removed status/invalid This doesn't seem right labels Jun 28, 2024
Copy link

kapybro bot commented Jun 28, 2024

Further user feedback is requested. Please reply within 7 days or we might close the issue.

@kapybro kapybro bot unassigned Ilyin-V-V Jun 28, 2024
@kafbat kafbat deleted a comment from kapybro bot Jun 28, 2024
@Haarolean Haarolean added impact/documentation A PR with changes which should be addressed in the documentation and removed type/bug Something isn't working labels Jun 28, 2024
@Ilyin-V-V
Copy link
Author

Ааа, извините, на самом деле для темы аудита существует особая обработка: чтобы иметь возможность просматривать ее сообщения, вам необходимо добавить следующее разрешение RBAC:

        - resource: audit
          actions: all

Пожалуйста, дайте мне знать, если это вам подходит.

It doesn't work for me, here is my RBAC:
rbac:
roles:

  • name: "admins"
    clusters:
  • Kafka-cluster-1
    subjects:
  • provider: ldap
    type: group
    value: "MS"
    permissions:
  • resource: topic
    value: ".*"
    actions: all
  • resource: audit
    actions: all

And still, when reading from the UI topic __kui-audit-log in the logs - Completed 403 FORBIDDEN
Version kafbat-ui-v1.0.0.jar

@Haarolean
Copy link
Member

This particular config works for me:

        - resource: topic
          value: "__kui-audit-log"
          actions: all

        - resource: audit
          actions: all

The question why we'd need both still remains, we'll take a look into this. For now, please add both the actions to your config, this should work.

@Haarolean Haarolean added scope/backend Related to backend changes type/bug Something isn't working area/rbac Related to Role Based Access Control feature area/audit and removed impact/documentation A PR with changes which should be addressed in the documentation labels Jul 1, 2024
@Haarolean Haarolean added the good first issue Up for grabs label Jul 1, 2024
@Haarolean Haarolean changed the title Access to the _kui_audit_log topic RBAC: Unclear required access level for the audit topic Jul 1, 2024
@Haarolean Haarolean moved this to Todo in Up for grabs Jul 1, 2024
@Ilyin-V-V
Copy link
Author

Мне подходит вот эта конфигурация:

        - resource: topic
          value: "__kui-audit-log"
          actions: all

        - resource: audit
          actions: all

Вопрос, зачем нам оба нужны, все еще остается, мы разберемся в этом. А пока добавьте оба действия в свою конфигурацию, это должно работать.

thank you very much, it works

@Haarolean Haarolean added the status/confirmed A bug that is a confirmed one. Applicable only for the bug label. label Jul 1, 2024
@Haarolean Haarolean added the hacktoberfest Issues good for hacktoberfest goal label Oct 4, 2024
@Ansh7899
Copy link

Ansh7899 commented Oct 4, 2024

is the issue resolved?

@Haarolean
Copy link
Member

@Ansh7899 nope, feel free to tackle this! We should allow access to the audit topic via resource: audit permission without a need for resource: topic one.

@Haarolean Haarolean removed the status in Up for grabs Oct 4, 2024
@Haarolean Haarolean moved this to In Development in Up for grabs Oct 4, 2024
@Haarolean Haarolean moved this from In Development to Todo in Up for grabs Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/audit area/rbac Related to Role Based Access Control feature good first issue Up for grabs hacktoberfest Issues good for hacktoberfest goal scope/backend Related to backend changes status/confirmed A bug that is a confirmed one. Applicable only for the bug label. status/triage/completed Automatic triage completed type/bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

3 participants