-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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 service: init #27019
heartbeat service: init #27019
Conversation
@fadenb Are you going to be the maintainer of this service? |
As I plan to use it extensively: Yes :) |
mkdir -p ${cfg.stateDir}/data | ||
mkdir -p ${cfg.stateDir}/logs | ||
''; | ||
serviceConfig = { |
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.
Does the program implement its own privsep or does it end up running with full privileges?
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.
@joachifm heartbeat documentation ( https://www.elastic.co/guide/en/beats/heartbeat/current/configuration-heartbeat-options.html#monitor-type ) states that root is required for icmp type monitors but it seems to be working fine with a "cap_net_raw+p" wrapper. I will change the PR accordingly
wantedBy = [ "multi-user.target" ]; | ||
preStart = '' | ||
mkdir -p ${cfg.stateDir}/data | ||
mkdir -p ${cfg.stateDir}/logs |
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.
Replace with this exact code: mkdir -p "${cfg.stateDir}"/{data,logs}
mkdir -p ${cfg.stateDir}/logs | ||
''; | ||
serviceConfig = { | ||
ExecStart = "${pkgs.heartbeat}/bin/heartbeat -c ${heartbeatYml} -path.data ${cfg.stateDir}/data -path.logs ${cfg.stateDir}/logs"; |
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.
Quote your variables.
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.
Address the security issues, if any, since it should probably run as user nobody and additionally fix everything I mentioned.
wantedBy = [ "multi-user.target" ]; | ||
preStart = '' | ||
mkdir -p "${cfg.stateDir}"/{data,logs} | ||
chown nobody "${cfg.stateDir}"/{data,logs} |
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.
Also set the group explicitly.
@fadenb Thanks for the feedback and your changes |
Thank you |
Motivation for this change
This is basically a copy of the existing journalbeat service by @mbrgm allowing quick and easy setup of elastic heartbeat.
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)