-
Notifications
You must be signed in to change notification settings - Fork 169
Refactor user change on service #8347
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
base: main
Are you sure you want to change the base?
Conversation
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
|
||
// isSystemdRunning checks if systemd is the init system and is running | ||
func isSystemdRunning() bool { | ||
// Check if systemd is PID 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update comment since what we are doing here is implement the same check as sd_booted()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't follow, please be explicit
|
💔 Build Failed
Failed CI Steps
History
|
This PR refactor the way how we do User change during
unprivileged
andprivileged
actions.Pre-PR we removed and reinstalled service again with new user setup.
Post-PR we rewrite service file directly (linux and darwin) or use syscall to change config (windows). Then we restart service.
This reduces window for interrupt.
While pre-PR could leave us without a service, in this case we haven't won entirely. We can end up with broken service when service manager decides config/user is not valid/enabled. This at least leaves a trace in system logs.
Tests covering switch between privilege modes are already present
Closes: #8268