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

Restrict Cluster Role access authorizations #3156

Open
orltom opened this issue Jul 22, 2024 · 4 comments
Open

Restrict Cluster Role access authorizations #3156

orltom opened this issue Jul 22, 2024 · 4 comments
Labels
area:collector Issues for deploying collector area:rbac Issues relating to RBAC help wanted Extra attention is needed question Further information is requested

Comments

@orltom
Copy link

orltom commented Jul 22, 2024

Component(s)

No response

Describe the issue you're reporting

Context
Our current setup uses the OpenTelemetry Operator to make the application traceable. The operator is deployed through a Helm Chart. However, our Trivy scanner identifies that the operator has broad permissions via the Kubernetes ClusterRole.

Revise
Based on my understanding, the OpenTelemetry Operator's current permissions allow it to delete various Kubernetes resources like pods, services, and service accounts. This level of access seems unnecessary for the operator's intended functionality.

The RBAC are generated via go maker comments. The most relevant ones are on the OpenTelemetryCollectorReconciler struct in the Reconcile function.

Suggestion

  • For more granular access, define for each required Kubernetes kind access via +kubebuilder:rbac and do not group them in a single go comment marker.
  • Remove delete access

Hint
As these are cluster roles, this applies to all namespaces.

Version
Helm Chart v0.58.2

@jaronoff97 jaronoff97 added help wanted Extra attention is needed question Further information is requested area:collector Issues for deploying collector discuss-at-sig This issue or PR should be discussed at the next SIG meeting and removed needs triage labels Jul 24, 2024
@husnialhamdani
Copy link
Member

I interested to work on this, can i get some details on which part I have to refactor?

@jaronoff97 jaronoff97 added the area:rbac Issues relating to RBAC label Aug 1, 2024
@orltom
Copy link
Author

orltom commented Aug 3, 2024

Since I'm still familiarizing myself with the Operator codebase and associated Helm chart, I'd appreciate clarification on the following:

  • Permissions: Can a main contributor explain why the Operator needs permissions to create and delete Pods, Services, and ServiceAccounts?
  • Ingress Configuration: I noticed the OpenTelemetry CRD v1beta1 supports Ingress creation. Should this be handled within the operator or as part of the Helm chart deployment?
  • RBAC and Helm Chart Synchronization: If changes are required to the RBAC manifests, how are these changes reflected in the Helm Chart repository? Are the main branches kept in sync?

After that I would also be prepared to help fix the issue. :)

@iblancasa
Copy link
Contributor

  • Permissions: Can a main contributor explain why the Operator needs permissions to create and delete Pods, Services, and ServiceAccounts?
  • Ingress Configuration: I noticed the OpenTelemetry CRD v1beta1 supports Ingress creation. Should this be handled within the operator or as part of the Helm chart deployment?

We prefer to handle this as part of the operator. Not everybody using the operator uses Helm to deploy. Also, it would involve more work on the Helm chart side.

  • RBAC and Helm Chart Synchronization: If changes are required to the RBAC manifests, how are these changes reflected in the Helm Chart repository? Are the main branches kept in sync?

I think you should ask this in the Helm chart repository.

@pavolloffay
Copy link
Member

discussed at SIG meeting:

  • split the grouping +kubebuilder:rbac
  • remove delete if it works (the stateful set might require delete in mutate.go)

A ticket should be opened at helm char repo to change the packaging - when installed in namespace more use the role instead of clusterrole.

@pavolloffay pavolloffay removed the discuss-at-sig This issue or PR should be discussed at the next SIG meeting label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:collector Issues for deploying collector area:rbac Issues relating to RBAC help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants