forked from zentralwerk/network
nixos-module/collectd: add execUser workaround
This commit is contained in:
parent
78e528d024
commit
762a9df69c
|
@ -13,6 +13,11 @@ let
|
||||||
customTypesDb = builtins.toFile "types.db" ''
|
customTypesDb = builtins.toFile "types.db" ''
|
||||||
stations value:GAUGE:0:U
|
stations value:GAUGE:0:U
|
||||||
'';
|
'';
|
||||||
|
inherit (config.services.collectd) user;
|
||||||
|
execUser =
|
||||||
|
if user == "root"
|
||||||
|
then "nobody"
|
||||||
|
else user;
|
||||||
isUpstream =
|
isUpstream =
|
||||||
builtins.match "upstream.*" hostName != null ||
|
builtins.match "upstream.*" hostName != null ||
|
||||||
builtins.match "anon.*" hostName != null;
|
builtins.match "anon.*" hostName != null;
|
||||||
|
@ -90,11 +95,11 @@ in
|
||||||
else maxTimeout
|
else maxTimeout
|
||||||
) 180 (builtins.attrNames config.site.net);
|
) 180 (builtins.attrNames config.site.net);
|
||||||
in ''
|
in ''
|
||||||
Exec "nobody" "${pkgs.ruby}/bin/ruby" "${./dhcpcount.rb}" "${toString maxTimeout}"
|
Exec "${execUser}" "${pkgs.ruby}/bin/ruby" "${./dhcpcount.rb}" "${toString maxTimeout}"
|
||||||
'';
|
'';
|
||||||
}) (lib.optionalAttrs config.services.unbound.enable {
|
}) (lib.optionalAttrs config.services.unbound.enable {
|
||||||
plugins.exec = ''
|
plugins.exec = ''
|
||||||
Exec "nobody" "${pkgs.ruby}/bin/ruby" "${./unbound.rb}"
|
Exec "${execUser}" "${pkgs.ruby}/bin/ruby" "${./unbound.rb}"
|
||||||
'';
|
'';
|
||||||
}) (lib.optionalAttrs hasStarlink {
|
}) (lib.optionalAttrs hasStarlink {
|
||||||
plugins.exec = ''
|
plugins.exec = ''
|
||||||
|
|
Loading…
Reference in New Issue