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

CAP_SYS_ADMIN does not allow loki.source.file to read /var/log/messages owned by root:root #2540

Open
Nachtfalkeaw opened this issue Jan 25, 2025 · 4 comments
Assignees
Labels
beyla bug Something isn't working

Comments

@Nachtfalkeaw
Copy link

What's wrong?

I am running alloy 1.5.1. because I want to use beyla.ebpf I use capabilities. One of these capabilities is CAP_SYS_ADMIN (https://man7.org/linux/man-pages/man7/capabilities.7.html)

This capability - I think - should allow more or less root privileges. However with this capability alloy running as grafana:grafana it is not possible to use loki.source.file to read /var/log/messages owned by root:root.

Error:
Nov 26 23:10:43 hostname alloy[2798317]: ts=2024-11-26T22:10:43.200409405Z level=error msg="failed to start tailer" component_path=/ component_id=loki.source.file.varlog_messages error="open /var/log/messages: permission denied" filename=/var/log/messages

Steps to reproduce

  1. create a separate user and group grafana:grafana which is not root.
  2. try to tail a log file e.g. /var/log/messages which is owned by root:root and can not be read by "other".
  3. set capability CAP_SYS_ADMIN to alloy

System information

RHEL 8

Software version

Grafana 1.5.1

Configuration

loki.source.file

Logs

Error:
`Nov 26 23:10:43 hostname alloy[2798317]: ts=2024-11-26T22:10:43.200409405Z level=error msg="failed to start tailer" component_path=/ component_id=loki.source.file.varlog_messages error="open /var/log/messages: permission denied" filename=/var/log/messages`
@Nachtfalkeaw Nachtfalkeaw added the bug Something isn't working label Jan 25, 2025
@Nachtfalkeaw
Copy link
Author

Nachtfalkeaw commented Jan 25, 2025

##2535

@Nachtfalkeaw
Copy link
Author

@mariomac and @grcevski
I know this is an older version of beyla in alloy 1.5.1 than the single binary however you may have a look which capabilities are needed with latest 2.x.y beyla, update the docs and make sure that the alloy integration of beyla can use these capabilities or maybe these capabilities can be used by other components within alloy.

@grcevski
Copy link

grcevski commented Feb 5, 2025

Thanks for reporting, we'll investigate this.

@grcevski grcevski added the beyla label Feb 5, 2025
@rafaelroquetto rafaelroquetto self-assigned this Feb 5, 2025
@rafaelroquetto
Copy link
Contributor

@Nachtfalkeaw just to confirm, as I am going to have a look at this, how are you granting CAP_SYS_ADMIN to alloy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beyla bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants