nixos/promtail: Allow write access to positions file if not in CacheDirectory
Because of `ProtectSystem=strict`, Promtail cannot write to the positions file if it's not in its `CacheDirectory` (the default value). (cherry picked from commit b6ad701a2c6bf619fa9418a8e27c4940ce921456)
This commit is contained in:
parent
e85f0175e3
commit
f69c32ec21
@ -7,6 +7,9 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
allowSystemdJournal = cfg.configuration ? scrape_configs && lib.any (v: v ? journal) cfg.configuration.scrape_configs;
|
allowSystemdJournal = cfg.configuration ? scrape_configs && lib.any (v: v ? journal) cfg.configuration.scrape_configs;
|
||||||
|
|
||||||
|
allowPositionsFile = !lib.hasPrefix "/var/cache/promtail" positionsFile;
|
||||||
|
positionsFile = cfg.configuration.positions.filename;
|
||||||
in {
|
in {
|
||||||
options.services.promtail = with types; {
|
options.services.promtail = with types; {
|
||||||
enable = mkEnableOption "the Promtail ingresser";
|
enable = mkEnableOption "the Promtail ingresser";
|
||||||
@ -53,6 +56,7 @@ in {
|
|||||||
RestrictSUIDSGID = true;
|
RestrictSUIDSGID = true;
|
||||||
PrivateMounts = true;
|
PrivateMounts = true;
|
||||||
CacheDirectory = "promtail";
|
CacheDirectory = "promtail";
|
||||||
|
ReadWritePaths = lib.optional allowPositionsFile (builtins.dirOf positionsFile);
|
||||||
|
|
||||||
User = "promtail";
|
User = "promtail";
|
||||||
Group = "promtail";
|
Group = "promtail";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user