[8.18] (backport #9604) Fix/8544 mac linux unprivileged reenroll#9767
Merged
Conversation
* fix(8544): remove unused files * fix(8544): remove file ownership check in enroll command * fix(8544): added getOwnerFromPath for mac and linux and added relevant tests fix(8544): added empty owner check in enroll unix tests * fix(8544): added fileownership and permission fix in enroll command fix(8544): refactored fix permission computation, and added tests * fix(8544): added noop getOwnerFromPath for windows * fix(8544): updated re-enroll test * fix(8544): added changelog fragment * fix(8544): ran mage check fix(8544): ran mage check * fix(8544): refactored computeFixPermissions and updated relevant test cases * fix(8544): refactor computeFixPermissions if block (cherry picked from commit 08444d4) # Conflicts: # internal/pkg/agent/cmd/enroll.go
Contributor
Author
|
Cherry-pick of 08444d4 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
6 tasks
Contributor
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
Contributor
Author
|
This pull request has not been merged yet. Could you please review and merge it @kaanyalti? 🙏 |
kaanyalti
previously approved these changes
Sep 8, 2025
|
Contributor
💚 Build Succeeded
History
cc @kaanyalti |
kaanyalti
approved these changes
Sep 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




What does this PR do?
Updates the enroll command so that the file permissions are fixed when a privileged user executes enroll. Implemented only for mac/linux. Permission fix is executed every time root executes enroll and enroll is not triggered by install. Windows implementation will be in a follow up pr. Split the PRs as windows implementation may end up being more involved.
Why is it important?
Currently a root user needs to run
sudo -u elastic-agent-user elastic-agent enroll ...in order to re-enroll an unprivileged agent.Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files./changelog/fragmentsusing the changelog toolDisruptive User Impact
None
How to test this PR locally
--unprivilegedflagRelated issues
This is an automatic backport of pull request #9604 done by [Mergify](https://mergify.com).