mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
crowdsec: Fix journalctl acquisitions
After spending an hour figuring this out on my own, I found this https://codeberg.org/kampka/nix-flake-crowdsec/issues/20 :(
This commit is contained in:
parent
1fc98070f1
commit
344baa5f46
1 changed files with 48 additions and 47 deletions
|
|
@ -57,15 +57,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
allowLocalJournalAccess = true;
|
allowLocalJournalAccess = true;
|
||||||
acquisitions =
|
acquisitions = [
|
||||||
let
|
|
||||||
mkJournalAcquisition = unit: {
|
|
||||||
source = "journalctl";
|
|
||||||
journalctl_filter = [ "_SYSTEMD_UNIT=${unit}" ];
|
|
||||||
labels.type = "syslog";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
[
|
|
||||||
(lib.mkIf cfg.sources.iptables {
|
(lib.mkIf cfg.sources.iptables {
|
||||||
source = "journalctl";
|
source = "journalctl";
|
||||||
journalctl_filter = [ "-k" ];
|
journalctl_filter = [ "-k" ];
|
||||||
|
|
@ -75,11 +67,19 @@ in
|
||||||
filenames = [ "${config.services.caddy.logDir}/*.log" ];
|
filenames = [ "${config.services.caddy.logDir}/*.log" ];
|
||||||
labels.type = "caddy";
|
labels.type = "caddy";
|
||||||
})
|
})
|
||||||
(lib.mkIf cfg.sources.sshd (mkJournalAcquisition "sshd.service"))
|
(lib.mkIf cfg.sources.sshd {
|
||||||
|
source = "journalctl";
|
||||||
|
journalctl_filter = [ "_SYSTEMD_UNIT=sshd.service" ];
|
||||||
|
labels.type = "syslog";
|
||||||
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.crowdsec.serviceConfig.ExecStartPre =
|
systemd.services.crowdsec.serviceConfig = {
|
||||||
|
# Fix journalctl acquisitions
|
||||||
|
PrivateUsers = false;
|
||||||
|
|
||||||
|
ExecStartPre =
|
||||||
let
|
let
|
||||||
installCollection = collection: ''
|
installCollection = collection: ''
|
||||||
if ! cscli collections list | grep -q "${collection}"; then
|
if ! cscli collections list | grep -q "${collection}"; then
|
||||||
|
|
@ -106,6 +106,7 @@ in
|
||||||
|> mkScript "crowdsec-install-collections";
|
|> mkScript "crowdsec-install-collections";
|
||||||
in
|
in
|
||||||
lib.mkAfter collectionsScript;
|
lib.mkAfter collectionsScript;
|
||||||
|
};
|
||||||
|
|
||||||
custom.persist.directories = [ "/var/lib/crowdsec" ];
|
custom.persist.directories = [ "/var/lib/crowdsec" ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue