-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Heartbeat on Agent failed to start due to permission denied #33292
Comments
So, found the issue, commenting out this line seems to fix it (or at least the instance of the issue I can easily reproduce): beats/heartbeat/security/security.go Line 57 in 7bddf80
Considering that I only seem to hit this when running as root, I assume the issue is the result of us dropping capabilities that allow us to read/write from files/directories not owned by the user. Will investigate more tomorrow, although that line has been there for a while, so I wonder if the issue is a tad more subtle. |
@fearful-symmetry We shouldn't really be relying on capabilities to have access to the underlying file system afaik, that should be enabled by file permission levels. We had to do some changes back in 8.2 to fix those, this problem could be related to that. I'll have a look at it too. |
@fearful-symmetry @aleksmaus Going back on my previous answer, it does seem us dropping This will be an issue on agent deployments if heartbeat is selected as the first beat to initialize data directories. @andrewvc We could add |
Yep, this is where I ran into this.
Seconding this, although it needs to happen natively as well, and not just docker. I assume there isn't really any use case for running heartbeat as root, so we should look at some solution in elastic-agent itself and not just docker for making sure heartbeat has a coherent set of permissions. |
Pinging @elastic/uptime (Team:Uptime) |
As a heads-up @emilioalvap and I are going to discuss this in detail next week, there's a lot of moving pieces here. |
@emilioalvap / @andrewvc is there an update on when a fix for this might get rolled out? |
@fearful-symmetry should have more info by EOD, we are going to discuss this one today |
This issue is created for SDH https://github.com/elastic/sdh-beats/issues/2585.
Confirmed for the beats version 8.3.3.
The hearbeat fails to start intermittently due to:
The latest theory is that it might have something to do when and how the heartbeat seccomp filter is applied. Depending on the timing it looks like the hearbeat might try to create paths at the time when it is restricted from calling the
mkdirat
syscall.Here is the latest comment from the SDH:
here is another piece of the puzzle, the file system audit when the problem happens.
you can see that the process uid is root (0)
and the syscall
mkdirat
fails with EACCES on/home/amaus/work/elastic-agent-8.3.3-linux-x86_64444/data/elastic-agent-0ffbed/run
I also noticed that heartbeat defines the seccomp filter in:
https://github.com/elastic/beats/blob/main/heartbeat/security/policy_linux_amd64.go
that includes
mkdirat
.I'm not familiar with the libbeat initialization order or the heartbeat or how the seccomp is utilized enough, but one possible concern that depending on the timing the paths initialization in the heartbeat could try to call
mkdirat
before this syscall was "allow-listed" with seccomp filter.thoughts? maybe you or anybody who worked on the heartbeat closer might know about this.
@fearful-symmetry or @pierrehilbert I could dig further, or maybe you have somebody on the beats team who knows more about this area. I'll assign this ticket to you both for now, feel free to reassign as needed.
The text was updated successfully, but these errors were encountered: